From 257ddd7d3a344a4774f95072299ba49afe2b1939 Mon Sep 17 00:00:00 2001 From: gkjohnson Date: Tue, 15 Oct 2024 13:57:09 +0000 Subject: [PATCH] update builds --- example/bundle/assets/B3DMLoader-QE4NIaTt.js | 1 + example/bundle/assets/CMPTLoader-C0bkMPP6.js | 1 + .../bundle/assets/CameraControls-Budxqpvb.js | 192 + .../CameraTransitionManager-BQ4iVDfk.js | 1 + .../assets/CesiumIonAuthPlugin-IKQrMOf_.js | 1 + example/bundle/assets/DRACOLoader-Dj1M3u4C.js | 2 + example/bundle/assets/Ellipsoid-_mEueZip.js | 1 + .../bundle/assets/EllipsoidRegion-CSZafkN2.js | 1 + .../assets/EllipsoidRegionHelper-CaOebIdf.js | 1 + .../assets/EnvironmentControls-7w_Q0bky.js | 45 + .../assets/FlyOrbitControls-BAcl0bbv.js | 1 + .../assets/GLTFExtensionLoader-Bl-gplNT.js | 1 + example/bundle/assets/GLTFLoader-JNhhxs0g.js | 1 + .../GLTFMeshFeaturesExtension-CLQL6scj.js | 16 + .../bundle/assets/GlobeControls-B_ZEgOcW.js | 1 + .../assets/GoogleCloudAuthPlugin-B6MTG2Cr.js | 1 + .../assets/GoogleTilesRenderer-BOTt9IiB.js | 1 + example/bundle/assets/I3DMLoader-Bb2sAfDf.js | 1 + example/bundle/assets/LoaderBase-CVSPpjX2.js | 1 + .../bundle/assets/OrbitControls-BpFvfpv4.js | 1 + example/bundle/assets/PNTSLoader-CZfdYf2b.js | 1 + .../assets/TileCompressionPlugin-a_ThVUk-.js | 1 + .../bundle/assets/TilesFadePlugin-ChL3fYSz.js | 47 + .../bundle/assets/TilesRenderer-5XUDbyI2.js | 1 + .../assets/UpdateOnChangePlugin-C5cEQ6o6.js | 1 + example/bundle/assets/b3dmExample-QSIbi-N4.js | 20 + example/bundle/assets/basic-CW0oSi2l.js | 217 + example/bundle/assets/cmptExample-DISwzeib.js | 1 + .../bundle/assets/customMaterial-BJQ88dKh.js | 70 + example/bundle/assets/ellipsoid-C7KvFdMD.js | 1 + example/bundle/assets/fadingTiles-BPQ1elVJ.js | 1 + example/bundle/assets/globe-hh_3Lr0c.js | 1 + example/bundle/assets/gltf-B-zxkh7M.js | 1 + .../assets/googleMapsAerial-ihuPlBcZ.js | 2 + .../assets/googleMapsExample-DNvBq6rL.js | 2 + example/bundle/assets/i3dmExample-CB4Gl4D7.js | 1 + example/bundle/assets/index-BxgnXXKD.js | 3 + example/bundle/assets/ion-CHjD-vAy.js | 1 + example/bundle/assets/ionExample-DauMJ5Em.js | 1 + example/bundle/assets/ionLunar-DehhByKz.js | 1 + .../assets/landformSiteOverlay-DsYDTFG-.js | 29 + example/bundle/assets/leva.esm-DJZUUddB.js | 64 + .../assets/lil-gui.module.min-Bc0DeA9g.js | 10 + example/bundle/assets/mars-CdKTnHSf.js | 1 + example/bundle/assets/metadata-CarZlTVb.js | 172 + .../assets/offscreenShadows-CUSnnjeQ.js | 1 + example/bundle/assets/pntsExample-IGZ5Jaom.js | 1 + .../bundle/assets/readMagicBytes-Da5ueiou.js | 1 + .../bundle/assets/stats.module--VATS4Kh.js | 1 + .../bundle/assets/three.module-CA-qMkP1.js | 3818 +++++++++++++++++ example/bundle/assets/vr-COoG37dp.js | 1 + example/bundle/b3dmExample.html | 46 + example/bundle/cmptExample.html | 40 + example/bundle/customMaterial.html | 45 + example/bundle/ellipsoid.html | 46 + example/bundle/fadingTiles.html | 68 + example/bundle/gltf.html | 36 + example/bundle/googleMapsAerial.html | 85 + example/bundle/googleMapsExample.html | 90 + example/bundle/i3dmExample.html | 37 + example/bundle/index.html | 48 + example/bundle/ionExample.html | 70 + example/bundle/ionLunar.html | 73 + example/bundle/landformSiteOverlay.html | 68 + example/bundle/mars.html | 70 + example/bundle/metadata.html | 99 + example/bundle/offscreenShadows.html | 45 + example/bundle/pntsExample.html | 35 + example/bundle/r3f/basic.html | 54 + example/bundle/r3f/globe.html | 64 + example/bundle/r3f/ion.html | 63 + example/bundle/vr.html | 42 + 72 files changed, 5968 insertions(+) create mode 100644 example/bundle/assets/B3DMLoader-QE4NIaTt.js create mode 100644 example/bundle/assets/CMPTLoader-C0bkMPP6.js create mode 100644 example/bundle/assets/CameraControls-Budxqpvb.js create mode 100644 example/bundle/assets/CameraTransitionManager-BQ4iVDfk.js create mode 100644 example/bundle/assets/CesiumIonAuthPlugin-IKQrMOf_.js create mode 100644 example/bundle/assets/DRACOLoader-Dj1M3u4C.js create mode 100644 example/bundle/assets/Ellipsoid-_mEueZip.js create mode 100644 example/bundle/assets/EllipsoidRegion-CSZafkN2.js create mode 100644 example/bundle/assets/EllipsoidRegionHelper-CaOebIdf.js create mode 100644 example/bundle/assets/EnvironmentControls-7w_Q0bky.js create mode 100644 example/bundle/assets/FlyOrbitControls-BAcl0bbv.js create mode 100644 example/bundle/assets/GLTFExtensionLoader-Bl-gplNT.js create mode 100644 example/bundle/assets/GLTFLoader-JNhhxs0g.js create mode 100644 example/bundle/assets/GLTFMeshFeaturesExtension-CLQL6scj.js create mode 100644 example/bundle/assets/GlobeControls-B_ZEgOcW.js create mode 100644 example/bundle/assets/GoogleCloudAuthPlugin-B6MTG2Cr.js create mode 100644 example/bundle/assets/GoogleTilesRenderer-BOTt9IiB.js create mode 100644 example/bundle/assets/I3DMLoader-Bb2sAfDf.js create mode 100644 example/bundle/assets/LoaderBase-CVSPpjX2.js create mode 100644 example/bundle/assets/OrbitControls-BpFvfpv4.js create mode 100644 example/bundle/assets/PNTSLoader-CZfdYf2b.js create mode 100644 example/bundle/assets/TileCompressionPlugin-a_ThVUk-.js create mode 100644 example/bundle/assets/TilesFadePlugin-ChL3fYSz.js create mode 100644 example/bundle/assets/TilesRenderer-5XUDbyI2.js create mode 100644 example/bundle/assets/UpdateOnChangePlugin-C5cEQ6o6.js create mode 100644 example/bundle/assets/b3dmExample-QSIbi-N4.js create mode 100644 example/bundle/assets/basic-CW0oSi2l.js create mode 100644 example/bundle/assets/cmptExample-DISwzeib.js create mode 100644 example/bundle/assets/customMaterial-BJQ88dKh.js create mode 100644 example/bundle/assets/ellipsoid-C7KvFdMD.js create mode 100644 example/bundle/assets/fadingTiles-BPQ1elVJ.js create mode 100644 example/bundle/assets/globe-hh_3Lr0c.js create mode 100644 example/bundle/assets/gltf-B-zxkh7M.js create mode 100644 example/bundle/assets/googleMapsAerial-ihuPlBcZ.js create mode 100644 example/bundle/assets/googleMapsExample-DNvBq6rL.js create mode 100644 example/bundle/assets/i3dmExample-CB4Gl4D7.js create mode 100644 example/bundle/assets/index-BxgnXXKD.js create mode 100644 example/bundle/assets/ion-CHjD-vAy.js create mode 100644 example/bundle/assets/ionExample-DauMJ5Em.js create mode 100644 example/bundle/assets/ionLunar-DehhByKz.js create mode 100644 example/bundle/assets/landformSiteOverlay-DsYDTFG-.js create mode 100644 example/bundle/assets/leva.esm-DJZUUddB.js create mode 100644 example/bundle/assets/lil-gui.module.min-Bc0DeA9g.js create mode 100644 example/bundle/assets/mars-CdKTnHSf.js create mode 100644 example/bundle/assets/metadata-CarZlTVb.js create mode 100644 example/bundle/assets/offscreenShadows-CUSnnjeQ.js create mode 100644 example/bundle/assets/pntsExample-IGZ5Jaom.js create mode 100644 example/bundle/assets/readMagicBytes-Da5ueiou.js create mode 100644 example/bundle/assets/stats.module--VATS4Kh.js create mode 100644 example/bundle/assets/three.module-CA-qMkP1.js create mode 100644 example/bundle/assets/vr-COoG37dp.js create mode 100644 example/bundle/b3dmExample.html create mode 100644 example/bundle/cmptExample.html create mode 100644 example/bundle/customMaterial.html create mode 100644 example/bundle/ellipsoid.html create mode 100644 example/bundle/fadingTiles.html create mode 100644 example/bundle/gltf.html create mode 100644 example/bundle/googleMapsAerial.html create mode 100644 example/bundle/googleMapsExample.html create mode 100644 example/bundle/i3dmExample.html create mode 100644 example/bundle/index.html create mode 100644 example/bundle/ionExample.html create mode 100644 example/bundle/ionLunar.html create mode 100644 example/bundle/landformSiteOverlay.html create mode 100644 example/bundle/mars.html create mode 100644 example/bundle/metadata.html create mode 100644 example/bundle/offscreenShadows.html create mode 100644 example/bundle/pntsExample.html create mode 100644 example/bundle/r3f/basic.html create mode 100644 example/bundle/r3f/globe.html create mode 100644 example/bundle/r3f/ion.html create mode 100644 example/bundle/vr.html diff --git a/example/bundle/assets/B3DMLoader-QE4NIaTt.js b/example/bundle/assets/B3DMLoader-QE4NIaTt.js new file mode 100644 index 000000000..857d41914 --- /dev/null +++ b/example/bundle/assets/B3DMLoader-QE4NIaTt.js @@ -0,0 +1 @@ +import{r as B,F as m,B as y}from"./readMagicBytes-Da5ueiou.js";import{L}from"./LoaderBase-CVSPpjX2.js";import{p as w,b8 as x}from"./three.module-CA-qMkP1.js";import{G as U}from"./GLTFLoader-JNhhxs0g.js";class C extends L{parse(s){const t=new DataView(s),T=B(t);console.assert(T==="b3dm");const u=t.getUint32(4,!0);console.assert(u===1);const h=t.getUint32(8,!0);console.assert(h===s.byteLength);const o=t.getUint32(12,!0),a=t.getUint32(16,!0),n=t.getUint32(20,!0),r=t.getUint32(24,!0),b=28,e=s.slice(b,b+o+a),g=new m(e,0,o,a),c=b+o+a,i=s.slice(c,c+n+r),l=new y(i,g.getData("BATCH_LENGTH"),0,n,r),f=c+n+r,d=new Uint8Array(s,f,h-f);return{version:u,featureTable:g,batchTable:l,glbBytes:d}}}class H extends C{constructor(s=x){super(),this.manager=s,this.adjustmentTransform=new w}parse(s){const t=super.parse(s),T=t.glbBytes.slice().buffer;return new Promise((u,h)=>{const o=this.manager,a=this.fetchOptions,n=o.getHandler("path.gltf")||new U(o);a.credentials==="include"&&a.mode==="cors"&&n.setCrossOrigin("use-credentials"),"credentials"in a&&n.setWithCredentials(a.credentials==="include"),a.headers&&n.setRequestHeader(a.headers);let r=this.workingPath;!/[\\/]$/.test(r)&&r.length&&(r+="/");const b=this.adjustmentTransform;n.parse(T,r,e=>{const{batchTable:g,featureTable:c}=t,{scene:i}=e,l=c.getData("RTC_CENTER");l&&(i.position.x+=l[0],i.position.y+=l[1],i.position.z+=l[2]),e.scene.updateMatrix(),e.scene.matrix.multiply(b),e.scene.matrix.decompose(e.scene.position,e.scene.quaternion,e.scene.scale),e.batchTable=g,e.featureTable=c,i.batchTable=g,i.featureTable=c,u(e)},h)})}}export{H as B}; diff --git a/example/bundle/assets/CMPTLoader-C0bkMPP6.js b/example/bundle/assets/CMPTLoader-C0bkMPP6.js new file mode 100644 index 000000000..5579391a5 --- /dev/null +++ b/example/bundle/assets/CMPTLoader-C0bkMPP6.js @@ -0,0 +1 @@ +import{p as g,b8 as w,G as L}from"./three.module-CA-qMkP1.js";import{L as P}from"./LoaderBase-CVSPpjX2.js";import{r as d}from"./readMagicBytes-Da5ueiou.js";import{B as T}from"./B3DMLoader-QE4NIaTt.js";import{P as b}from"./PNTSLoader-CZfdYf2b.js";import{W as y,I as M}from"./I3DMLoader-Bb2sAfDf.js";class k extends P{parse(s){const n=new DataView(s),h=d(n);console.assert(h==="cmpt",'CMPTLoader: The magic bytes equal "cmpt".');const p=n.getUint32(4,!0);console.assert(p===1,'CMPTLoader: The version listed in the header is "1".');const l=n.getUint32(8,!0);console.assert(l===s.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");const c=n.getUint32(12,!0),i=[];let o=16;for(let r=0;r{const o=new L;return i.forEach(r=>{o.add(r.scene)}),{tiles:i,scene:o}})}}export{j as C}; diff --git a/example/bundle/assets/CameraControls-Budxqpvb.js b/example/bundle/assets/CameraControls-Budxqpvb.js new file mode 100644 index 000000000..7b55769c0 --- /dev/null +++ b/example/bundle/assets/CameraControls-Budxqpvb.js @@ -0,0 +1,192 @@ +import{aH as sf,aI as Gr,x as Ri,s as Ka,R as y0,O as w0,a as dw,S as Uo,P as cf,ax as pw,aJ as vw,V as S0,k as Zt,ak as hw,aK as mw,C as gw,W as E0,aL as yw,aM as ww,aN as Sw,aO as Ew,o as _w,aP as kw,g as Yd,aQ as xw,b as Kd,aR as Cw,aF as Pw,aS as _0,_ as gn,Z as sr,aT as ui,v as Fn,a7 as Mw,aB as Jd,aU as Rw,aq as Tw,Q as Oh,p as Nw,aV as zw,aW as Zr,aX as k0,aY as Ja,$ as Iw,a2 as Kf,aZ as Lw,a_ as Ow,a$ as Fw,b0 as Dw,aa as Uw,F as Fa,q as Aw,L as Bw,b1 as Fh,a1 as jw,b2 as Hw,b3 as Ww,ad as Qw,b4 as Vw,b5 as Gw}from"./three.module-CA-qMkP1.js";import{E as Zw}from"./EnvironmentControls-7w_Q0bky.js";import{G as Xw}from"./GlobeControls-B_ZEgOcW.js";import{T as Yw}from"./TilesRenderer-5XUDbyI2.js";function Kw(e,t){for(var n=0;ni[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x0={exports:{}},_s={},C0={exports:{}},Le={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ru=Symbol.for("react.element"),Jw=Symbol.for("react.portal"),$w=Symbol.for("react.fragment"),qw=Symbol.for("react.strict_mode"),bw=Symbol.for("react.profiler"),eS=Symbol.for("react.provider"),tS=Symbol.for("react.context"),nS=Symbol.for("react.forward_ref"),rS=Symbol.for("react.suspense"),lS=Symbol.for("react.memo"),iS=Symbol.for("react.lazy"),Dh=Symbol.iterator;function oS(e){return e===null||typeof e!="object"?null:(e=Dh&&e[Dh]||e["@@iterator"],typeof e=="function"?e:null)}var P0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M0=Object.assign,R0={};function Ai(e,t,n){this.props=e,this.context=t,this.refs=R0,this.updater=n||P0}Ai.prototype.isReactComponent={};Ai.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ai.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function T0(){}T0.prototype=Ai.prototype;function $d(e,t,n){this.props=e,this.context=t,this.refs=R0,this.updater=n||P0}var qd=$d.prototype=new T0;qd.constructor=$d;M0(qd,Ai.prototype);qd.isPureReactComponent=!0;var Uh=Array.isArray,N0=Object.prototype.hasOwnProperty,bd={current:null},z0={key:!0,ref:!0,__self:!0,__source:!0};function I0(e,t,n){var i,o={},a=null,c=null;if(t!=null)for(i in t.ref!==void 0&&(c=t.ref),t.key!==void 0&&(a=""+t.key),t)N0.call(t,i)&&!z0.hasOwnProperty(i)&&(o[i]=t[i]);var d=arguments.length-2;if(d===1)o.children=n;else if(1>>1,ie=U[le];if(0>>1;leo(ft,V))Eeo(dt,ft)?(U[le]=dt,U[Ee]=V,le=Ee):(U[le]=ft,U[Ue]=V,le=Ue);else if(Eeo(dt,V))U[le]=dt,U[Ee]=V,le=Ee;else break e}}return X}function o(U,X){var V=U.sortIndex-X.sortIndex;return V!==0?V:U.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var p=[],y=[],m=1,g=null,w=3,C=!1,P=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(U){for(var X=n(y);X!==null;){if(X.callback===null)i(y);else if(X.startTime<=U)i(y),X.sortIndex=X.expirationTime,t(p,X);else break;X=n(y)}}function z(U){if(R=!1,k(U),!P)if(n(p)!==null)P=!0,ye(O);else{var X=n(y);X!==null&&Ke(z,X.startTime-U)}}function O(U,X){P=!1,R&&(R=!1,S(F),F=-1),C=!0;var V=w;try{for(k(X),g=n(p);g!==null&&(!(g.expirationTime>X)||U&&!K());){var le=g.callback;if(typeof le=="function"){g.callback=null,w=g.priorityLevel;var ie=le(g.expirationTime<=X);X=e.unstable_now(),typeof ie=="function"?g.callback=ie:g===n(p)&&i(p),k(X)}else i(p);g=n(p)}if(g!==null)var we=!0;else{var Ue=n(y);Ue!==null&&Ke(z,Ue.startTime-X),we=!1}return we}finally{g=null,w=V,C=!1}}var A=!1,G=null,F=-1,Z=5,Y=-1;function K(){return!(e.unstable_now()-YU||125le?(U.sortIndex=V,t(y,U),n(p)===null&&U===n(y)&&(R?(S(F),F=-1):R=!0,Ke(z,V-le))):(U.sortIndex=ie,t(p,U),P||C||(P=!0,ye(O))),U},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(U){var X=w;return function(){var V=w;w=X;try{return U.apply(this,arguments)}finally{w=V}}}})(U0);D0.exports=U0;var yS=D0.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var wS=L,Sn=yS;function $(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jf=Object.prototype.hasOwnProperty,SS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Bh={},jh={};function ES(e){return Jf.call(jh,e)?!0:Jf.call(Bh,e)?!1:SS.test(e)?jh[e]=!0:(Bh[e]=!0,!1)}function _S(e,t,n,i){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return i?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function kS(e,t,n,i){if(t===null||typeof t>"u"||_S(e,t,n,i))return!0;if(i)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function tn(e,t,n,i,o,a,c){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=c}var Ft={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ft[e]=new tn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ft[t]=new tn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ft[e]=new tn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ft[e]=new tn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ft[e]=new tn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ft[e]=new tn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ft[e]=new tn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ft[e]=new tn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ft[e]=new tn(e,5,!1,e.toLowerCase(),null,!1,!1)});var tp=/[\-:]([a-z])/g;function np(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(tp,np);Ft[t]=new tn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(tp,np);Ft[t]=new tn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(tp,np);Ft[t]=new tn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ft[e]=new tn(e,1,!1,e.toLowerCase(),null,!1,!1)});Ft.xlinkHref=new tn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ft[e]=new tn(e,1,!1,e.toLowerCase(),null,!0,!0)});function rp(e,t,n,i){var o=Ft.hasOwnProperty(t)?Ft[t]:null;(o!==null?o.type!==0:i||!(2d||o[c]!==a[d]){var p=` +`+o[c].replace(" at new "," at ");return e.displayName&&p.includes("")&&(p=p.replace("",e.displayName)),p}while(1<=c&&0<=d);break}}}finally{pf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ko(e):""}function xS(e){switch(e.tag){case 5:return ko(e.type);case 16:return ko("Lazy");case 13:return ko("Suspense");case 19:return ko("SuspenseList");case 0:case 2:case 15:return e=vf(e.type,!1),e;case 11:return e=vf(e.type.render,!1),e;case 1:return e=vf(e.type,!0),e;default:return""}}function ed(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case si:return"Fragment";case ai:return"Portal";case $f:return"Profiler";case lp:return"StrictMode";case qf:return"Suspense";case bf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j0:return(e.displayName||"Context")+".Consumer";case B0:return(e._context.displayName||"Context")+".Provider";case ip:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case op:return t=e.displayName||null,t!==null?t:ed(e.type)||"Memo";case jr:t=e._payload,e=e._init;try{return ed(e(t))}catch{}}return null}function CS(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ed(t);case 8:return t===lp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ll(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function W0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function PS(e){var t=W0(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(c){i=""+c,a.call(this,c)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(c){i=""+c},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ma(e){e._valueTracker||(e._valueTracker=PS(e))}function Q0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=W0(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function $a(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function td(e,t){var n=t.checked;return ct({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Wh(e,t){var n=t.defaultValue==null?"":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;n=ll(t.value!=null?t.value:n),e._wrapperState={initialChecked:i,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function V0(e,t){t=t.checked,t!=null&&rp(e,"checked",t,!1)}function nd(e,t){V0(e,t);var n=ll(t.value),i=t.type;if(n!=null)i==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?rd(e,t.type,n):t.hasOwnProperty("defaultValue")&&rd(e,t.type,ll(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Qh(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!(i!=="submit"&&i!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function rd(e,t,n){(t!=="number"||$a(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var xo=Array.isArray;function Ei(e,t,n,i){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=ga.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},MS=["Webkit","ms","Moz","O"];Object.keys(Mo).forEach(function(e){MS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mo[t]=Mo[e]})});function Y0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mo.hasOwnProperty(e)&&Mo[e]?(""+t).trim():t+"px"}function K0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var i=n.indexOf("--")===0,o=Y0(n,t[n],i);n==="float"&&(n="cssFloat"),i?e.setProperty(n,o):e[n]=o}}var RS=ct({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function od(e,t){if(t){if(RS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error($(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error($(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error($(61))}if(t.style!=null&&typeof t.style!="object")throw Error($(62))}}function ud(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ad=null;function up(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sd=null,_i=null,ki=null;function Zh(e){if(e=ou(e)){if(typeof sd!="function")throw Error($(280));var t=e.stateNode;t&&(t=Ms(t),sd(e.stateNode,e.type,t))}}function J0(e){_i?ki?ki.push(e):ki=[e]:_i=e}function $0(){if(_i){var e=_i,t=ki;if(ki=_i=null,Zh(e),t)for(e=0;e>>=0,e===0?32:31-(BS(e)/jS|0)|0}var ya=64,wa=4194304;function Co(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ts(e,t){var n=e.pendingLanes;if(n===0)return 0;var i=0,o=e.suspendedLanes,a=e.pingedLanes,c=n&268435455;if(c!==0){var d=c&~o;d!==0?i=Co(d):(a&=c,a!==0&&(i=Co(a)))}else c=n&~o,c!==0?i=Co(c):a!==0&&(i=Co(a));if(i===0)return 0;if(t!==0&&t!==i&&!(t&o)&&(o=i&-i,a=t&-t,o>=a||o===16&&(a&4194240)!==0))return t;if(i&4&&(i|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0n;n++)t.push(e);return t}function lu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=n}function VS(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=To),tm=" ",nm=!1;function gg(e,t){switch(e){case"keyup":return yE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ci=!1;function SE(e,t){switch(e){case"compositionend":return yg(t);case"keypress":return t.which!==32?null:(nm=!0,tm);case"textInput":return e=t.data,e===tm&&nm?null:e;default:return null}}function EE(e,t){if(ci)return e==="compositionend"||!hp&&gg(e,t)?(e=hg(),Ba=dp=Xr=null,ci=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=om(n)}}function _g(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_g(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kg(){for(var e=window,t=$a();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$a(e.document)}return t}function mp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function NE(e){var t=kg(),n=e.focusedElem,i=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_g(n.ownerDocument.documentElement,n)){if(i!==null&&mp(n)){if(t=i.start,e=i.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(i.start,o);i=i.end===void 0?a:Math.min(i.end,o),!e.extend&&a>i&&(o=i,i=a,a=o),o=um(n,a);var c=um(n,i);o&&c&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==c.node||e.focusOffset!==c.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),a>i?(e.addRange(t),e.extend(c.node,c.offset)):(t.setEnd(c.node,c.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,fi=null,hd=null,zo=null,md=!1;function am(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;md||fi==null||fi!==$a(i)||(i=fi,"selectionStart"in i&&mp(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),zo&&Go(zo,i)||(zo=i,i=ls(hd,"onSelect"),0vi||(e.current=_d[vi],_d[vi]=null,vi--)}function qe(e,t){vi++,_d[vi]=e.current,e.current=t}var il={},Xt=ul(il),sn=ul(!1),Il=il;function Ni(e,t){var n=e.type.contextTypes;if(!n)return il;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var o={},a;for(a in n)o[a]=t[a];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function cn(e){return e=e.childContextTypes,e!=null}function os(){tt(sn),tt(Xt)}function hm(e,t,n){if(Xt.current!==il)throw Error($(168));qe(Xt,t),qe(sn,n)}function Ig(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!="function")return n;i=i.getChildContext();for(var o in i)if(!(o in t))throw Error($(108,CS(e)||"Unknown",o));return ct({},n,i)}function us(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||il,Il=Xt.current,qe(Xt,e),qe(sn,sn.current),!0}function mm(e,t,n){var i=e.stateNode;if(!i)throw Error($(169));n?(e=Ig(e,t,Il),i.__reactInternalMemoizedMergedChildContext=e,tt(sn),tt(Xt),qe(Xt,e)):tt(sn),qe(sn,n)}var Sr=null,Rs=!1,Rf=!1;function Lg(e){Sr===null?Sr=[e]:Sr.push(e)}function WE(e){Rs=!0,Lg(e)}function al(){if(!Rf&&Sr!==null){Rf=!0;var e=0,t=Ze;try{var n=Sr;for(Ze=1;e>=c,o-=c,Er=1<<32-Kn(t)+o|n<F?(Z=G,G=null):Z=G.sibling;var Y=w(S,G,k[F],z);if(Y===null){G===null&&(G=Z);break}e&&G&&Y.alternate===null&&t(S,G),E=a(Y,E,F),A===null?O=Y:A.sibling=Y,A=Y,G=Z}if(F===k.length)return n(S,G),it&&xl(S,F),O;if(G===null){for(;FF?(Z=G,G=null):Z=G.sibling;var K=w(S,G,Y.value,z);if(K===null){G===null&&(G=Z);break}e&&G&&K.alternate===null&&t(S,G),E=a(K,E,F),A===null?O=K:A.sibling=K,A=K,G=Z}if(Y.done)return n(S,G),it&&xl(S,F),O;if(G===null){for(;!Y.done;F++,Y=k.next())Y=g(S,Y.value,z),Y!==null&&(E=a(Y,E,F),A===null?O=Y:A.sibling=Y,A=Y);return it&&xl(S,F),O}for(G=i(S,G);!Y.done;F++,Y=k.next())Y=C(G,S,F,Y.value,z),Y!==null&&(e&&Y.alternate!==null&&G.delete(Y.key===null?F:Y.key),E=a(Y,E,F),A===null?O=Y:A.sibling=Y,A=Y);return e&&G.forEach(function(ae){return t(S,ae)}),it&&xl(S,F),O}function T(S,E,k,z){if(typeof k=="object"&&k!==null&&k.type===si&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case ha:e:{for(var O=k.key,A=E;A!==null;){if(A.key===O){if(O=k.type,O===si){if(A.tag===7){n(S,A.sibling),E=o(A,k.props.children),E.return=S,S=E;break e}}else if(A.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===jr&&wm(O)===A.type){n(S,A.sibling),E=o(A,k.props),E.ref=mo(S,A,k),E.return=S,S=E;break e}n(S,A);break}else t(S,A);A=A.sibling}k.type===si?(E=zl(k.props.children,S.mode,z,k.key),E.return=S,S=E):(z=Xa(k.type,k.key,k.props,null,S.mode,z),z.ref=mo(S,E,k),z.return=S,S=z)}return c(S);case ai:e:{for(A=k.key;E!==null;){if(E.key===A)if(E.tag===4&&E.stateNode.containerInfo===k.containerInfo&&E.stateNode.implementation===k.implementation){n(S,E.sibling),E=o(E,k.children||[]),E.return=S,S=E;break e}else{n(S,E);break}else t(S,E);E=E.sibling}E=Df(k,S.mode,z),E.return=S,S=E}return c(S);case jr:return A=k._init,T(S,E,A(k._payload),z)}if(xo(k))return P(S,E,k,z);if(co(k))return R(S,E,k,z);Pa(S,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,E!==null&&E.tag===6?(n(S,E.sibling),E=o(E,k),E.return=S,S=E):(n(S,E),E=Ff(k,S.mode,z),E.return=S,S=E),c(S)):n(S,E)}return T}var Ii=Ug(!0),Ag=Ug(!1),cs=ul(null),fs=null,gi=null,Sp=null;function Ep(){Sp=gi=fs=null}function _p(e){var t=cs.current;tt(cs),e._currentValue=t}function Cd(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function Ci(e,t){fs=e,Sp=gi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(an=!0),e.firstContext=null)}function An(e){var t=e._currentValue;if(Sp!==e)if(e={context:e,memoizedValue:t,next:null},gi===null){if(fs===null)throw Error($(308));gi=e,fs.dependencies={lanes:0,firstContext:e}}else gi=gi.next=e;return t}var Ml=null;function kp(e){Ml===null?Ml=[e]:Ml.push(e)}function Bg(e,t,n,i){var o=t.interleaved;return o===null?(n.next=n,kp(t)):(n.next=o.next,o.next=n),t.interleaved=n,Pr(e,i)}function Pr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Hr=!1;function xp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function kr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function el(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,Ae&2){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,Pr(e,n)}return o=i.interleaved,o===null?(t.next=t,kp(i)):(t.next=o.next,o.next=t),i.interleaved=t,Pr(e,n)}function Ha(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,sp(e,n)}}function Sm(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var o=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var c={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?o=a=c:a=a.next=c,n=n.next}while(n!==null);a===null?o=a=t:a=a.next=t}else o=a=t;n={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:i.shared,effects:i.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ds(e,t,n,i){var o=e.updateQueue;Hr=!1;var a=o.firstBaseUpdate,c=o.lastBaseUpdate,d=o.shared.pending;if(d!==null){o.shared.pending=null;var p=d,y=p.next;p.next=null,c===null?a=y:c.next=y,c=p;var m=e.alternate;m!==null&&(m=m.updateQueue,d=m.lastBaseUpdate,d!==c&&(d===null?m.firstBaseUpdate=y:d.next=y,m.lastBaseUpdate=p))}if(a!==null){var g=o.baseState;c=0,m=y=p=null,d=a;do{var w=d.lane,C=d.eventTime;if((i&w)===w){m!==null&&(m=m.next={eventTime:C,lane:0,tag:d.tag,payload:d.payload,callback:d.callback,next:null});e:{var P=e,R=d;switch(w=t,C=n,R.tag){case 1:if(P=R.payload,typeof P=="function"){g=P.call(C,g,w);break e}g=P;break e;case 3:P.flags=P.flags&-65537|128;case 0:if(P=R.payload,w=typeof P=="function"?P.call(C,g,w):P,w==null)break e;g=ct({},g,w);break e;case 2:Hr=!0}}d.callback!==null&&d.lane!==0&&(e.flags|=64,w=o.effects,w===null?o.effects=[d]:w.push(d))}else C={eventTime:C,lane:w,tag:d.tag,payload:d.payload,callback:d.callback,next:null},m===null?(y=m=C,p=g):m=m.next=C,c|=w;if(d=d.next,d===null){if(d=o.shared.pending,d===null)break;w=d,d=w.next,w.next=null,o.lastBaseUpdate=w,o.shared.pending=null}}while(!0);if(m===null&&(p=g),o.baseState=p,o.firstBaseUpdate=y,o.lastBaseUpdate=m,t=o.shared.interleaved,t!==null){o=t;do c|=o.lane,o=o.next;while(o!==t)}else a===null&&(o.shared.lanes=0);Fl|=c,e.lanes=c,e.memoizedState=g}}function Em(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var i=Nf.transition;Nf.transition={};try{e(!1),t()}finally{Ze=n,Nf.transition=i}}function r1(){return Bn().memoizedState}function ZE(e,t,n){var i=nl(e);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},l1(e))i1(t,n);else if(n=Bg(e,t,n,i),n!==null){var o=bt();Jn(n,e,i,o),o1(n,t,i)}}function XE(e,t,n){var i=nl(e),o={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(l1(e))i1(t,o);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var c=t.lastRenderedState,d=a(c,n);if(o.hasEagerState=!0,o.eagerState=d,$n(d,c)){var p=t.interleaved;p===null?(o.next=o,kp(t)):(o.next=p.next,p.next=o),t.interleaved=o;return}}catch{}finally{}n=Bg(e,t,o,i),n!==null&&(o=bt(),Jn(n,e,i,o),o1(n,t,i))}}function l1(e){var t=e.alternate;return e===st||t!==null&&t===st}function i1(e,t){Io=vs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function o1(e,t,n){if(n&4194240){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,sp(e,n)}}var hs={readContext:An,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useInsertionEffect:Qt,useLayoutEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useMutableSource:Qt,useSyncExternalStore:Qt,useId:Qt,unstable_isNewReconciler:!1},YE={readContext:An,useCallback:function(e,t){return ur().memoizedState=[e,t===void 0?null:t],e},useContext:An,useEffect:km,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Qa(4194308,4,qg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Qa(4,2,e,t)},useMemo:function(e,t){var n=ur();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var i=ur();return t=n!==void 0?n(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=ZE.bind(null,st,e),[i.memoizedState,e]},useRef:function(e){var t=ur();return e={current:e},t.memoizedState=e},useState:_m,useDebugValue:Ip,useDeferredValue:function(e){return ur().memoizedState=e},useTransition:function(){var e=_m(!1),t=e[0];return e=GE.bind(null,e[1]),ur().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=st,o=ur();if(it){if(n===void 0)throw Error($(407));n=n()}else{if(n=t(),Nt===null)throw Error($(349));Ol&30||Vg(i,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,km(Zg.bind(null,i,a,e),[e]),i.flags|=2048,bo(9,Gg.bind(null,i,a,n,t),void 0,null),n},useId:function(){var e=ur(),t=Nt.identifierPrefix;if(it){var n=_r,i=Er;n=(i&~(1<<32-Kn(i)-1)).toString(32)+n,t=":"+t+"R"+n,n=$o++,0<\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n==="select"&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ar]=t,e[Yo]=i,m1(e,t,!1,!1),t.stateNode=e;e:{switch(c=ud(n,i),n){case"dialog":be("cancel",e),be("close",e),o=i;break;case"iframe":case"object":case"embed":be("load",e),o=i;break;case"video":case"audio":for(o=0;oFi&&(t.flags|=128,i=!0,go(a,!1),t.lanes=4194304)}else{if(!i)if(e=ps(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),go(a,!0),a.tail===null&&a.tailMode==="hidden"&&!c.alternate&&!it)return Vt(t),null}else 2*mt()-a.renderingStartTime>Fi&&n!==1073741824&&(t.flags|=128,i=!0,go(a,!1),t.lanes=4194304);a.isBackwards?(c.sibling=t.child,t.child=c):(n=a.last,n!==null?n.sibling=c:t.child=c,a.last=c)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=mt(),t.sibling=null,n=at.current,qe(at,i?n&1|2:n&1),t):(Vt(t),null);case 22:case 23:return Ap(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?mn&1073741824&&(Vt(t),t.subtreeFlags&6&&(t.flags|=8192)):Vt(t),null;case 24:return null;case 25:return null}throw Error($(156,t.tag))}function n_(e,t){switch(yp(t),t.tag){case 1:return cn(t.type)&&os(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Li(),tt(sn),tt(Xt),Mp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pp(t),null;case 13:if(tt(at),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error($(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return tt(at),null;case 4:return Li(),null;case 10:return _p(t.type._context),null;case 22:case 23:return Ap(),null;case 24:return null;default:return null}}var Ra=!1,Gt=!1,r_=typeof WeakSet=="function"?WeakSet:Set,ce=null;function yi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(i){vt(e,t,i)}else n.current=null}function Od(e,t,n){try{n()}catch(i){vt(e,t,i)}}var Om=!1;function l_(e,t){if(gd=ns,e=kg(),mp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var o=i.anchorOffset,a=i.focusNode;i=i.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var c=0,d=-1,p=-1,y=0,m=0,g=e,w=null;t:for(;;){for(var C;g!==n||o!==0&&g.nodeType!==3||(d=c+o),g!==a||i!==0&&g.nodeType!==3||(p=c+i),g.nodeType===3&&(c+=g.nodeValue.length),(C=g.firstChild)!==null;)w=g,g=C;for(;;){if(g===e)break t;if(w===n&&++y===o&&(d=c),w===a&&++m===i&&(p=c),(C=g.nextSibling)!==null)break;g=w,w=g.parentNode}g=C}n=d===-1||p===-1?null:{start:d,end:p}}else n=null}n=n||{start:0,end:0}}else n=null;for(yd={focusedElem:e,selectionRange:n},ns=!1,ce=t;ce!==null;)if(t=ce,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ce=e;else for(;ce!==null;){t=ce;try{var P=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(P!==null){var R=P.memoizedProps,T=P.memoizedState,S=t.stateNode,E=S.getSnapshotBeforeUpdate(t.elementType===t.type?R:Zn(t.type,R),T);S.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($(163))}}catch(z){vt(t,t.return,z)}if(e=t.sibling,e!==null){e.return=t.return,ce=e;break}ce=t.return}return P=Om,Om=!1,P}function Lo(e,t,n){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var o=i=i.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,a!==void 0&&Od(t,n,a)}o=o.next}while(o!==i)}}function zs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var i=n.create;n.destroy=i()}n=n.next}while(n!==t)}}function Fd(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function w1(e){var t=e.alternate;t!==null&&(e.alternate=null,w1(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ar],delete t[Yo],delete t[Ed],delete t[jE],delete t[HE])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function S1(e){return e.tag===5||e.tag===3||e.tag===4}function Fm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||S1(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dd(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=is));else if(i!==4&&(e=e.child,e!==null))for(Dd(e,t,n),e=e.sibling;e!==null;)Dd(e,t,n),e=e.sibling}function Ud(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(Ud(e,t,n),e=e.sibling;e!==null;)Ud(e,t,n),e=e.sibling}var Lt=null,Xn=!1;function Ar(e,t,n){for(n=n.child;n!==null;)E1(e,t,n),n=n.sibling}function E1(e,t,n){if(cr&&typeof cr.onCommitFiberUnmount=="function")try{cr.onCommitFiberUnmount(ks,n)}catch{}switch(n.tag){case 5:Gt||yi(n,t);case 6:var i=Lt,o=Xn;Lt=null,Ar(e,t,n),Lt=i,Xn=o,Lt!==null&&(Xn?(e=Lt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Lt.removeChild(n.stateNode));break;case 18:Lt!==null&&(Xn?(e=Lt,n=n.stateNode,e.nodeType===8?Mf(e.parentNode,n):e.nodeType===1&&Mf(e,n),Qo(e)):Mf(Lt,n.stateNode));break;case 4:i=Lt,o=Xn,Lt=n.stateNode.containerInfo,Xn=!0,Ar(e,t,n),Lt=i,Xn=o;break;case 0:case 11:case 14:case 15:if(!Gt&&(i=n.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){o=i=i.next;do{var a=o,c=a.destroy;a=a.tag,c!==void 0&&(a&2||a&4)&&Od(n,t,c),o=o.next}while(o!==i)}Ar(e,t,n);break;case 1:if(!Gt&&(yi(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(d){vt(n,t,d)}Ar(e,t,n);break;case 21:Ar(e,t,n);break;case 22:n.mode&1?(Gt=(i=Gt)||n.memoizedState!==null,Ar(e,t,n),Gt=i):Ar(e,t,n);break;default:Ar(e,t,n)}}function Dm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new r_),t.forEach(function(i){var o=p_.bind(null,e,i);n.has(i)||(n.add(i),i.then(o,o))})}}function Vn(e,t){var n=t.deletions;if(n!==null)for(var i=0;io&&(o=c),i&=~a}if(i=o,i=mt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*o_(i/1960))-i,10e?16:e,Yr===null)var i=!1;else{if(e=Yr,Yr=null,ys=0,Ae&6)throw Error($(331));var o=Ae;for(Ae|=4,ce=e.current;ce!==null;){var a=ce,c=a.child;if(ce.flags&16){var d=a.deletions;if(d!==null){for(var p=0;pmt()-Dp?Nl(e,0):Fp|=n),fn(e,t)}function T1(e,t){t===0&&(e.mode&1?(t=wa,wa<<=1,!(wa&130023424)&&(wa=4194304)):t=1);var n=bt();e=Pr(e,t),e!==null&&(lu(e,t,n),fn(e,n))}function d_(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),T1(e,n)}function p_(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:i=e.stateNode;break;default:throw Error($(314))}i!==null&&i.delete(t),T1(e,n)}var N1;N1=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||sn.current)an=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return an=!1,e_(e,t,n);an=!!(e.flags&131072)}else an=!1,it&&t.flags&1048576&&Og(t,ss,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Va(e,t),e=t.pendingProps;var o=Ni(t,Xt.current);Ci(t,n),o=Tp(null,t,i,e,o,n);var a=Np();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,cn(i)?(a=!0,us(t)):a=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,xp(t),o.updater=Ns,t.stateNode=o,o._reactInternals=t,Md(t,i,e,n),t=Nd(null,t,i,!0,a,n)):(t.tag=0,it&&a&&gp(t),qt(null,t,o,n),t=t.child),t;case 16:i=t.elementType;e:{switch(Va(e,t),e=t.pendingProps,o=i._init,i=o(i._payload),t.type=i,o=t.tag=h_(i),e=Zn(i,e),o){case 0:t=Td(null,t,i,e,n);break e;case 1:t=zm(null,t,i,e,n);break e;case 11:t=Tm(null,t,i,e,n);break e;case 14:t=Nm(null,t,i,Zn(i.type,e),n);break e}throw Error($(306,i,""))}return t;case 0:return i=t.type,o=t.pendingProps,o=t.elementType===i?o:Zn(i,o),Td(e,t,i,o,n);case 1:return i=t.type,o=t.pendingProps,o=t.elementType===i?o:Zn(i,o),zm(e,t,i,o,n);case 3:e:{if(p1(t),e===null)throw Error($(387));i=t.pendingProps,a=t.memoizedState,o=a.element,jg(e,t),ds(t,i,null,n);var c=t.memoizedState;if(i=c.element,a.isDehydrated)if(a={element:i,isDehydrated:!1,cache:c.cache,pendingSuspenseBoundaries:c.pendingSuspenseBoundaries,transitions:c.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){o=Oi(Error($(423)),t),t=Im(e,t,i,n,o);break e}else if(i!==o){o=Oi(Error($(424)),t),t=Im(e,t,i,n,o);break e}else for(yn=br(t.stateNode.containerInfo.firstChild),wn=t,it=!0,Yn=null,n=Ag(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(zi(),i===o){t=Mr(e,t,n);break e}qt(e,t,i,n)}t=t.child}return t;case 5:return Hg(t),e===null&&xd(t),i=t.type,o=t.pendingProps,a=e!==null?e.memoizedProps:null,c=o.children,wd(i,o)?c=null:a!==null&&wd(i,a)&&(t.flags|=32),d1(e,t),qt(e,t,c,n),t.child;case 6:return e===null&&xd(t),null;case 13:return v1(e,t,n);case 4:return Cp(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ii(t,null,i,n):qt(e,t,i,n),t.child;case 11:return i=t.type,o=t.pendingProps,o=t.elementType===i?o:Zn(i,o),Tm(e,t,i,o,n);case 7:return qt(e,t,t.pendingProps,n),t.child;case 8:return qt(e,t,t.pendingProps.children,n),t.child;case 12:return qt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(i=t.type._context,o=t.pendingProps,a=t.memoizedProps,c=o.value,qe(cs,i._currentValue),i._currentValue=c,a!==null)if($n(a.value,c)){if(a.children===o.children&&!sn.current){t=Mr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var d=a.dependencies;if(d!==null){c=a.child;for(var p=d.firstContext;p!==null;){if(p.context===i){if(a.tag===1){p=kr(-1,n&-n),p.tag=2;var y=a.updateQueue;if(y!==null){y=y.shared;var m=y.pending;m===null?p.next=p:(p.next=m.next,m.next=p),y.pending=p}}a.lanes|=n,p=a.alternate,p!==null&&(p.lanes|=n),Cd(a.return,n,t),d.lanes|=n;break}p=p.next}}else if(a.tag===10)c=a.type===t.type?null:a.child;else if(a.tag===18){if(c=a.return,c===null)throw Error($(341));c.lanes|=n,d=c.alternate,d!==null&&(d.lanes|=n),Cd(c,n,t),c=a.sibling}else c=a.child;if(c!==null)c.return=a;else for(c=a;c!==null;){if(c===t){c=null;break}if(a=c.sibling,a!==null){a.return=c.return,c=a;break}c=c.return}a=c}qt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,i=t.pendingProps.children,Ci(t,n),o=An(o),i=i(o),t.flags|=1,qt(e,t,i,n),t.child;case 14:return i=t.type,o=Zn(i,t.pendingProps),o=Zn(i.type,o),Nm(e,t,i,o,n);case 15:return c1(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,o=t.pendingProps,o=t.elementType===i?o:Zn(i,o),Va(e,t),t.tag=1,cn(i)?(e=!0,us(t)):e=!1,Ci(t,n),u1(t,i,o),Md(t,i,o,n),Nd(null,t,i,!0,e,n);case 19:return h1(e,t,n);case 22:return f1(e,t,n)}throw Error($(156,t.tag))};function z1(e,t){return lg(e,t)}function v_(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(e,t,n,i){return new v_(e,t,n,i)}function jp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function h_(e){if(typeof e=="function")return jp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ip)return 11;if(e===op)return 14}return 2}function rl(e,t){var n=e.alternate;return n===null?(n=Dn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xa(e,t,n,i,o,a){var c=2;if(i=e,typeof e=="function")jp(e)&&(c=1);else if(typeof e=="string")c=5;else e:switch(e){case si:return zl(n.children,o,a,t);case lp:c=8,o|=8;break;case $f:return e=Dn(12,n,t,o|2),e.elementType=$f,e.lanes=a,e;case qf:return e=Dn(13,n,t,o),e.elementType=qf,e.lanes=a,e;case bf:return e=Dn(19,n,t,o),e.elementType=bf,e.lanes=a,e;case H0:return Ls(n,o,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B0:c=10;break e;case j0:c=9;break e;case ip:c=11;break e;case op:c=14;break e;case jr:c=16,i=null;break e}throw Error($(130,e==null?e:typeof e,""))}return t=Dn(c,n,t,o),t.elementType=e,t.type=i,t.lanes=a,t}function zl(e,t,n,i){return e=Dn(7,e,i,t),e.lanes=n,e}function Ls(e,t,n,i){return e=Dn(22,e,i,t),e.elementType=H0,e.lanes=n,e.stateNode={isHidden:!1},e}function Ff(e,t,n){return e=Dn(6,e,null,t),e.lanes=n,e}function Df(e,t,n){return t=Dn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function m_(e,t,n,i,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mf(0),this.expirationTimes=mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mf(0),this.identifierPrefix=i,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Hp(e,t,n,i,o,a,c,d,p){return e=new m_(e,t,n,d,p),t===1?(t=1,a===!0&&(t|=8)):t=0,a=Dn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xp(a),e}function g_(e,t,n){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(F1)}catch(e){console.error(e)}}F1(),F0.exports=En;var D1=F0.exports;const d3=Es(D1);var __,Vm=D1;__=Vm.createRoot,Vm.hydrateRoot;var U1={exports:{}},Bl={};/** + * @license React + * react-reconciler-constants.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */Bl.ConcurrentRoot=1;Bl.ContinuousEventPriority=4;Bl.DefaultEventPriority=16;Bl.DiscreteEventPriority=1;Bl.IdleEventPriority=536870912;Bl.LegacyRoot=0;U1.exports=Bl;var Si=U1.exports;function k_(e){let t;const n=new Set,i=(y,m)=>{const g=typeof y=="function"?y(t):y;if(g!==t){const w=t;t=m?g:Object.assign({},t,g),n.forEach(C=>C(t,w))}},o=()=>t,a=(y,m=o,g=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let w=m(t);function C(){const P=m(t);if(!g(w,P)){const R=w;y(w=P,R)}}return n.add(C),()=>n.delete(C)},p={setState:i,getState:o,subscribe:(y,m,g)=>m||g?a(y,m,g):(n.add(y),()=>n.delete(y)),destroy:()=>n.clear()};return t=e(i,o,p),p}const x_=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Gm=x_?L.useEffect:L.useLayoutEffect;function A1(e){const t=typeof e=="function"?k_(e):e,n=(i=t.getState,o=Object.is)=>{const[,a]=L.useReducer(T=>T+1,0),c=t.getState(),d=L.useRef(c),p=L.useRef(i),y=L.useRef(o),m=L.useRef(!1),g=L.useRef();g.current===void 0&&(g.current=i(c));let w,C=!1;(d.current!==c||p.current!==i||y.current!==o||m.current)&&(w=i(c),C=!o(g.current,w)),Gm(()=>{C&&(g.current=w),d.current=c,p.current=i,y.current=o,m.current=!1});const P=L.useRef(c);Gm(()=>{const T=()=>{try{const E=t.getState(),k=p.current(E);y.current(g.current,k)||(d.current=E,g.current=k,a())}catch{m.current=!0,a()}},S=t.subscribe(T);return t.getState()!==P.current&&T(),S},[]);const R=C?w:g.current;return L.useDebugValue(R),R};return Object.assign(n,t),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[n,t];return{next(){const o=i.length<=0;return{value:i.shift(),done:o}}}},n}const C_=e=>typeof e=="object"&&typeof e.then=="function",Tl=[];function B1(e,t,n=(i,o)=>i===o){if(e===t)return!0;if(!e||!t)return!1;const i=e.length;if(t.length!==i)return!1;for(let o=0;o0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,i.lifespan)),a.response;if(!n)throw a.promise}const o={keys:t,equal:i.equal,remove:()=>{const a=Tl.indexOf(o);a!==-1&&Tl.splice(a,1)},promise:(C_(e)?e:e(...t)).then(a=>{o.response=a,i.lifespan&&i.lifespan>0&&(o.timeout=setTimeout(o.remove,i.lifespan))}).catch(a=>o.error=a)};if(Tl.push(o),!n)throw o.promise}const P_=(e,t,n)=>j1(e,t,!1,n),M_=(e,t,n)=>void j1(e,t,!0,n),R_=e=>{if(e===void 0||e.length===0)Tl.splice(0,Tl.length);else{const t=Tl.find(n=>B1(e,n.keys,n.equal));t&&t.remove()}};var H1={exports:{}},W1={exports:{}},Q1={};/** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */(function(e){function t(U,X){var V=U.length;U.push(X);e:for(;0>>1,ie=U[le];if(0>>1;leo(ft,V))Eeo(dt,ft)?(U[le]=dt,U[Ee]=V,le=Ee):(U[le]=ft,U[Ue]=V,le=Ue);else if(Eeo(dt,V))U[le]=dt,U[Ee]=V,le=Ee;else break e}}return X}function o(U,X){var V=U.sortIndex-X.sortIndex;return V!==0?V:U.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var p=[],y=[],m=1,g=null,w=3,C=!1,P=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(U){for(var X=n(y);X!==null;){if(X.callback===null)i(y);else if(X.startTime<=U)i(y),X.sortIndex=X.expirationTime,t(p,X);else break;X=n(y)}}function z(U){if(R=!1,k(U),!P)if(n(p)!==null)P=!0,ye(O);else{var X=n(y);X!==null&&Ke(z,X.startTime-U)}}function O(U,X){P=!1,R&&(R=!1,S(F),F=-1),C=!0;var V=w;try{for(k(X),g=n(p);g!==null&&(!(g.expirationTime>X)||U&&!K());){var le=g.callback;if(typeof le=="function"){g.callback=null,w=g.priorityLevel;var ie=le(g.expirationTime<=X);X=e.unstable_now(),typeof ie=="function"?g.callback=ie:g===n(p)&&i(p),k(X)}else i(p);g=n(p)}if(g!==null)var we=!0;else{var Ue=n(y);Ue!==null&&Ke(z,Ue.startTime-X),we=!1}return we}finally{g=null,w=V,C=!1}}var A=!1,G=null,F=-1,Z=5,Y=-1;function K(){return!(e.unstable_now()-YU||125le?(U.sortIndex=V,t(y,U),n(p)===null&&U===n(y)&&(R?(S(F),F=-1):R=!0,Ke(z,V-le))):(U.sortIndex=ie,t(p,U),P||C||(P=!0,ye(O))),U},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(U){var X=w;return function(){var V=w;w=X;try{return U.apply(this,arguments)}finally{w=V}}}})(Q1);W1.exports=Q1;var Wd=W1.exports;/** + * @license React + * react-reconciler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var T_=function(t){var n={},i=L,o=Wd,a=Object.assign;function c(r){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;uN||f[x]!==v[N]){var Q=` +`+f[x].replace(" at new "," at ");return r.displayName&&Q.includes("")&&(Q=Q.replace("",r.displayName)),Q}while(1<=x&&0<=N);break}}}finally{pe=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?Ve(r):""}var ke=Object.prototype.hasOwnProperty,Pe=[],De=-1;function Oe(r){return{current:r}}function _e(r){0>De||(r.current=Pe[De],Pe[De]=null,De--)}function Me(r,l){De++,Pe[De]=r.current,r.current=l}var Fe={},Xe=Oe(Fe),Re=Oe(!1),Je=Fe;function At(r,l){var u=r.type.contextTypes;if(!u)return Fe;var s=r.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===l)return s.__reactInternalMemoizedMaskedChildContext;var f={},v;for(v in u)f[v]=l[v];return s&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=l,r.__reactInternalMemoizedMaskedChildContext=f),f}function gt(r){return r=r.childContextTypes,r!=null}function zt(){_e(Re),_e(Xe)}function Qe(r,l,u){if(Xe.current!==Fe)throw Error(c(168));Me(Xe,l),Me(Re,u)}function Et(r,l,u){var s=r.stateNode;if(l=l.childContextTypes,typeof s.getChildContext!="function")return u;s=s.getChildContext();for(var f in s)if(!(f in l))throw Error(c(108,F(r)||"Unknown",f));return a({},u,s)}function Ge(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Fe,Je=Xe.current,Me(Xe,r),Me(Re,Re.current),!0}function Be(r,l,u){var s=r.stateNode;if(!s)throw Error(c(169));u?(r=Et(r,l,Je),s.__reactInternalMemoizedMergedChildContext=r,_e(Re),_e(Xe),Me(Xe,r)):_e(Re),Me(Re,u)}var nt=Math.clz32?Math.clz32:qn,dr=Math.log,Kt=Math.LN2;function qn(r){return r>>>=0,r===0?32:31-(dr(r)/Kt|0)|0}var _u=64,ku=4194304;function Gi(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function xu(r,l){var u=r.pendingLanes;if(u===0)return 0;var s=0,f=r.suspendedLanes,v=r.pingedLanes,x=u&268435455;if(x!==0){var N=x&~f;N!==0?s=Gi(N):(v&=x,v!==0&&(s=Gi(v)))}else x=u&~f,x!==0?s=Gi(x):v!==0&&(s=Gi(v));if(s===0)return 0;if(l!==0&&l!==s&&!(l&f)&&(f=s&-s,v=l&-l,f>=v||f===16&&(v&4194240)!==0))return l;if(s&4&&(s|=u&16),l=r.entangledLanes,l!==0)for(r=r.entanglements,l&=s;0u;u++)l.push(r);return l}function Zi(r,l,u){r.pendingLanes|=l,l!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,l=31-nt(l),r[l]=u}function Py(r,l){var u=r.pendingLanes&~l;r.pendingLanes=l,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=l,r.mutableReadLanes&=l,r.entangledLanes&=l,l=r.entanglements;var s=r.eventTimes;for(r=r.expirationTimes;0>=x,f-=x,hr=1<<32-nt(l)+f|u<He?(Rt=Ce,Ce=null):Rt=Ce.sibling;var We=Se(D,Ce,j[He],ue);if(We===null){Ce===null&&(Ce=Rt);break}r&&Ce&&We.alternate===null&&l(D,Ce),I=v(We,I,He),Te===null?ve=We:Te.sibling=We,Te=We,Ce=Rt}if(He===j.length)return u(D,Ce),rt&&ml(D,He),ve;if(Ce===null){for(;HeHe?(Rt=Ce,Ce=null):Rt=Ce.sibling;var Ur=Se(D,Ce,We.value,ue);if(Ur===null){Ce===null&&(Ce=Rt);break}r&&Ce&&Ur.alternate===null&&l(D,Ce),I=v(Ur,I,He),Te===null?ve=Ur:Te.sibling=Ur,Te=Ur,Ce=Rt}if(We.done)return u(D,Ce),rt&&ml(D,He),ve;if(Ce===null){for(;!We.done;He++,We=j.next())We=xe(D,We.value,ue),We!==null&&(I=v(We,I,He),Te===null?ve=We:Te.sibling=We,Te=We);return rt&&ml(D,He),ve}for(Ce=s(D,Ce);!We.done;He++,We=j.next())We=Ye(Ce,D,He,We.value,ue),We!==null&&(r&&We.alternate!==null&&Ce.delete(We.key===null?He:We.key),I=v(We,I,He),Te===null?ve=We:Te.sibling=We,Te=We);return r&&Ce.forEach(function(fw){return l(D,fw)}),rt&&ml(D,He),ve}function Nn(D,I,j,ue){if(typeof j=="object"&&j!==null&&j.type===m&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case p:e:{for(var ve=j.key,Te=I;Te!==null;){if(Te.key===ve){if(ve=j.type,ve===m){if(Te.tag===7){u(D,Te.sibling),I=f(Te,j.props.children),I.return=D,D=I;break e}}else if(Te.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===k&&yv(ve)===Te.type){u(D,Te.sibling),I=f(Te,j.props),I.ref=Ki(D,Te,j),I.return=D,D=I;break e}u(D,Te);break}else l(D,Te);Te=Te.sibling}j.type===m?(I=kl(j.props.children,D.mode,ue,j.key),I.return=D,D=I):(ue=da(j.type,j.key,j.props,null,D.mode,ue),ue.ref=Ki(D,I,j),ue.return=D,D=ue)}return x(D);case y:e:{for(Te=j.key;I!==null;){if(I.key===Te)if(I.tag===4&&I.stateNode.containerInfo===j.containerInfo&&I.stateNode.implementation===j.implementation){u(D,I.sibling),I=f(I,j.children||[]),I.return=D,D=I;break e}else{u(D,I);break}else l(D,I);I=I.sibling}I=uf(j,D.mode,ue),I.return=D,D=I}return x(D);case k:return Te=j._init,Nn(D,I,Te(j._payload),ue)}if(ze(j))return ge(D,I,j,ue);if(A(j))return Wt(D,I,j,ue);Fu(D,j)}return typeof j=="string"&&j!==""||typeof j=="number"?(j=""+j,I!==null&&I.tag===6?(u(D,I.sibling),I=f(I,j),I.return=D,D=I):(u(D,I),I=of(j,D.mode,ue),I.return=D,D=I),x(D)):u(D,I)}return Nn}var Yl=wv(!0),Sv=wv(!1),Ji={},Pn=Oe(Ji),$i=Oe(Ji),Kl=Oe(Ji);function rr(r){if(r===Ji)throw Error(c(174));return r}function kc(r,l){Me(Kl,l),Me($i,r),Me(Pn,Ji),r=Ke(l),_e(Pn),Me(Pn,r)}function Jl(){_e(Pn),_e($i),_e(Kl)}function Ev(r){var l=rr(Kl.current),u=rr(Pn.current);l=U(u,r.type,l),u!==l&&(Me($i,r),Me(Pn,l))}function xc(r){$i.current===r&&(_e(Pn),_e($i))}var ut=Oe(0);function Du(r){for(var l=r;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||pl(u)||Vi(u)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Cc=[];function Pc(){for(var r=0;ru?u:4,r(!0);var s=Mn.transition;Mn.transition={};try{r(!1),l()}finally{je=u,Mn.transition=s}}function Fv(){return lr().memoizedState}function Ay(r,l,u){var s=Or(r);u={lane:s,action:u,hasEagerState:!1,eagerState:null,next:null},Dv(r)?Uv(l,u):(Av(r,l,u),u=$t(),r=Rn(r,s,u),r!==null&&Bv(r,l,s))}function By(r,l,u){var s=Or(r),f={lane:s,action:u,hasEagerState:!1,eagerState:null,next:null};if(Dv(r))Uv(l,f);else{Av(r,l,f);var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=l.lastRenderedReducer,v!==null))try{var x=l.lastRenderedState,N=v(x,u);if(f.hasEagerState=!0,f.eagerState=N,er(N,x))return}catch{}finally{}u=$t(),r=Rn(r,s,u),r!==null&&Bv(r,l,s)}}function Dv(r){var l=r.alternate;return r===pt||l!==null&&l===pt}function Uv(r,l){qi=Au=!0;var u=r.pending;u===null?l.next=l:(l.next=u.next,u.next=l),r.pending=l}function Av(r,l,u){yt!==null&&r.mode&1&&!(Ne&2)?(r=l.interleaved,r===null?(u.next=u,nr===null?nr=[l]:nr.push(l)):(u.next=r.next,r.next=u),l.interleaved=u):(r=l.pending,r===null?u.next=u:(u.next=r.next,r.next=u),l.pending=u)}function Bv(r,l,u){if(u&4194240){var s=l.lanes;s&=r.pendingLanes,u|=s,l.lanes=u,oc(r,u)}}var Qu={readContext:kn,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useInsertionEffect:jt,useLayoutEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useMutableSource:jt,useSyncExternalStore:jt,useId:jt,unstable_isNewReconciler:!1},jy={readContext:kn,useCallback:function(r,l){return gr().memoizedState=[r,l===void 0?null:l],r},useContext:kn,useEffect:zc,useImperativeHandle:function(r,l,u){return u=u!=null?u.concat([r]):null,Hu(4194308,4,zv.bind(null,l,r),u)},useLayoutEffect:function(r,l){return Hu(4194308,4,r,l)},useInsertionEffect:function(r,l){return Hu(4,2,r,l)},useMemo:function(r,l){var u=gr();return l=l===void 0?null:l,r=r(),u.memoizedState=[r,l],r},useReducer:function(r,l,u){var s=gr();return l=u!==void 0?u(l):l,s.memoizedState=s.baseState=l,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:l},s.queue=r,r=r.dispatch=Ay.bind(null,pt,r),[s.memoizedState,r]},useRef:function(r){var l=gr();return r={current:r},l.memoizedState=r},useState:Nc,useDebugValue:Ic,useDeferredValue:function(r){var l=Nc(r),u=l[0],s=l[1];return zc(function(){var f=Mn.transition;Mn.transition={};try{s(r)}finally{Mn.transition=f}},[r]),u},useTransition:function(){var r=Nc(!1),l=r[0];return r=Uy.bind(null,r[1]),gr().memoizedState=r,[l,r]},useMutableSource:function(){},useSyncExternalStore:function(r,l,u){var s=pt,f=gr();if(rt){if(u===void 0)throw Error(c(407));u=u()}else{if(u=l(),yt===null)throw Error(c(349));$l&30||xv(s,l,u)}f.memoizedState=u;var v={value:u,getSnapshot:l};return f.queue=v,zc(Pv.bind(null,s,v,r),[r]),s.flags|=2048,eo(9,Cv.bind(null,s,v,u,l),void 0,null),u},useId:function(){var r=gr(),l=yt.identifierPrefix;if(rt){var u=mr,s=hr;u=(s&~(1<<32-nt(s)-1)).toString(32)+u,l=":"+l+"R"+u,u=bi++,0$c&&(l.flags|=128,s=!0,lo(f,!1),l.lanes=4194304)}else{if(!s)if(r=Du(v),r!==null){if(l.flags|=128,s=!0,r=r.updateQueue,r!==null&&(l.updateQueue=r,l.flags|=4),lo(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!rt)return Ht(l),null}else 2*Pt()-f.renderingStartTime>$c&&u!==1073741824&&(l.flags|=128,s=!0,lo(f,!1),l.lanes=4194304);f.isBackwards?(v.sibling=l.child,l.child=v):(r=f.last,r!==null?r.sibling=v:l.child=v,f.last=v)}return f.tail!==null?(l=f.tail,f.rendering=l,f.tail=l.sibling,f.renderingStartTime=Pt(),l.sibling=null,r=ut.current,Me(ut,s?r&1|2:r&1),l):(Ht(l),null);case 22:case 23:return nf(),s=l.memoizedState!==null,r!==null&&r.memoizedState!==null!==s&&(l.flags|=8192),s&&l.mode&1?hn&1073741824&&(Ht(l),nn&&l.subtreeFlags&6&&(l.flags|=8192)):Ht(l),null;case 24:return null;case 25:return null}throw Error(c(156,l.tag))}var Gy=d.ReactCurrentOwner,vn=!1;function Jt(r,l,u,s){l.child=r===null?Sv(l,null,u,s):Yl(l,r.child,u,s)}function Xv(r,l,u,s,f){u=u.render;var v=l.ref;return Vl(l,f),s=Rc(r,l,u,s,v,f),u=Tc(),r!==null&&!vn?(l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~f,yr(r,l,f)):(rt&&u&&yc(l),l.flags|=1,Jt(r,l,s,f),l.child)}function Yv(r,l,u,s,f){if(r===null){var v=u.type;return typeof v=="function"&&!lf(v)&&v.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(l.tag=15,l.type=v,Kv(r,l,v,s,f)):(r=da(u.type,null,s,l,l.mode,f),r.ref=l.ref,r.return=l,l.child=r)}if(v=r.child,!(r.lanes&f)){var x=v.memoizedProps;if(u=u.compare,u=u!==null?u:Mu,u(x,s)&&r.ref===l.ref)return yr(r,l,f)}return l.flags|=1,r=Dr(v,s),r.ref=l.ref,r.return=l,l.child=r}function Kv(r,l,u,s,f){if(r!==null&&Mu(r.memoizedProps,s)&&r.ref===l.ref)if(vn=!1,(r.lanes&f)!==0)r.flags&131072&&(vn=!0);else return l.lanes=r.lanes,yr(r,l,f);return Fc(r,l,u,s,f)}function Jv(r,l,u){var s=l.pendingProps,f=s.children,v=r!==null?r.memoizedState:null;if(s.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null},Me(ql,hn),hn|=u;else if(u&1073741824)l.memoizedState={baseLanes:0,cachePool:null},s=v!==null?v.baseLanes:u,Me(ql,hn),hn|=s;else return r=v!==null?v.baseLanes|u:u,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:r,cachePool:null},l.updateQueue=null,Me(ql,hn),hn|=r,null;else v!==null?(s=v.baseLanes|u,l.memoizedState=null):s=u,Me(ql,hn),hn|=s;return Jt(r,l,f,u),l.child}function $v(r,l){var u=l.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(l.flags|=512,l.flags|=2097152)}function Fc(r,l,u,s,f){var v=gt(u)?Je:Xe.current;return v=At(l,v),Vl(l,f),u=Rc(r,l,u,s,v,f),s=Tc(),r!==null&&!vn?(l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~f,yr(r,l,f)):(rt&&s&&yc(l),l.flags|=1,Jt(r,l,u,f),l.child)}function qv(r,l,u,s,f){if(gt(u)){var v=!0;Ge(l)}else v=!1;if(Vl(l,f),l.stateNode===null)r!==null&&(r.alternate=null,l.alternate=null,l.flags|=2),dv(l,u,s),gc(l,u,s,f),s=!0;else if(r===null){var x=l.stateNode,N=l.memoizedProps;x.props=N;var Q=x.context,b=u.contextType;typeof b=="object"&&b!==null?b=kn(b):(b=gt(u)?Je:Xe.current,b=At(l,b));var fe=u.getDerivedStateFromProps,xe=typeof fe=="function"||typeof x.getSnapshotBeforeUpdate=="function";xe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N!==s||Q!==b)&&pv(l,x,s,b),Nr=!1;var Se=l.memoizedState;x.state=Se,zu(l,s,x,f),Q=l.memoizedState,N!==s||Se!==Q||Re.current||Nr?(typeof fe=="function"&&(mc(l,u,fe,s),Q=l.memoizedState),(N=Nr||fv(l,u,N,s,Se,Q,b))?(xe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(l.flags|=4194308)):(typeof x.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=s,l.memoizedState=Q),x.props=s,x.state=Q,x.context=b,s=N):(typeof x.componentDidMount=="function"&&(l.flags|=4194308),s=!1)}else{x=l.stateNode,uv(r,l),N=l.memoizedProps,b=l.type===l.elementType?N:Wn(l.type,N),x.props=b,xe=l.pendingProps,Se=x.context,Q=u.contextType,typeof Q=="object"&&Q!==null?Q=kn(Q):(Q=gt(u)?Je:Xe.current,Q=At(l,Q));var Ye=u.getDerivedStateFromProps;(fe=typeof Ye=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N!==xe||Se!==Q)&&pv(l,x,s,Q),Nr=!1,Se=l.memoizedState,x.state=Se,zu(l,s,x,f);var ge=l.memoizedState;N!==xe||Se!==ge||Re.current||Nr?(typeof Ye=="function"&&(mc(l,u,Ye,s),ge=l.memoizedState),(b=Nr||fv(l,u,b,s,Se,ge,Q)||!1)?(fe||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(s,ge,Q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(s,ge,Q)),typeof x.componentDidUpdate=="function"&&(l.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof x.componentDidUpdate!="function"||N===r.memoizedProps&&Se===r.memoizedState||(l.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===r.memoizedProps&&Se===r.memoizedState||(l.flags|=1024),l.memoizedProps=s,l.memoizedState=ge),x.props=s,x.state=ge,x.context=Q,s=b):(typeof x.componentDidUpdate!="function"||N===r.memoizedProps&&Se===r.memoizedState||(l.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===r.memoizedProps&&Se===r.memoizedState||(l.flags|=1024),s=!1)}return Dc(r,l,u,s,v,f)}function Dc(r,l,u,s,f,v){$v(r,l);var x=(l.flags&128)!==0;if(!s&&!x)return f&&Be(l,u,!1),yr(r,l,v);s=l.stateNode,Gy.current=l;var N=x&&typeof u.getDerivedStateFromError!="function"?null:s.render();return l.flags|=1,r!==null&&x?(l.child=Yl(l,r.child,null,v),l.child=Yl(l,null,N,v)):Jt(r,l,N,v),l.memoizedState=s.state,f&&Be(l,u,!0),l.child}function bv(r){var l=r.stateNode;l.pendingContext?Qe(r,l.pendingContext,l.pendingContext!==l.context):l.context&&Qe(r,l.context,!1),kc(r,l.containerInfo)}function eh(r,l,u,s,f){return Xl(),_c(f),l.flags|=256,Jt(r,l,u,s),l.child}var Zu={dehydrated:null,treeContext:null,retryLane:0};function Xu(r){return{baseLanes:r,cachePool:null}}function th(r,l,u){var s=l.pendingProps,f=ut.current,v=!1,x=(l.flags&128)!==0,N;if((N=x)||(N=r!==null&&r.memoizedState===null?!1:(f&2)!==0),N?(v=!0,l.flags&=-129):(r===null||r.memoizedState!==null)&&(f|=1),Me(ut,f&1),r===null)return Ec(l),r=l.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?(l.mode&1?Vi(r)?l.lanes=8:l.lanes=1073741824:l.lanes=1,null):(f=s.children,r=s.fallback,v?(s=l.mode,v=l.child,f={mode:"hidden",children:f},!(s&1)&&v!==null?(v.childLanes=0,v.pendingProps=f):v=pa(f,s,0,null),r=kl(r,s,u,null),v.return=l,r.return=l,v.sibling=r,l.child=v,l.child.memoizedState=Xu(u),l.memoizedState=Zu,r):Uc(l,f));if(f=r.memoizedState,f!==null){if(N=f.dehydrated,N!==null){if(x)return l.flags&256?(l.flags&=-257,Yu(r,l,u,Error(c(422)))):l.memoizedState!==null?(l.child=r.child,l.flags|=128,null):(v=s.fallback,f=l.mode,s=pa({mode:"visible",children:s.children},f,0,null),v=kl(v,f,u,null),v.flags|=2,s.return=l,v.return=l,s.sibling=v,l.child=s,l.mode&1&&Yl(l,r.child,null,u),l.child.memoizedState=Xu(u),l.memoizedState=Zu,v);if(!(l.mode&1))l=Yu(r,l,u,null);else if(Vi(N))l=Yu(r,l,u,Error(c(419)));else if(s=(u&r.childLanes)!==0,vn||s){if(s=yt,s!==null){switch(u&-u){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}s=v&(s.suspendedLanes|u)?0:v,s!==0&&s!==f.retryLane&&(f.retryLane=s,Rn(r,s,-1))}rf(),l=Yu(r,l,u,Error(c(421)))}else pl(N)?(l.flags|=128,l.child=r.child,l=lw.bind(null,r),vl(N,l),l=null):(u=f.treeContext,Dt&&(pn=rc(N),dn=l,rt=!0,Qn=null,Xi=!1,u!==null&&(xn[Cn++]=hr,xn[Cn++]=mr,xn[Cn++]=hl,hr=u.id,mr=u.overflow,hl=l)),l=Uc(l,l.pendingProps.children),l.flags|=4096);return l}return v?(s=rh(r,l,s.children,s.fallback,u),v=l.child,f=r.child.memoizedState,v.memoizedState=f===null?Xu(u):{baseLanes:f.baseLanes|u,cachePool:null},v.childLanes=r.childLanes&~u,l.memoizedState=Zu,s):(u=nh(r,l,s.children,u),l.memoizedState=null,u)}return v?(s=rh(r,l,s.children,s.fallback,u),v=l.child,f=r.child.memoizedState,v.memoizedState=f===null?Xu(u):{baseLanes:f.baseLanes|u,cachePool:null},v.childLanes=r.childLanes&~u,l.memoizedState=Zu,s):(u=nh(r,l,s.children,u),l.memoizedState=null,u)}function Uc(r,l){return l=pa({mode:"visible",children:l},r.mode,0,null),l.return=r,r.child=l}function nh(r,l,u,s){var f=r.child;return r=f.sibling,u=Dr(f,{mode:"visible",children:u}),!(l.mode&1)&&(u.lanes=s),u.return=l,u.sibling=null,r!==null&&(s=l.deletions,s===null?(l.deletions=[r],l.flags|=16):s.push(r)),l.child=u}function rh(r,l,u,s,f){var v=l.mode;r=r.child;var x=r.sibling,N={mode:"hidden",children:u};return!(v&1)&&l.child!==r?(u=l.child,u.childLanes=0,u.pendingProps=N,l.deletions=null):(u=Dr(r,N),u.subtreeFlags=r.subtreeFlags&14680064),x!==null?s=Dr(x,s):(s=kl(s,v,f,null),s.flags|=2),s.return=l,u.return=l,u.sibling=s,l.child=u,s}function Yu(r,l,u,s){return s!==null&&_c(s),Yl(l,r.child,null,u),r=Uc(l,l.pendingProps.children),r.flags|=2,l.memoizedState=null,r}function lh(r,l,u){r.lanes|=l;var s=r.alternate;s!==null&&(s.lanes|=l),vc(r.return,l,u)}function Ac(r,l,u,s,f){var v=r.memoizedState;v===null?r.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:s,tail:u,tailMode:f}:(v.isBackwards=l,v.rendering=null,v.renderingStartTime=0,v.last=s,v.tail=u,v.tailMode=f)}function ih(r,l,u){var s=l.pendingProps,f=s.revealOrder,v=s.tail;if(Jt(r,l,s.children,u),s=ut.current,s&2)s=s&1|2,l.flags|=128;else{if(r!==null&&r.flags&128)e:for(r=l.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&lh(r,u,l);else if(r.tag===19)lh(r,u,l);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===l)break e;for(;r.sibling===null;){if(r.return===null||r.return===l)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}s&=1}if(Me(ut,s),!(l.mode&1))l.memoizedState=null;else switch(f){case"forwards":for(u=l.child,f=null;u!==null;)r=u.alternate,r!==null&&Du(r)===null&&(f=u),u=u.sibling;u=f,u===null?(f=l.child,l.child=null):(f=u.sibling,u.sibling=null),Ac(l,!1,f,u,v);break;case"backwards":for(u=null,f=l.child,l.child=null;f!==null;){if(r=f.alternate,r!==null&&Du(r)===null){l.child=f;break}r=f.sibling,f.sibling=u,u=f,f=r}Ac(l,!0,u,null,v);break;case"together":Ac(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function yr(r,l,u){if(r!==null&&(l.dependencies=r.dependencies),bl|=l.lanes,!(u&l.childLanes))return null;if(r!==null&&l.child!==r.child)throw Error(c(153));if(l.child!==null){for(r=l.child,u=Dr(r,r.pendingProps),l.child=u,u.return=l;r.sibling!==null;)r=r.sibling,u=u.sibling=Dr(r,r.pendingProps),u.return=l;u.sibling=null}return l.child}function Zy(r,l,u){switch(l.tag){case 3:bv(l),Xl();break;case 5:Ev(l);break;case 1:gt(l.type)&&Ge(l);break;case 4:kc(l,l.stateNode.containerInfo);break;case 10:ov(l,l.type._context,l.memoizedProps.value);break;case 13:var s=l.memoizedState;if(s!==null)return s.dehydrated!==null?(Me(ut,ut.current&1),l.flags|=128,null):u&l.child.childLanes?th(r,l,u):(Me(ut,ut.current&1),r=yr(r,l,u),r!==null?r.sibling:null);Me(ut,ut.current&1);break;case 19:if(s=(u&l.childLanes)!==0,r.flags&128){if(s)return ih(r,l,u);l.flags|=128}var f=l.memoizedState;if(f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Me(ut,ut.current),s)break;return null;case 22:case 23:return l.lanes=0,Jv(r,l,u)}return yr(r,l,u)}function Xy(r,l){switch(wc(l),l.tag){case 1:return gt(l.type)&&zt(),r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 3:return Jl(),_e(Re),_e(Xe),Pc(),r=l.flags,r&65536&&!(r&128)?(l.flags=r&-65537|128,l):null;case 5:return xc(l),null;case 13:if(_e(ut),r=l.memoizedState,r!==null&&r.dehydrated!==null){if(l.alternate===null)throw Error(c(340));Xl()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 19:return _e(ut),null;case 4:return Jl(),null;case 10:return pc(l.type._context),null;case 22:case 23:return nf(),null;case 24:return null;default:return null}}var Ku=!1,yl=!1,Yy=typeof WeakSet=="function"?WeakSet:Set,oe=null;function Ju(r,l){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(s){on(r,l,s)}else u.current=null}function Bc(r,l,u){try{u()}catch(s){on(r,l,s)}}var oh=!1;function Ky(r,l){for(X(r.containerInfo),oe=l;oe!==null;)if(r=oe,l=r.child,(r.subtreeFlags&1028)!==0&&l!==null)l.return=r,oe=l;else for(;oe!==null;){r=oe;try{var u=r.alternate;if(r.flags&1024)switch(r.tag){case 0:case 11:case 15:break;case 1:if(u!==null){var s=u.memoizedProps,f=u.memoizedState,v=r.stateNode,x=v.getSnapshotBeforeUpdate(r.elementType===r.type?s:Wn(r.type,s),f);v.__reactInternalSnapshotBeforeUpdate=x}break;case 3:nn&&$s(r.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(N){on(r,r.return,N)}if(l=r.sibling,l!==null){l.return=r.return,oe=l;break}oe=r.return}return u=oh,oh=!1,u}function wl(r,l,u){var s=l.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var f=s=s.next;do{if((f.tag&r)===r){var v=f.destroy;f.destroy=void 0,v!==void 0&&Bc(l,u,v)}f=f.next}while(f!==s)}}function io(r,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var u=l=l.next;do{if((u.tag&r)===r){var s=u.create;u.destroy=s()}u=u.next}while(u!==l)}}function jc(r){var l=r.ref;if(l!==null){var u=r.stateNode;switch(r.tag){case 5:r=ye(u);break;default:r=u}typeof l=="function"?l(r):l.current=r}}function uh(r,l,u){if(bn&&typeof bn.onCommitFiberUnmount=="function")try{bn.onCommitFiberUnmount(Cu,l)}catch{}switch(l.tag){case 0:case 11:case 14:case 15:if(r=l.updateQueue,r!==null&&(r=r.lastEffect,r!==null)){var s=r=r.next;do{var f=s,v=f.destroy;f=f.tag,v!==void 0&&(f&2||f&4)&&Bc(l,u,v),s=s.next}while(s!==r)}break;case 1:if(Ju(l,u),r=l.stateNode,typeof r.componentWillUnmount=="function")try{r.props=l.memoizedProps,r.state=l.memoizedState,r.componentWillUnmount()}catch(x){on(l,u,x)}break;case 5:Ju(l,u);break;case 4:nn?ph(r,l,u):Hl&&Hl&&(l=l.stateNode.containerInfo,u=mu(l),yu(l,u))}}function ah(r,l,u){for(var s=l;;)if(uh(r,s,u),s.child===null||nn&&s.tag===4){if(s===l)break;for(;s.sibling===null;){if(s.return===null||s.return===l)return;s=s.return}s.sibling.return=s.return,s=s.sibling}else s.child.return=s,s=s.child}function sh(r){var l=r.alternate;l!==null&&(r.alternate=null,sh(l)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(l=r.stateNode,l!==null&&js(l)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function ch(r){return r.tag===5||r.tag===3||r.tag===4}function fh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||ch(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function dh(r){if(nn){e:{for(var l=r.return;l!==null;){if(ch(l))break e;l=l.return}throw Error(c(160))}var u=l;switch(u.tag){case 5:l=u.stateNode,u.flags&32&&(Yt(l),u.flags&=-33),u=fh(r),Wc(r,u,l);break;case 3:case 4:l=u.stateNode.containerInfo,u=fh(r),Hc(r,u,l);break;default:throw Error(c(161))}}}function Hc(r,l,u){var s=r.tag;if(s===5||s===6)r=r.stateNode,l?Ut(u,r,l):Wl(u,r);else if(s!==4&&(r=r.child,r!==null))for(Hc(r,l,u),r=r.sibling;r!==null;)Hc(r,l,u),r=r.sibling}function Wc(r,l,u){var s=r.tag;if(s===5||s===6)r=r.stateNode,l?fl(u,r,l):vu(u,r);else if(s!==4&&(r=r.child,r!==null))for(Wc(r,l,u),r=r.sibling;r!==null;)Wc(r,l,u),r=r.sibling}function ph(r,l,u){for(var s=l,f=!1,v,x;;){if(!f){f=s.return;e:for(;;){if(f===null)throw Error(c(160));switch(v=f.stateNode,f.tag){case 5:x=!1;break e;case 3:v=v.containerInfo,x=!0;break e;case 4:v=v.containerInfo,x=!0;break e}f=f.return}f=!0}if(s.tag===5||s.tag===6)ah(r,s,u),x?Tr(v,s.stateNode):hu(v,s.stateNode);else if(s.tag===18)x?J(v,s.stateNode):q(v,s.stateNode);else if(s.tag===4){if(s.child!==null){v=s.stateNode.containerInfo,x=!0,s.child.return=s,s=s.child;continue}}else if(uh(r,s,u),s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break;for(;s.sibling===null;){if(s.return===null||s.return===l)return;s=s.return,s.tag===4&&(f=!1)}s.sibling.return=s.return,s=s.sibling}}function Qc(r,l){if(nn){switch(l.tag){case 0:case 11:case 14:case 15:wl(3,l,l.return),io(3,l),wl(5,l,l.return);return;case 1:return;case 5:var u=l.stateNode;if(u!=null){var s=l.memoizedProps;r=r!==null?r.memoizedProps:s;var f=l.type,v=l.updateQueue;l.updateQueue=null,v!==null&&Ks(u,v,f,r,s,l)}return;case 6:if(l.stateNode===null)throw Error(c(162));u=l.memoizedProps,Xs(l.stateNode,r!==null?r.memoizedProps:u,u);return;case 3:Dt&&r!==null&&r.memoizedState.isDehydrated&&H(l.stateNode.containerInfo);return;case 12:return;case 13:$u(l);return;case 19:$u(l);return;case 17:return}throw Error(c(163))}switch(l.tag){case 0:case 11:case 14:case 15:wl(3,l,l.return),io(3,l),wl(5,l,l.return);return;case 12:return;case 13:$u(l);return;case 19:$u(l);return;case 3:Dt&&r!==null&&r.memoizedState.isDehydrated&&H(l.stateNode.containerInfo);break;case 22:case 23:return}e:if(Hl){switch(l.tag){case 1:case 5:case 6:break e;case 3:case 4:l=l.stateNode,yu(l.containerInfo,l.pendingChildren);break e}throw Error(c(163))}}function $u(r){var l=r.updateQueue;if(l!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new Yy),l.forEach(function(s){var f=iw.bind(null,r,s);u.has(s)||(u.add(s),s.then(f,f))})}}function Jy(r,l){for(oe=l;oe!==null;){l=oe;var u=l.deletions;if(u!==null)for(var s=0;s";case bu:return":has("+(Zc(r)||"")+")";case ea:return'[role="'+r.value+'"]';case na:return'"'+r.value+'"';case ta:return'[data-testname="'+r.value+'"]';default:throw Error(c(365))}}function yh(r,l){var u=[];r=[r,0];for(var s=0;sf&&(f=x),s&=~v}if(s=f,s=Pt()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*qy(s/1960))-s,10r?16:r,Lr===null)var s=!1;else{if(r=Lr,Lr=null,ua=0,Ne&6)throw Error(c(331));var f=Ne;for(Ne|=4,oe=r.current;oe!==null;){var v=oe,x=v.child;if(oe.flags&16){var N=v.deletions;if(N!==null){for(var Q=0;QPt()-Jc?Sl(r,0):Kc|=u),ln(r,l)}function Mh(r,l){l===0&&(r.mode&1?(l=ku,ku<<=1,!(ku&130023424)&&(ku=4194304)):l=1);var u=$t();r=ca(r,l),r!==null&&(Zi(r,l,u),ln(r,u))}function lw(r){var l=r.memoizedState,u=0;l!==null&&(u=l.retryLane),Mh(r,u)}function iw(r,l){var u=0;switch(r.tag){case 13:var s=r.stateNode,f=r.memoizedState;f!==null&&(u=f.retryLane);break;case 19:s=r.stateNode;break;default:throw Error(c(314))}s!==null&&s.delete(l),Mh(r,u)}var Rh;Rh=function(r,l,u){if(r!==null)if(r.memoizedProps!==l.pendingProps||Re.current)vn=!0;else{if(!(r.lanes&u)&&!(l.flags&128))return vn=!1,Zy(r,l,u);vn=!!(r.flags&131072)}else vn=!1,rt&&l.flags&1048576&&vv(l,Ou,l.index);switch(l.lanes=0,l.tag){case 2:var s=l.type;r!==null&&(r.alternate=null,l.alternate=null,l.flags|=2),r=l.pendingProps;var f=At(l,Xe.current);Vl(l,u),f=Rc(null,l,s,r,f,u);var v=Tc();return l.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,gt(s)?(v=!0,Ge(l)):v=!1,l.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,hc(l),f.updater=Iu,l.stateNode=f,f._reactInternals=l,gc(l,s,r,u),l=Dc(null,l,s,!0,v,u)):(l.tag=0,rt&&v&&yc(l),Jt(null,l,f,u),l=l.child),l;case 16:s=l.elementType;e:{switch(r!==null&&(r.alternate=null,l.alternate=null,l.flags|=2),r=l.pendingProps,f=s._init,s=f(s._payload),l.type=s,f=l.tag=uw(s),r=Wn(s,r),f){case 0:l=Fc(null,l,s,r,u);break e;case 1:l=qv(null,l,s,r,u);break e;case 11:l=Xv(null,l,s,r,u);break e;case 14:l=Yv(null,l,s,Wn(s.type,r),u);break e}throw Error(c(306,s,""))}return l;case 0:return s=l.type,f=l.pendingProps,f=l.elementType===s?f:Wn(s,f),Fc(r,l,s,f,u);case 1:return s=l.type,f=l.pendingProps,f=l.elementType===s?f:Wn(s,f),qv(r,l,s,f,u);case 3:e:{if(bv(l),r===null)throw Error(c(387));s=l.pendingProps,v=l.memoizedState,f=v.element,uv(r,l),zu(l,s,null,u);var x=l.memoizedState;if(s=x.element,Dt&&v.isDehydrated)if(v={element:s,isDehydrated:!1,cache:x.cache,transitions:x.transitions},l.updateQueue.baseState=v,l.memoizedState=v,l.flags&256){f=Error(c(423)),l=eh(r,l,s,u,f);break e}else if(s!==f){f=Error(c(424)),l=eh(r,l,s,u,f);break e}else for(Dt&&(pn=Eu(l.stateNode.containerInfo),dn=l,rt=!0,Qn=null,Xi=!1),u=Sv(l,null,s,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Xl(),s===f){l=yr(r,l,u);break e}Jt(r,l,s,u)}l=l.child}return l;case 5:return Ev(l),r===null&&Ec(l),s=l.type,f=l.pendingProps,v=r!==null?r.memoizedProps:null,x=f.children,ft(s,f)?x=null:v!==null&&ft(s,v)&&(l.flags|=32),$v(r,l),Jt(r,l,x,u),l.child;case 6:return r===null&&Ec(l),null;case 13:return th(r,l,u);case 4:return kc(l,l.stateNode.containerInfo),s=l.pendingProps,r===null?l.child=Yl(l,null,s,u):Jt(r,l,s,u),l.child;case 11:return s=l.type,f=l.pendingProps,f=l.elementType===s?f:Wn(s,f),Xv(r,l,s,f,u);case 7:return Jt(r,l,l.pendingProps,u),l.child;case 8:return Jt(r,l,l.pendingProps.children,u),l.child;case 12:return Jt(r,l,l.pendingProps.children,u),l.child;case 10:e:{if(s=l.type._context,f=l.pendingProps,v=l.memoizedProps,x=f.value,ov(l,s,x),v!==null)if(er(v.value,x)){if(v.children===f.children&&!Re.current){l=yr(r,l,u);break e}}else for(v=l.child,v!==null&&(v.return=l);v!==null;){var N=v.dependencies;if(N!==null){x=v.child;for(var Q=N.firstContext;Q!==null;){if(Q.context===s){if(v.tag===1){Q=vr(-1,u&-u),Q.tag=2;var b=v.updateQueue;if(b!==null){b=b.shared;var fe=b.pending;fe===null?Q.next=Q:(Q.next=fe.next,fe.next=Q),b.pending=Q}}v.lanes|=u,Q=v.alternate,Q!==null&&(Q.lanes|=u),vc(v.return,u,l),N.lanes|=u;break}Q=Q.next}}else if(v.tag===10)x=v.type===l.type?null:v.child;else if(v.tag===18){if(x=v.return,x===null)throw Error(c(341));x.lanes|=u,N=x.alternate,N!==null&&(N.lanes|=u),vc(x,u,l),x=v.sibling}else x=v.child;if(x!==null)x.return=v;else for(x=v;x!==null;){if(x===l){x=null;break}if(v=x.sibling,v!==null){v.return=x.return,x=v;break}x=x.return}v=x}Jt(r,l,f.children,u),l=l.child}return l;case 9:return f=l.type,s=l.pendingProps.children,Vl(l,u),f=kn(f),s=s(f),l.flags|=1,Jt(r,l,s,u),l.child;case 14:return s=l.type,f=Wn(s,l.pendingProps),f=Wn(s.type,f),Yv(r,l,s,f,u);case 15:return Kv(r,l,l.type,l.pendingProps,u);case 17:return s=l.type,f=l.pendingProps,f=l.elementType===s?f:Wn(s,f),r!==null&&(r.alternate=null,l.alternate=null,l.flags|=2),l.tag=1,gt(s)?(r=!0,Ge(l)):r=!1,Vl(l,u),dv(l,s,f),gc(l,s,f,u),Dc(null,l,s,!0,r,u);case 19:return ih(r,l,u);case 22:return Jv(r,l,u)}throw Error(c(156,l.tag))};function Th(r,l){return uc(r,l)}function ow(r,l,u,s){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tn(r,l,u,s){return new ow(r,l,u,s)}function lf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function uw(r){if(typeof r=="function")return lf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===R)return 11;if(r===E)return 14}return 2}function Dr(r,l){var u=r.alternate;return u===null?(u=Tn(r.tag,l,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=l,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,l=r.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function da(r,l,u,s,f,v){var x=2;if(s=r,typeof r=="function")lf(r)&&(x=1);else if(typeof r=="string")x=5;else e:switch(r){case m:return kl(u.children,f,v,l);case g:x=8,f|=8;break;case w:return r=Tn(12,u,l,f|2),r.elementType=w,r.lanes=v,r;case T:return r=Tn(13,u,l,f),r.elementType=T,r.lanes=v,r;case S:return r=Tn(19,u,l,f),r.elementType=S,r.lanes=v,r;case z:return pa(u,f,v,l);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:x=10;break e;case P:x=9;break e;case R:x=11;break e;case E:x=14;break e;case k:x=16,s=null;break e}throw Error(c(130,r==null?r:typeof r,""))}return l=Tn(x,u,l,f),l.elementType=r,l.type=s,l.lanes=v,l}function kl(r,l,u,s){return r=Tn(7,r,s,l),r.lanes=u,r}function pa(r,l,u,s){return r=Tn(22,r,s,l),r.elementType=z,r.lanes=u,r.stateNode={},r}function of(r,l,u){return r=Tn(6,r,null,l),r.lanes=u,r}function uf(r,l,u){return l=Tn(4,r.children!==null?r.children:[],r.key,l),l.lanes=u,l.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},l}function aw(r,l,u,s,f){this.tag=l,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Wi,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ic(0),this.expirationTimes=ic(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ic(0),this.identifierPrefix=s,this.onRecoverableError=f,Dt&&(this.mutableSourceEagerHydrationData=null)}function Nh(r,l,u,s,f,v,x,N,Q){return r=new aw(r,l,u,N,Q),l===1?(l=1,v===!0&&(l|=8)):l=0,v=Tn(3,null,null,l),r.current=v,v.stateNode=r,v.memoizedState={element:s,isDehydrated:u,cache:null,transitions:null},hc(v),r}function zh(r){if(!r)return Fe;r=r._reactInternals;e:{if(Z(r)!==r||r.tag!==1)throw Error(c(170));var l=r;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(gt(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(c(171))}if(r.tag===1){var u=r.type;if(gt(u))return Et(r,u,l)}return l}function Ih(r){var l=r._reactInternals;if(l===void 0)throw typeof r.render=="function"?Error(c(188)):(r=Object.keys(r).join(","),Error(c(268,r)));return r=ae(l),r===null?null:r.stateNode}function Lh(r,l){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u=b&&v>=xe&&f<=fe&&x<=Se){r.splice(l,1);break}else if(s!==b||u.width!==Q.width||Sex){if(!(v!==xe||u.height!==Q.height||fef)){b>s&&(Q.width+=b-s,Q.x=s),fev&&(Q.height+=xe-v,Q.y=v),Seu&&(u=x)),x ")+` + +No matching component was found for: + `)+r.join(" > ")}return null},n.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return ye(r.child.stateNode);default:return r.child.stateNode}},n.injectIntoDevTools=function(r){if(r={bundleType:r.bundleType,version:r.version,rendererPackageName:r.rendererPackageName,rendererConfig:r.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:d.ReactCurrentDispatcher,findHostInstanceByFiber:sw,findFiberByHostInstance:r.findFiberByHostInstance||cw,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)r=!0;else{try{Cu=l.inject(r),bn=l}catch{}r=!!l.checkDCE}}return r},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(r,l,u,s){if(!sl)throw Error(c(363));r=Xc(r,l);var f=Zs(r,u,s).disconnect;return{disconnect:function(){f()}}},n.registerMutableSourceForHydration=function(r,l){var u=l._getVersion;u=u(l._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[l,u]:r.mutableSourceEagerHydrationData.push(l,u)},n.runWithPriority=function(r,l){var u=je;try{return je=r,l()}finally{je=u}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(r,l,u,s){var f=l.current,v=$t(),x=Or(f);return u=zh(u),l.context===null?l.context=u:l.pendingContext=u,l=vr(v,x),l.payload={element:r},s=s===void 0?null:s,s!==null&&(l.callback=s),zr(f,l),r=Rn(f,x,v),r!==null&&Nu(r,f,x),x},n};H1.exports=T_;var N_=H1.exports;const z_=Es(N_),Gp={},V1=e=>void Object.assign(Gp,e);function I_(e,t){function n(m,{args:g=[],attach:w,...C},P){let R=`${m[0].toUpperCase()}${m.slice(1)}`,T;if(m==="primitive"){if(C.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const S=C.object;T=ii(S,{type:m,root:P,attach:w,primitive:!0})}else{const S=Gp[R];if(!S)throw new Error(`R3F: ${R} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(g))throw new Error("R3F: The args prop must be an array!");T=ii(new S(...g),{type:m,root:P,attach:w,memoizedProps:{args:g}})}return T.__r3f.attach===void 0&&(T instanceof hw?T.__r3f.attach="geometry":T instanceof mw&&(T.__r3f.attach="material")),R!=="inject"&&Bf(T,C),T}function i(m,g){let w=!1;if(g){var C,P;(C=g.__r3f)!=null&&C.attach?Af(m,g,g.__r3f.attach):g.isObject3D&&m.isObject3D&&(m.add(g),w=!0),w||(P=m.__r3f)==null||P.objects.push(g),g.__r3f||ii(g,{}),g.__r3f.parent=m,Vd(g),oi(g)}}function o(m,g,w){let C=!1;if(g){var P,R;if((P=g.__r3f)!=null&&P.attach)Af(m,g,g.__r3f.attach);else if(g.isObject3D&&m.isObject3D){g.parent=m,g.dispatchEvent({type:"added"}),m.dispatchEvent({type:"childadded",child:g});const T=m.children.filter(E=>E!==g),S=T.indexOf(w);m.children=[...T.slice(0,S),g,...T.slice(S)],C=!0}C||(R=m.__r3f)==null||R.objects.push(g),g.__r3f||ii(g,{}),g.__r3f.parent=m,Vd(g),oi(g)}}function a(m,g,w=!1){m&&[...m].forEach(C=>c(g,C,w))}function c(m,g,w){if(g){var C,P,R;if(g.__r3f&&(g.__r3f.parent=null),(C=m.__r3f)!=null&&C.objects&&(m.__r3f.objects=m.__r3f.objects.filter(z=>z!==g)),(P=g.__r3f)!=null&&P.attach)Jm(m,g,g.__r3f.attach);else if(g.isObject3D&&m.isObject3D){var T;m.remove(g),(T=g.__r3f)!=null&&T.root&&j_(Ya(g),g)}const E=(R=g.__r3f)==null?void 0:R.primitive,k=!E&&(w===void 0?g.dispose!==null:w);if(!E){var S;a((S=g.__r3f)==null?void 0:S.objects,g,k),a(g.children,g,k)}if(delete g.__r3f,k&&g.dispose&&g.type!=="Scene"){const z=()=>{try{g.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?Wd.unstable_scheduleCallback(Wd.unstable_IdlePriority,z):z()}oi(m)}}function d(m,g,w,C){var P;const R=(P=m.__r3f)==null?void 0:P.parent;if(!R)return;const T=n(g,w,m.__r3f.root);if(m.children){for(const S of m.children)S.__r3f&&i(T,S);m.children=m.children.filter(S=>!S.__r3f)}m.__r3f.objects.forEach(S=>i(T,S)),m.__r3f.objects=[],m.__r3f.autoRemovedBeforeAppend||c(R,m),T.parent&&(T.__r3f.autoRemovedBeforeAppend=!0),i(R,T),T.raycast&&T.__r3f.eventCount&&Ya(T).getState().internal.interaction.push(T),[C,C.alternate].forEach(S=>{S!==null&&(S.stateNode=T,S.ref&&(typeof S.ref=="function"?S.ref(T):S.ref.current=T))})}const p=()=>{};return{reconciler:z_({createInstance:n,removeChild:c,appendChild:i,appendInitialChild:i,insertBefore:o,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(m,g)=>{if(!g)return;const w=m.getState().scene;w.__r3f&&(w.__r3f.root=m,i(w,g))},removeChildFromContainer:(m,g)=>{g&&c(m.getState().scene,g)},insertInContainerBefore:(m,g,w)=>{if(!g||!w)return;const C=m.getState().scene;C.__r3f&&o(C,g,w)},getRootHostContext:()=>null,getChildHostContext:m=>m,finalizeInitialChildren(m){var g;return!!((g=m==null?void 0:m.__r3f)!=null?g:{}).handlers},prepareUpdate(m,g,w,C){var P;if(((P=m==null?void 0:m.__r3f)!=null?P:{}).primitive&&C.object&&C.object!==m)return[!0];{const{args:T=[],children:S,...E}=C,{args:k=[],children:z,...O}=w;if(!Array.isArray(T))throw new Error("R3F: the args prop must be an array!");if(T.some((G,F)=>G!==k[F]))return[!0];const A=$1(m,E,O,!0);return A.changes.length?[!1,A]:null}},commitUpdate(m,[g,w],C,P,R,T){g?d(m,C,R,T):Bf(m,w)},commitMount(m,g,w,C){var P;const R=(P=m.__r3f)!=null?P:{};m.raycast&&R.handlers&&R.eventCount&&Ya(m).getState().internal.interaction.push(m)},getPublicInstance:m=>m,prepareForCommit:()=>null,preparePortalMount:m=>ii(m.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(m){var g;const{attach:w,parent:C}=(g=m.__r3f)!=null?g:{};w&&C&&Jm(C,m,w),m.isObject3D&&(m.visible=!1),oi(m)},unhideInstance(m,g){var w;const{attach:C,parent:P}=(w=m.__r3f)!=null?w:{};C&&P&&Af(P,m,C),(m.isObject3D&&g.visible==null||g.visible)&&(m.visible=!0),oi(m)},createTextInstance:p,hideTextInstance:p,unhideTextInstance:p,getCurrentEventPriority:()=>t?t():Si.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&$e.fun(performance.now)?performance.now:$e.fun(Date.now)?Date.now:()=>0,scheduleTimeout:$e.fun(setTimeout)?setTimeout:void 0,cancelTimeout:$e.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Bf}}var Zm,Xm;const Uf=e=>"colorSpace"in e||"outputColorSpace"in e,G1=()=>{var e;return(e=Gp.ColorManagement)!=null?e:null},Z1=e=>e&&e.isOrthographicCamera,L_=e=>e&&e.hasOwnProperty("current"),au=typeof window<"u"&&((Zm=window.document)!=null&&Zm.createElement||((Xm=window.navigator)==null?void 0:Xm.product)==="ReactNative")?L.useLayoutEffect:L.useEffect;function X1(e){const t=L.useRef(e);return au(()=>void(t.current=e),[e]),t}function O_({set:e}){return au(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}class Y1 extends L.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}}Y1.getDerivedStateFromError=()=>({error:!0});const K1="__default",Ym=new Map,F_=e=>e&&!!e.memoized&&!!e.changes;function J1(e){var t;const n=typeof window<"u"?(t=window.devicePixelRatio)!=null?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}const wo=e=>{var t;return(t=e.__r3f)==null?void 0:t.root.getState()};function Ya(e){let t=e.__r3f.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}const $e={obj:e=>e===Object(e)&&!$e.arr(e)&&typeof e!="function",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",boo:e=>typeof e=="boolean",und:e=>e===void 0,arr:e=>Array.isArray(e),equ(e,t,{arrays:n="shallow",objects:i="reference",strict:o=!0}={}){if(typeof e!=typeof t||!!e!=!!t)return!1;if($e.str(e)||$e.num(e)||$e.boo(e))return e===t;const a=$e.obj(e);if(a&&i==="reference")return e===t;const c=$e.arr(e);if(c&&n==="reference")return e===t;if((c||a)&&e===t)return!0;let d;for(d in e)if(!(d in t))return!1;if(a&&n==="shallow"&&i==="shallow"){for(d in o?t:e)if(!$e.equ(e[d],t[d],{strict:o,objects:"reference"}))return!1}else for(d in o?t:e)if(e[d]!==t[d])return!1;if($e.und(d)){if(c&&e.length===0&&t.length===0||a&&Object.keys(e).length===0&&Object.keys(t).length===0)return!0;if(e!==t)return!1}return!0}};function D_(e){const t={nodes:{},materials:{}};return e&&e.traverse(n=>{n.name&&(t.nodes[n.name]=n),n.material&&!t.materials[n.material.name]&&(t.materials[n.material.name]=n.material)}),t}function U_(e){e.dispose&&e.type!=="Scene"&&e.dispose();for(const t in e)t.dispose==null||t.dispose(),delete e[t]}function ii(e,t){const n=e;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t},e}function Qd(e,t){let n=e;if(t.includes("-")){const i=t.split("-"),o=i.pop();return n=i.reduce((a,c)=>a[c],e),{target:n,key:o}}else return{target:n,key:t}}const Km=/-\d+$/;function Af(e,t,n){if($e.str(n)){if(Km.test(n)){const a=n.replace(Km,""),{target:c,key:d}=Qd(e,a);Array.isArray(c[d])||(c[d]=[])}const{target:i,key:o}=Qd(e,n);t.__r3f.previousAttach=i[o],i[o]=t}else t.__r3f.previousAttach=n(e,t)}function Jm(e,t,n){var i,o;if($e.str(n)){const{target:a,key:c}=Qd(e,n),d=t.__r3f.previousAttach;d===void 0?delete a[c]:a[c]=d}else(i=t.__r3f)==null||i.previousAttach==null||i.previousAttach(e,t);(o=t.__r3f)==null||delete o.previousAttach}function $1(e,{children:t,key:n,ref:i,...o},{children:a,key:c,ref:d,...p}={},y=!1){const m=e.__r3f,g=Object.entries(o),w=[];if(y){const P=Object.keys(p);for(let R=0;R{var T;if((T=e.__r3f)!=null&&T.primitive&&P==="object"||$e.equ(R,p[P]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(P))return w.push([P,R,!0,[]]);let S=[];P.includes("-")&&(S=P.split("-")),w.push([P,R,!1,S]);for(const E in o){const k=o[E];E.startsWith(`${P}-`)&&w.push([E,k,!1,E.split("-")])}});const C={...o};return m!=null&&m.memoizedProps&&m!=null&&m.memoizedProps.args&&(C.args=m.memoizedProps.args),m!=null&&m.memoizedProps&&m!=null&&m.memoizedProps.attach&&(C.attach=m.memoizedProps.attach),{memoized:C,changes:w}}const A_=typeof process<"u"&&!1;function Bf(e,t){var n;const i=e.__r3f,o=i==null?void 0:i.root,a=o==null||o.getState==null?void 0:o.getState(),{memoized:c,changes:d}=F_(t)?t:$1(e,t),p=i==null?void 0:i.eventCount;e.__r3f&&(e.__r3f.memoizedProps=c);for(let m=0;mS[E],e),!(T&&T.set))){const[S,...E]=P.reverse();R=E.reverse().reduce((k,z)=>k[z],e),g=S}if(w===K1+"remove")if(R.constructor){let S=Ym.get(R.constructor);S||(S=new R.constructor,Ym.set(R.constructor,S)),w=S[g]}else w=0;if(C&&i)w?i.handlers[g]=w:delete i.handlers[g],i.eventCount=Object.keys(i.handlers).length;else if(T&&T.set&&(T.copy||T instanceof sf)){if(Array.isArray(w))T.fromArray?T.fromArray(w):T.set(...w);else if(T.copy&&w&&w.constructor&&(A_?T.constructor.name===w.constructor.name:T.constructor===w.constructor))T.copy(w);else if(w!==void 0){const S=T instanceof gw;!S&&T.setScalar?T.setScalar(w):T instanceof sf&&w instanceof sf?T.mask=w.mask:T.set(w),!G1()&&a&&!a.linear&&S&&T.convertSRGBToLinear()}}else if(R[g]=w,R[g]instanceof Gr&&R[g].format===Ri&&R[g].type===Ka&&a){const S=R[g];Uf(S)&&Uf(a.gl)?S.colorSpace=a.gl.outputColorSpace:S.encoding=a.gl.outputEncoding}oi(e)}if(i&&i.parent&&e.raycast&&p!==i.eventCount){const m=Ya(e).getState().internal,g=m.interaction.indexOf(e);g>-1&&m.interaction.splice(g,1),i.eventCount&&m.interaction.push(e)}return!(d.length===1&&d[0][0]==="onUpdate")&&d.length&&(n=e.__r3f)!=null&&n.parent&&Vd(e),e}function oi(e){var t,n;const i=(t=e.__r3f)==null||(n=t.root)==null||n.getState==null?void 0:n.getState();i&&i.internal.frames===0&&i.invalidate()}function Vd(e){e.onUpdate==null||e.onUpdate(e)}function q1(e,t){e.manual||(Z1(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix(),e.updateMatrixWorld())}function za(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function B_(){var e;const t=typeof self<"u"&&self||typeof window<"u"&&window;if(!t)return Si.DefaultEventPriority;switch((e=t.event)==null?void 0:e.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Si.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Si.ContinuousEventPriority;default:return Si.DefaultEventPriority}}function b1(e,t,n,i){const o=n.get(t);o&&(n.delete(t),n.size===0&&(e.delete(i),o.target.releasePointerCapture(i)))}function j_(e,t){const{internal:n}=e.getState();n.interaction=n.interaction.filter(i=>i!==t),n.initialHits=n.initialHits.filter(i=>i!==t),n.hovered.forEach((i,o)=>{(i.eventObject===t||i.object===t)&&n.hovered.delete(o)}),n.capturedMap.forEach((i,o)=>{b1(n.capturedMap,t,i,o)})}function H_(e){function t(p){const{internal:y}=e.getState(),m=p.offsetX-y.initialClick[0],g=p.offsetY-y.initialClick[1];return Math.round(Math.sqrt(m*m+g*g))}function n(p){return p.filter(y=>["Move","Over","Enter","Out","Leave"].some(m=>{var g;return(g=y.__r3f)==null?void 0:g.handlers["onPointer"+m]}))}function i(p,y){const m=e.getState(),g=new Set,w=[],C=y?y(m.internal.interaction):m.internal.interaction;for(let S=0;S{const k=wo(S.object),z=wo(E.object);return!k||!z?S.distance-E.distance:z.events.priority-k.events.priority||S.distance-E.distance}).filter(S=>{const E=za(S);return g.has(E)?!1:(g.add(E),!0)});m.events.filter&&(R=m.events.filter(R,m));for(const S of R){let E=S.object;for(;E;){var T;(T=E.__r3f)!=null&&T.eventCount&&w.push({...S,eventObject:E}),E=E.parent}}if("pointerId"in p&&m.internal.capturedMap.has(p.pointerId))for(let S of m.internal.capturedMap.get(p.pointerId).values())g.has(za(S.intersection))||w.push(S.intersection);return w}function o(p,y,m,g){const w=e.getState();if(p.length){const C={stopped:!1};for(const P of p){const R=wo(P.object)||w,{raycaster:T,pointer:S,camera:E,internal:k}=R,z=new Zt(S.x,S.y,0).unproject(E),O=Y=>{var K,ae;return(K=(ae=k.capturedMap.get(Y))==null?void 0:ae.has(P.eventObject))!=null?K:!1},A=Y=>{const K={intersection:P,target:y.target};k.capturedMap.has(Y)?k.capturedMap.get(Y).set(P.eventObject,K):k.capturedMap.set(Y,new Map([[P.eventObject,K]])),y.target.setPointerCapture(Y)},G=Y=>{const K=k.capturedMap.get(Y);K&&b1(k.capturedMap,P.eventObject,K,Y)};let F={};for(let Y in y){let K=y[Y];typeof K!="function"&&(F[Y]=K)}let Z={...P,...F,pointer:S,intersections:p,stopped:C.stopped,delta:m,unprojectedPoint:z,ray:T.ray,camera:E,stopPropagation(){const Y="pointerId"in y&&k.capturedMap.get(y.pointerId);if((!Y||Y.has(P.eventObject))&&(Z.stopped=C.stopped=!0,k.hovered.size&&Array.from(k.hovered.values()).find(K=>K.eventObject===P.eventObject))){const K=p.slice(0,p.indexOf(P));a([...K,P])}},target:{hasPointerCapture:O,setPointerCapture:A,releasePointerCapture:G},currentTarget:{hasPointerCapture:O,setPointerCapture:A,releasePointerCapture:G},nativeEvent:y};if(g(Z),C.stopped===!0)break}}return p}function a(p){const{internal:y}=e.getState();for(const m of y.hovered.values())if(!p.length||!p.find(g=>g.object===m.object&&g.index===m.index&&g.instanceId===m.instanceId)){const w=m.eventObject.__r3f,C=w==null?void 0:w.handlers;if(y.hovered.delete(za(m)),w!=null&&w.eventCount){const P={...m,intersections:p};C.onPointerOut==null||C.onPointerOut(P),C.onPointerLeave==null||C.onPointerLeave(P)}}}function c(p,y){for(let m=0;ma([]);case"onLostPointerCapture":return y=>{const{internal:m}=e.getState();"pointerId"in y&&m.capturedMap.has(y.pointerId)&&requestAnimationFrame(()=>{m.capturedMap.has(y.pointerId)&&(m.capturedMap.delete(y.pointerId),a([]))})}}return function(m){const{onPointerMissed:g,internal:w}=e.getState();w.lastEvent.current=m;const C=p==="onPointerMove",P=p==="onClick"||p==="onContextMenu"||p==="onDoubleClick",T=i(m,C?n:void 0),S=P?t(m):0;p==="onPointerDown"&&(w.initialClick=[m.offsetX,m.offsetY],w.initialHits=T.map(k=>k.eventObject)),P&&!T.length&&S<=2&&(c(m,w.interaction),g&&g(m)),C&&a(T);function E(k){const z=k.eventObject,O=z.__r3f,A=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(C){if(A.onPointerOver||A.onPointerEnter||A.onPointerOut||A.onPointerLeave){const G=za(k),F=w.hovered.get(G);F?F.stopped&&k.stopPropagation():(w.hovered.set(G,k),A.onPointerOver==null||A.onPointerOver(k),A.onPointerEnter==null||A.onPointerEnter(k))}A.onPointerMove==null||A.onPointerMove(k)}else{const G=A[p];G?(!P||w.initialHits.includes(z))&&(c(m,w.interaction.filter(F=>!w.initialHits.includes(F))),G(k)):P&&w.initialHits.includes(z)&&c(m,w.interaction.filter(F=>!w.initialHits.includes(F)))}}o(T,m,S,E)}}return{handlePointer:d}}const W_=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],ey=e=>!!(e!=null&&e.render),Zp=L.createContext(null),Q_=(e,t)=>{const n=A1((d,p)=>{const y=new Zt,m=new Zt,g=new Zt;function w(S=p().camera,E=m,k=p().size){const{width:z,height:O,top:A,left:G}=k,F=z/O;E instanceof Zt?g.copy(E):g.set(...E);const Z=S.getWorldPosition(y).distanceTo(g);if(Z1(S))return{width:z/S.zoom,height:O/S.zoom,top:A,left:G,factor:1,distance:Z,aspect:F};{const Y=S.fov*Math.PI/180,K=2*Math.tan(Y/2)*Z,ae=K*(z/O);return{width:ae,height:K,top:A,left:G,factor:z/ae,distance:Z,aspect:F}}}let C;const P=S=>d(E=>({performance:{...E.performance,current:S}})),R=new S0;return{set:d,get:p,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(S=1)=>e(p(),S),advance:(S,E)=>t(S,E,p()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new _w,pointer:R,mouse:R,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const S=p();C&&clearTimeout(C),S.performance.current!==S.performance.min&&P(S.performance.min),C=setTimeout(()=>P(p().performance.max),S.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:w},setEvents:S=>d(E=>({...E,events:{...E.events,...S}})),setSize:(S,E,k,z,O)=>{const A=p().camera,G={width:S,height:E,top:z||0,left:O||0,updateStyle:k};d(F=>({size:G,viewport:{...F.viewport,...w(A,m,G)}}))},setDpr:S=>d(E=>{const k=J1(S);return{viewport:{...E.viewport,dpr:k,initialDpr:E.viewport.initialDpr||k}}}),setFrameloop:(S="always")=>{const E=p().clock;E.stop(),E.elapsedTime=0,S!=="never"&&(E.start(),E.elapsedTime=0),d(()=>({frameloop:S}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:L.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(S,E,k)=>{const z=p().internal;return z.priority=z.priority+(E>0?1:0),z.subscribers.push({ref:S,priority:E,store:k}),z.subscribers=z.subscribers.sort((O,A)=>O.priority-A.priority),()=>{const O=p().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(E>0?1:0),O.subscribers=O.subscribers.filter(A=>A.ref!==S))}}}}}),i=n.getState();let o=i.size,a=i.viewport.dpr,c=i.camera;return n.subscribe(()=>{const{camera:d,size:p,viewport:y,gl:m,set:g}=n.getState();if(p.width!==o.width||p.height!==o.height||y.dpr!==a){var w;o=p,a=y.dpr,q1(d,p),m.setPixelRatio(y.dpr);const C=(w=p.updateStyle)!=null?w:typeof HTMLCanvasElement<"u"&&m.domElement instanceof HTMLCanvasElement;m.setSize(p.width,p.height,C)}d!==c&&(c=d,g(C=>({viewport:{...C.viewport,...C.viewport.getCurrentViewport(d)}})))}),n.subscribe(d=>e(d)),n};let Ia,V_=new Set,G_=new Set,Z_=new Set;function jf(e,t){if(e.size)for(const{callback:n}of e.values())n(t)}function So(e,t){switch(e){case"before":return jf(V_,t);case"after":return jf(G_,t);case"tail":return jf(Z_,t)}}let Hf,Wf;function Qf(e,t,n){let i=t.clock.getDelta();for(t.frameloop==="never"&&typeof e=="number"&&(i=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),Hf=t.internal.subscribers,Ia=0;Ia0)&&!((m=a.gl.xr)!=null&&m.isPresenting)&&(i+=Qf(y,a))}if(n=!1,So("after",y),i===0)return So("tail",y),t=!1,cancelAnimationFrame(o)}function d(y,m=1){var g;if(!y)return e.forEach(w=>d(w.store.getState(),m));(g=y.gl.xr)!=null&&g.isPresenting||!y.internal.active||y.frameloop==="never"||(m>1?y.internal.frames=Math.min(60,y.internal.frames+m):n?y.internal.frames=2:y.internal.frames=1,t||(t=!0,requestAnimationFrame(c)))}function p(y,m=!0,g,w){if(m&&So("before",y),g)Qf(y,g,w);else for(const C of e.values())Qf(y,C.store.getState());m&&So("after",y)}return{loop:c,invalidate:d,advance:p}}function Xp(){const e=L.useContext(Zp);if(!e)throw new Error("R3F: Hooks can only be used within the Canvas component!");return e}function ot(e=n=>n,t){return Xp()(e,t)}function Hi(e,t=0){const n=Xp(),i=n.getState().internal.subscribe,o=X1(e);return au(()=>i(o,t,n),[t,i,n]),null}const $m=new WeakMap;function ty(e,t){return function(n,...i){let o=$m.get(n);return o||(o=new n,$m.set(n,o)),e&&e(o),Promise.all(i.map(a=>new Promise((c,d)=>o.load(a,p=>{p.scene&&Object.assign(p,D_(p.scene)),c(p)},t,p=>d(new Error(`Could not load ${a}: ${p==null?void 0:p.message}`))))))}}function Di(e,t,n,i){const o=Array.isArray(t)?t:[t],a=P_(ty(n,i),[e,...o],{equal:$e.equ});return Array.isArray(t)?a:a[0]}Di.preload=function(e,t,n){const i=Array.isArray(t)?t:[t];return M_(ty(n),[e,...i])};Di.clear=function(e,t){const n=Array.isArray(t)?t:[t];return R_([e,...n])};const Ui=new Map,{invalidate:qm,advance:bm}=X_(Ui),{reconciler:tu,applyProps:Wr}=I_(Ui,B_),ni={objects:"shallow",strict:!1},Y_=(e,t)=>{const n=typeof e=="function"?e(t):e;return ey(n)?n:new E0({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...e})};function K_(e,t){const n=typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement;if(t){const{width:i,height:o,top:a,left:c,updateStyle:d=n}=t;return{width:i,height:o,top:a,left:c,updateStyle:d}}else if(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&e.parentElement){const{width:i,height:o,top:a,left:c}=e.parentElement.getBoundingClientRect();return{width:i,height:o,top:a,left:c,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function J_(e){const t=Ui.get(e),n=t==null?void 0:t.fiber,i=t==null?void 0:t.store;t&&console.warn("R3F.createRoot should only be called once!");const o=typeof reportError=="function"?reportError:console.error,a=i||Q_(qm,bm),c=n||tu.createContainer(a,Si.ConcurrentRoot,null,!1,null,"",o,null);t||Ui.set(e,{fiber:c,store:a});let d,p=!1,y;return{configure(m={}){let{gl:g,size:w,scene:C,events:P,onCreated:R,shadows:T=!1,linear:S=!1,flat:E=!1,legacy:k=!1,orthographic:z=!1,frameloop:O="always",dpr:A=[1,2],performance:G,raycaster:F,camera:Z,onPointerMissed:Y}=m,K=a.getState(),ae=K.gl;K.gl||K.set({gl:ae=Y_(g,e)});let he=K.raycaster;he||K.set({raycaster:he=new y0});const{params:de,...ze}=F||{};if($e.equ(ze,he,ni)||Wr(he,{...ze}),$e.equ(de,he.params,ni)||Wr(he,{params:{...he.params,...de}}),!K.camera||K.camera===y&&!$e.equ(y,Z,ni)){y=Z;const V=Z instanceof yw,le=V?Z:z?new w0(0,0,0,0,.1,1e3):new dw(75,0,.1,1e3);V||(le.position.z=5,Z&&(Wr(le,Z),("aspect"in Z||"left"in Z||"right"in Z||"bottom"in Z||"top"in Z)&&(le.manual=!0,le.updateProjectionMatrix())),!K.camera&&!(Z!=null&&Z.rotation)&&le.lookAt(0,0,0)),K.set({camera:le}),he.camera=le}if(!K.scene){let V;C instanceof Uo?V=C:(V=new Uo,C&&Wr(V,C)),K.set({scene:ii(V)})}if(!K.xr){var ye;const V=(we,Ue)=>{const ft=a.getState();ft.frameloop!=="never"&&bm(we,!0,ft,Ue)},le=()=>{const we=a.getState();we.gl.xr.enabled=we.gl.xr.isPresenting,we.gl.xr.setAnimationLoop(we.gl.xr.isPresenting?V:null),we.gl.xr.isPresenting||qm(we)},ie={connect(){const we=a.getState().gl;we.xr.addEventListener("sessionstart",le),we.xr.addEventListener("sessionend",le)},disconnect(){const we=a.getState().gl;we.xr.removeEventListener("sessionstart",le),we.xr.removeEventListener("sessionend",le)}};typeof((ye=ae.xr)==null?void 0:ye.addEventListener)=="function"&&ie.connect(),K.set({xr:ie})}if(ae.shadowMap){const V=ae.shadowMap.enabled,le=ae.shadowMap.type;if(ae.shadowMap.enabled=!!T,$e.boo(T))ae.shadowMap.type=cf;else if($e.str(T)){var Ke;const ie={basic:ww,percentage:Sw,soft:cf,variance:Ew};ae.shadowMap.type=(Ke=ie[T])!=null?Ke:cf}else $e.obj(T)&&Object.assign(ae.shadowMap,T);(V!==ae.shadowMap.enabled||le!==ae.shadowMap.type)&&(ae.shadowMap.needsUpdate=!0)}const U=G1();U&&("enabled"in U?U.enabled=!k:"legacyMode"in U&&(U.legacyMode=k)),p||Wr(ae,{outputEncoding:S?3e3:3001,toneMapping:E?pw:vw}),K.legacy!==k&&K.set(()=>({legacy:k})),K.linear!==S&&K.set(()=>({linear:S})),K.flat!==E&&K.set(()=>({flat:E})),g&&!$e.fun(g)&&!ey(g)&&!$e.equ(g,ae,ni)&&Wr(ae,g),P&&!K.events.handlers&&K.set({events:P(a)});const X=K_(e,w);return $e.equ(X,K.size,ni)||K.setSize(X.width,X.height,X.updateStyle,X.top,X.left),A&&K.viewport.dpr!==J1(A)&&K.setDpr(A),K.frameloop!==O&&K.setFrameloop(O),K.onPointerMissed||K.set({onPointerMissed:Y}),G&&!$e.equ(G,K.performance,ni)&&K.set(V=>({performance:{...V.performance,...G}})),d=R,p=!0,this},render(m){return p||this.configure(),tu.updateContainer(lt.jsx($_,{store:a,children:m,onCreated:d,rootElement:e}),c,null,()=>{}),a},unmount(){ny(e)}}}function $_({store:e,children:t,onCreated:n,rootElement:i}){return au(()=>{const o=e.getState();o.set(a=>({internal:{...a.internal,active:!0}})),n&&n(o),e.getState().events.connected||o.events.connect==null||o.events.connect(i)},[]),lt.jsx(Zp.Provider,{value:e,children:t})}function ny(e,t){const n=Ui.get(e),i=n==null?void 0:n.fiber;if(i){const o=n==null?void 0:n.store.getState();o&&(o.internal.active=!1),tu.updateContainer(null,i,null,()=>{o&&setTimeout(()=>{try{var a,c,d,p;o.events.disconnect==null||o.events.disconnect(),(a=o.gl)==null||(c=a.renderLists)==null||c.dispose==null||c.dispose(),(d=o.gl)==null||d.forceContextLoss==null||d.forceContextLoss(),(p=o.gl)!=null&&p.xr&&o.xr.disconnect(),U_(o),Ui.delete(e)}catch{}},500)})}}function ry(e,t,n){return lt.jsx(q_,{children:e,container:t,state:n},t.uuid)}function q_({state:e={},children:t,container:n}){const{events:i,size:o,...a}=e,c=Xp(),[d]=L.useState(()=>new y0),[p]=L.useState(()=>new S0),y=L.useCallback((g,w)=>{const C={...g};Object.keys(g).forEach(R=>{(W_.includes(R)||g[R]!==w[R]&&w[R])&&delete C[R]});let P;if(w&&o){const R=w.camera;P=g.viewport.getCurrentViewport(R,new Zt,o),R!==g.camera&&q1(R,o)}return{...C,scene:n,raycaster:d,pointer:p,mouse:p,previousRoot:c,events:{...g.events,...w==null?void 0:w.events,...i},size:{...g.size,...o},viewport:{...g.viewport,...P},...a}},[e]),[m]=L.useState(()=>{const g=c.getState();return A1((C,P)=>({...g,scene:n,raycaster:d,pointer:p,mouse:p,previousRoot:c,events:{...g.events,...i},size:{...g.size,...o},...a,set:C,get:P,setEvents:R=>C(T=>({...T,events:{...T.events,...R}}))}))});return L.useEffect(()=>{const g=c.subscribe(w=>m.setState(C=>y(w,C)));return()=>{g()}},[y]),L.useEffect(()=>{m.setState(g=>y(c.getState(),g))},[y]),L.useEffect(()=>()=>{m.destroy()},[]),lt.jsx(lt.Fragment,{children:tu.createPortal(lt.jsx(Zp.Provider,{value:m,children:t}),m,null)})}tu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:L.version});const Vf={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]};function b_(e){const{handlePointer:t}=H_(e);return{priority:1,enabled:!0,compute(n,i,o){i.pointer.set(n.offsetX/i.size.width*2-1,-(n.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(Vf).reduce((n,i)=>({...n,[i]:t(i)}),{}),update:()=>{var n;const{events:i,internal:o}=e.getState();(n=o.lastEvent)!=null&&n.current&&i.handlers&&i.handlers.onPointerMove(o.lastEvent.current)},connect:n=>{var i;const{set:o,events:a}=e.getState();a.disconnect==null||a.disconnect(),o(c=>({events:{...c.events,connected:n}})),Object.entries((i=a.handlers)!=null?i:[]).forEach(([c,d])=>{const[p,y]=Vf[c];n.addEventListener(p,d,{passive:y})})},disconnect:()=>{const{set:n,events:i}=e.getState();if(i.connected){var o;Object.entries((o=i.handlers)!=null?o:[]).forEach(([a,c])=>{if(i&&i.connected instanceof HTMLElement){const[d]=Vf[a];i.connected.removeEventListener(d,c)}}),n(a=>({events:{...a.events,connected:void 0}}))}}}}function Gd(e,t,n){var i,o,a,c,d;t==null&&(t=100);function p(){var m=Date.now()-c;m=0?i=setTimeout(p,t-m):(i=null,n||(d=e.apply(a,o),a=o=null))}var y=function(){a=this,o=arguments,c=Date.now();var m=n&&!i;return i||(i=setTimeout(p,t)),m&&(d=e.apply(a,o),a=o=null),d};return y.clear=function(){i&&(clearTimeout(i),i=null)},y.flush=function(){i&&(d=e.apply(a,o),a=o=null,clearTimeout(i),i=null)},y}Gd.debounce=Gd;var e2=Gd;const e0=Es(e2);var t2=Object.defineProperty,n2=Object.defineProperties,r2=Object.getOwnPropertyDescriptors,t0=Object.getOwnPropertySymbols,l2=Object.prototype.hasOwnProperty,i2=Object.prototype.propertyIsEnumerable,n0=(e,t,n)=>t in e?t2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r0=(e,t)=>{for(var n in t||(t={}))l2.call(t,n)&&n0(e,n,t[n]);if(t0)for(var n of t0(t))i2.call(t,n)&&n0(e,n,t[n]);return e},o2=(e,t)=>n2(e,r2(t)),l0,i0;typeof window<"u"&&((l0=window.document)!=null&&l0.createElement||((i0=window.navigator)==null?void 0:i0.product)==="ReactNative")?L.useLayoutEffect:L.useEffect;function ly(e,t,n){if(!e)return;if(n(e)===!0)return e;let i=e.child;for(;i;){const o=ly(i,t,n);if(o)return o;i=i.sibling}}function iy(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const o0=console.error;console.error=function(){const e=[...arguments].join("");if(e!=null&&e.startsWith("Warning:")&&e.includes("useContext")){console.error=o0;return}return o0.apply(this,arguments)};const Yp=iy(L.createContext(null));class oy extends L.Component{render(){return L.createElement(Yp.Provider,{value:this._reactInternals},this.props.children)}}function u2(){const e=L.useContext(Yp);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=L.useId();return L.useMemo(()=>{for(const i of[e,e==null?void 0:e.alternate]){if(!i)continue;const o=ly(i,!1,a=>{let c=a.memoizedState;for(;c;){if(c.memoizedState===t)return!0;c=c.next}});if(o)return o}},[e,t])}function a2(){const e=u2(),[t]=L.useState(()=>new Map);t.clear();let n=e;for(;n;){if(n.type&&typeof n.type=="object"){const o=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;o&&o!==Yp&&!t.has(o)&&t.set(o,L.useContext(iy(o)))}n=n.return}return t}function s2(){const e=a2();return L.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>i=>L.createElement(t,null,L.createElement(n.Provider,o2(r0({},i),{value:e.get(n)}))),t=>L.createElement(oy,r0({},t))),[e])}function c2({debounce:e,scroll:t,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const o=n||typeof window<"u"&&window.ResizeObserver,[a,c]=L.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0});if(!o)return a.width=1280,a.height=800,[()=>{},a,()=>{}];const d=L.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a,orientationHandler:null}),p=e?typeof e=="number"?e:e.scroll:null,y=e?typeof e=="number"?e:e.resize:null,m=L.useRef(!1);L.useEffect(()=>(m.current=!0,()=>void(m.current=!1)));const[g,w,C]=L.useMemo(()=>{const S=()=>{if(!d.current.element)return;const{left:E,top:k,width:z,height:O,bottom:A,right:G,x:F,y:Z}=d.current.element.getBoundingClientRect(),Y={left:E,top:k,width:z,height:O,bottom:A,right:G,x:F,y:Z};d.current.element instanceof HTMLElement&&i&&(Y.height=d.current.element.offsetHeight,Y.width=d.current.element.offsetWidth),Object.freeze(Y),m.current&&!v2(d.current.lastBounds,Y)&&c(d.current.lastBounds=Y)};return[S,y?e0(S,y):S,p?e0(S,p):S]},[c,i,p,y]);function P(){d.current.scrollContainers&&(d.current.scrollContainers.forEach(S=>S.removeEventListener("scroll",C,!0)),d.current.scrollContainers=null),d.current.resizeObserver&&(d.current.resizeObserver.disconnect(),d.current.resizeObserver=null),d.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",d.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",d.current.orientationHandler))}function R(){var S;d.current.element&&(d.current.resizeObserver=new o(w),(S=d.current.resizeObserver)==null||S.observe(d.current.element),t&&d.current.scrollContainers&&d.current.scrollContainers.forEach(E=>E.addEventListener("scroll",C,{capture:!0,passive:!0})),d.current.orientationHandler=()=>{C()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",d.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",d.current.orientationHandler))}const T=S=>{!S||S===d.current.element||(P(),d.current.element=S,d.current.scrollContainers=uy(S),R())};return d2(C,!!t),f2(w),L.useEffect(()=>{P(),R()},[t,C,w]),L.useEffect(()=>P,[]),[T,a,g]}function f2(e){L.useEffect(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function d2(e,t){L.useEffect(()=>{if(t){const n=e;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[e,t])}function uy(e){const t=[];if(!e||e===document.body)return t;const{overflow:n,overflowX:i,overflowY:o}=window.getComputedStyle(e);return[n,i,o].some(a=>a==="auto"||a==="scroll")&&t.push(e),[...t,...uy(e.parentElement)]}const p2=["x","y","top","bottom","left","right","width","height"],v2=(e,t)=>p2.every(n=>e[n]===t[n]),h2=L.forwardRef(function({children:t,fallback:n,resize:i,style:o,gl:a,events:c=b_,eventSource:d,eventPrefix:p,shadows:y,linear:m,flat:g,legacy:w,orthographic:C,frameloop:P,dpr:R,performance:T,raycaster:S,camera:E,scene:k,onPointerMissed:z,onCreated:O,...A},G){L.useMemo(()=>V1(kw),[]);const F=s2(),[Z,Y]=c2({scroll:!0,debounce:{scroll:50,resize:0},...i}),K=L.useRef(null),ae=L.useRef(null);L.useImperativeHandle(G,()=>K.current);const he=X1(z),[de,ze]=L.useState(!1),[ye,Ke]=L.useState(!1);if(de)throw de;if(ye)throw ye;const U=L.useRef(null);au(()=>{const V=K.current;Y.width>0&&Y.height>0&&V&&(U.current||(U.current=J_(V)),U.current.configure({gl:a,events:c,shadows:y,linear:m,flat:g,legacy:w,orthographic:C,frameloop:P,dpr:R,performance:T,raycaster:S,camera:E,scene:k,size:Y,onPointerMissed:(...le)=>he.current==null?void 0:he.current(...le),onCreated:le=>{le.events.connect==null||le.events.connect(d?L_(d)?d.current:d:ae.current),p&&le.setEvents({compute:(ie,we)=>{const Ue=ie[p+"X"],ft=ie[p+"Y"];we.pointer.set(Ue/we.size.width*2-1,-(ft/we.size.height)*2+1),we.raycaster.setFromCamera(we.pointer,we.camera)}}),O==null||O(le)}}),U.current.render(lt.jsx(F,{children:lt.jsx(Y1,{set:Ke,children:lt.jsx(L.Suspense,{fallback:lt.jsx(O_,{set:ze}),children:t})})})))}),L.useEffect(()=>{const V=K.current;if(V)return()=>ny(V)},[]);const X=d?"none":"auto";return lt.jsx("div",{ref:ae,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:X,...o},...A,children:lt.jsx("div",{ref:Z,style:{width:"100%",height:"100%"},children:lt.jsx("canvas",{ref:K,style:{display:"block"},children:n})})})}),p3=L.forwardRef(function(t,n){return lt.jsx(oy,{children:lt.jsx(h2,{...t,ref:n})})});function zn(){return zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t>>1|(et&21845)<<1;Br=(Br&52428)>>>2|(Br&13107)<<2,Br=(Br&61680)>>>4|(Br&3855)<<4,Xd[et]=((Br&65280)>>>8|(Br&255)<<8)>>>1}var Do=function(e,t,n){for(var i=e.length,o=0,a=new Kr(t);o>>p]=y}else for(d=new Kr(i),o=0;o>>15-e[o]);return d},su=new On(288);for(var et=0;et<144;++et)su[et]=8;for(var et=144;et<256;++et)su[et]=9;for(var et=256;et<280;++et)su[et]=7;for(var et=280;et<288;++et)su[et]=8;var py=new On(32);for(var et=0;et<32;++et)py[et]=5;var S2=Do(su,9,1),E2=Do(py,5,1),Gf=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},Gn=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&n},Zf=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},_2=function(e){return(e/8|0)+(e&7&&1)},k2=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof Kr?Kr:e instanceof Zd?Zd:On)(n-t);return i.set(e.subarray(t,n)),i},x2=function(e,t,n){var i=e.length;if(!i||n&&!n.l&&i<5)return t||new On(0);var o=!t||n,a=!n||n.i;n||(n={}),t||(t=new On(i*3));var c=function(Ee){var dt=t.length;if(Ee>dt){var jn=new On(Math.max(dt*2,Ee));jn.set(t),t=jn}},d=n.f||0,p=n.p||0,y=n.b||0,m=n.l,g=n.d,w=n.m,C=n.n,P=i*8;do{if(!m){n.f=d=Gn(e,p,1);var R=Gn(e,p+1,3);if(p+=3,R)if(R==1)m=S2,g=E2,w=9,C=5;else if(R==2){var k=Gn(e,p,31)+257,z=Gn(e,p+10,15)+4,O=k+Gn(e,p+5,31)+1;p+=14;for(var A=new On(O),G=new On(19),F=0;F>>4;if(T<16)A[F++]=T;else{var he=0,de=0;for(T==16?(de=3+Gn(e,p,3),p+=2,he=A[F-1]):T==17?(de=3+Gn(e,p,7),p+=3):T==18&&(de=11+Gn(e,p,127),p+=7);de--;)A[F++]=he}}var ze=A.subarray(0,k),ye=A.subarray(k);w=Gf(ze),C=Gf(ye),m=Do(ze,w,1),g=Do(ye,C,1)}else throw"invalid block type";else{var T=_2(p)+4,S=e[T-4]|e[T-3]<<8,E=T+S;if(E>i){if(a)throw"unexpected EOF";break}o&&c(y+S),t.set(e.subarray(T,E),y),n.b=y+=S,n.p=p=E*8;continue}if(p>P){if(a)throw"unexpected EOF";break}}o&&c(y+131072);for(var Ke=(1<>>4;if(p+=he&15,p>P){if(a)throw"unexpected EOF";break}if(!he)throw"invalid length/literal";if(V<256)t[y++]=V;else if(V==256){X=p,m=null;break}else{var le=V-254;if(V>264){var F=V-257,ie=ay[F];le=Gn(e,p,(1<>>4;if(!we)throw"invalid distance";p+=we&15;var ye=w2[Ue];if(Ue>3){var ie=sy[Ue];ye+=Zf(e,p)&(1<P){if(a)throw"unexpected EOF";break}o&&c(y+131072);for(var ft=y+le;y>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(e[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function La(e,t){return x2((P2(e),e.subarray(2,-4)),t)}var M2=typeof TextDecoder<"u"&&new TextDecoder,R2=0;try{M2.decode(C2,{stream:!0}),R2=1}catch{}const T2=e=>e&&e.isCubeTexture;class N2 extends Yd{constructor(t,n){var i,o;const a=T2(t),d=((o=a?(i=t.image[0])==null?void 0:i.width:t.image.width)!=null?o:1024)/4,p=Math.floor(Math.log2(d)),y=Math.pow(2,p),m=3*Math.max(y,16*7),g=4*y,w=[a?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/g}`,`#define CUBEUV_MAX_MIP ${p}.0`],C=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,P=w.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${parseInt(Pw.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,R={map:{value:t},height:{value:(n==null?void 0:n.height)||15},radius:{value:(n==null?void 0:n.radius)||100}},T=new xw(1,16),S=new Kd({uniforms:R,fragmentShader:P,vertexShader:C,side:Cw});super(T,S)}set radius(t){this.material.uniforms.radius.value=t}get radius(){return this.material.uniforms.radius.value}set height(t){this.material.uniforms.height.value=t}get height(){return this.material.uniforms.height.value}}class z2 extends _0{constructor(t){super(t),this.type=gn}parse(t){const c=function(F,Z){switch(F){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(Z||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(Z||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(Z||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(Z||""))}},m=` +`,g=function(F,Z,Y){Z=Z||1024;let ae=F.pos,he=-1,de=0,ze="",ye=String.fromCharCode.apply(null,new Uint16Array(F.subarray(ae,ae+128)));for(;0>(he=ye.indexOf(m))&&de=F.byteLength||!(ze=g(F)))&&c(1,"no header found"),(ye=ze.match(Z))||c(3,"bad initial token"),de.valid|=1,de.programtype=ye[1],de.string+=ze+` +`;ze=g(F),ze!==!1;){if(de.string+=ze+` +`,ze.charAt(0)==="#"){de.comments+=ze+` +`;continue}if((ye=ze.match(Y))&&(de.gamma=parseFloat(ye[1])),(ye=ze.match(K))&&(de.exposure=parseFloat(ye[1])),(ye=ze.match(ae))&&(de.valid|=2,de.format=ye[1]),(ye=ze.match(he))&&(de.valid|=4,de.height=parseInt(ye[1],10),de.width=parseInt(ye[2],10)),de.valid&2&&de.valid&4)break}return de.valid&2||c(3,"missing format specifier"),de.valid&4||c(3,"missing image size specifier"),de},C=function(F,Z,Y){const K=Z;if(K<8||K>32767||F[0]!==2||F[1]!==2||F[2]&128)return new Uint8Array(F);K!==(F[2]<<8|F[3])&&c(3,"wrong scanline width");const ae=new Uint8Array(4*Z*Y);ae.length||c(4,"unable to allocate buffer space");let he=0,de=0;const ze=4*K,ye=new Uint8Array(4),Ke=new Uint8Array(ze);let U=Y;for(;U>0&&deF.byteLength&&c(1),ye[0]=F[de++],ye[1]=F[de++],ye[2]=F[de++],ye[3]=F[de++],(ye[0]!=2||ye[1]!=2||(ye[2]<<8|ye[3])!=K)&&c(3,"bad rgbe scanline format");let X=0,V;for(;X128;if(ie&&(V-=128),(V===0||X+V>ze)&&c(3,"bad scanline data"),ie){const we=F[de++];for(let Ue=0;Ue>3]&1<<(B&7))&&(_[M++]=B);for(var H=M-1;M<65536;)_[M++]=0;return H}function K(h){for(var _=0;_<16384;_++)h[_]={},h[_].len=0,h[_].lit=0,h[_].p=null}const ae={l:0,c:0,lc:0};function he(h,_,M,B,H){for(;M>M&(1<0;--_){var B=M+de[_]>>1;de[_]=M,M=B}for(var _=0;_<65537;++_){var H=h[_];H>0&&(h[_]=H|de[H]++<<6)}}function ye(h,_,M,B,H,W,q){for(var J=M,ne=0,te=0;H<=W;H++){if(J.value-M.value>B)return!1;he(6,ne,te,h,J);var re=ae.l;if(ne=ae.c,te=ae.lc,q[H]=re,re==63){if(J.value-M.value>B)throw"Something wrong with hufUnpackEncTable";he(8,ne,te,h,J);var ee=ae.l+6;if(ne=ae.c,te=ae.lc,H+ee>W+1)throw"Something wrong with hufUnpackEncTable";for(;ee--;)q[H++]=0;H--}else if(re>=59){var ee=re-59+2;if(H+ee>W+1)throw"Something wrong with hufUnpackEncTable";for(;ee--;)q[H++]=0;H--}}ze(q)}function Ke(h){return h&63}function U(h){return h>>6}function X(h,_,M,B){for(;_<=M;_++){var H=U(h[_]),W=Ke(h[_]);if(H>>W)throw"Invalid table entry";if(W>14){var q=B[H>>W-14];if(q.len)throw"Invalid table entry";if(q.lit++,q.p){var J=q.p;q.p=new Array(q.lit);for(var ne=0;ne0;ne--){var q=B[(H<<14-W)+te];if(q.len||q.p)throw"Invalid table entry";q.len=W,q.lit=_,te++}}return!0}const V={c:0,lc:0};function le(h,_,M,B){h=h<<8|hu(M,B),_+=8,V.c=h,V.lc=_}const ie={c:0,lc:0};function we(h,_,M,B,H,W,q,J,ne,te){if(h==_){B<8&&(le(M,B,H,q),M=V.c,B=V.lc),B-=8;var re=M>>B,re=new Uint8Array([re])[0];if(ne.value+re>te)return!1;for(var ee=J[ne.value-1];re-- >0;)J[ne.value++]=ee}else if(ne.value32767?_-65536:_}const Ee={a:0,b:0};function dt(h,_){var M=ft(h),B=ft(_),H=B,W=M+(H&1)+(H>>1),q=W,J=W-H;Ee.a=q,Ee.b=J}function jn(h,_){var M=Ue(h),B=Ue(_),H=M-(B>>1)&65535,W=B+H-32768&65535;Ee.a=W,Ee.b=H}function Wi(h,_,M,B,H,W,q){for(var J=q<16384,ne=M>H?H:M,te=1,re;te<=ne;)te<<=1;for(te>>=1,re=te,te>>=1;te>=1;){for(var ee=0,Ve=ee+W*(H-re),pe=W*te,me=W*re,ke=B*te,Pe=B*re,De,Oe,_e,Me;ee<=Ve;ee+=me){for(var Fe=ee,Xe=ee+B*(M-re);Fe<=Xe;Fe+=Pe){var Re=Fe+ke,Je=Fe+pe,At=Je+ke;J?(dt(h[Fe+_],h[Je+_]),De=Ee.a,_e=Ee.b,dt(h[Re+_],h[At+_]),Oe=Ee.a,Me=Ee.b,dt(De,Oe),h[Fe+_]=Ee.a,h[Re+_]=Ee.b,dt(_e,Me),h[Je+_]=Ee.a,h[At+_]=Ee.b):(jn(h[Fe+_],h[Je+_]),De=Ee.a,_e=Ee.b,jn(h[Re+_],h[At+_]),Oe=Ee.a,Me=Ee.b,jn(De,Oe),h[Fe+_]=Ee.a,h[Re+_]=Ee.b,jn(_e,Me),h[Je+_]=Ee.a,h[At+_]=Ee.b)}if(M&te){var Je=Fe+pe;J?dt(h[Fe+_],h[Je+_]):jn(h[Fe+_],h[Je+_]),De=Ee.a,h[Je+_]=Ee.b,h[Fe+_]=De}}if(H&te)for(var Fe=ee,Xe=ee+B*(M-re);Fe<=Xe;Fe+=Pe){var Re=Fe+ke;J?dt(h[Fe+_],h[Re+_]):jn(h[Fe+_],h[Re+_]),De=Ee.a,h[Re+_]=Ee.b,h[Fe+_]=De}re=te,te>>=1}return ee}function jl(h,_,M,B,H,W,q,J,ne,te){for(var re=0,ee=0,Ve=J,pe=Math.trunc(H.value+(W+7)/8);H.value=14;){var me=re>>ee-14&16383,ke=_[me];if(ke.len)ee-=ke.len,we(ke.lit,q,re,ee,M,B,H,ne,te,Ve),re=ie.c,ee=ie.lc;else{if(!ke.p)throw"hufDecode issues";var Pe;for(Pe=0;Pe=De&&U(h[ke.p[Pe]])==(re>>ee-De&(1<>=Oe,ee-=Oe;ee>0;){var ke=_[re<<14-ee&16383];if(ke.len)ee-=ke.len,we(ke.lit,q,re,ee,M,B,H,ne,te,Ve),re=ie.c,ee=ie.lc;else throw"hufDecode issues"}return!0}function nn(h,_,M,B,H,W){var q={value:0},J=M.value,ne=Ut(_,M),te=Ut(_,M);M.value+=4;var re=Ut(_,M);if(M.value+=4,ne<0||ne>=65537||te<0||te>=65537)throw"Something wrong with HUF_ENCSIZE";var ee=new Array(65537),Ve=new Array(16384);K(Ve);var pe=B-(M.value-J);if(ye(h,_,M,pe,ne,te,ee),re>8*(B-(M.value-J)))throw"Something wrong with hufUncompress";X(ee,ne,te,Ve),jl(ee,Ve,h,_,M,re,te,W,H,q)}function Hl(h,_,M){for(var B=0;BW||(_[H++]=h[M++],H>W));)_[H++]=h[B++]}function du(h){for(var _=h.byteLength,M=new Array,B=0,H=new DataView(h);_>0;){var W=H.getInt8(B++);if(W<0){var q=-W;_-=q+1;for(var J=0;J>8==255?H+=B&255:(M[H]=B,H++),h.value++}function Hs(h,_){_[0]=se(h[0]),_[1]=se(h[1]),_[2]=se(h[5]),_[3]=se(h[6]),_[4]=se(h[14]),_[5]=se(h[15]),_[6]=se(h[27]),_[7]=se(h[28]),_[8]=se(h[2]),_[9]=se(h[4]),_[10]=se(h[7]),_[11]=se(h[13]),_[12]=se(h[16]),_[13]=se(h[26]),_[14]=se(h[29]),_[15]=se(h[42]),_[16]=se(h[3]),_[17]=se(h[8]),_[18]=se(h[12]),_[19]=se(h[17]),_[20]=se(h[25]),_[21]=se(h[30]),_[22]=se(h[41]),_[23]=se(h[43]),_[24]=se(h[9]),_[25]=se(h[11]),_[26]=se(h[18]),_[27]=se(h[24]),_[28]=se(h[31]),_[29]=se(h[40]),_[30]=se(h[44]),_[31]=se(h[53]),_[32]=se(h[10]),_[33]=se(h[19]),_[34]=se(h[23]),_[35]=se(h[32]),_[36]=se(h[39]),_[37]=se(h[45]),_[38]=se(h[52]),_[39]=se(h[54]),_[40]=se(h[20]),_[41]=se(h[22]),_[42]=se(h[33]),_[43]=se(h[38]),_[44]=se(h[46]),_[45]=se(h[51]),_[46]=se(h[55]),_[47]=se(h[60]),_[48]=se(h[21]),_[49]=se(h[34]),_[50]=se(h[37]),_[51]=se(h[47]),_[52]=se(h[50]),_[53]=se(h[56]),_[54]=se(h[59]),_[55]=se(h[61]),_[56]=se(h[35]),_[57]=se(h[36]),_[58]=se(h[48]),_[59]=se(h[49]),_[60]=se(h[57]),_[61]=se(h[58]),_[62]=se(h[62]),_[63]=se(h[63])}function Ws(h){const _=.5*Math.cos(.7853975),M=.5*Math.cos(3.14159/16),B=.5*Math.cos(3.14159/8),H=.5*Math.cos(3*3.14159/16),W=.5*Math.cos(5*3.14159/16),q=.5*Math.cos(3*3.14159/8),J=.5*Math.cos(7*3.14159/16);for(var ne=new Array(4),te=new Array(4),re=new Array(4),ee=new Array(4),Ve=0;Ve<8;++Ve){var pe=Ve*8;ne[0]=B*h[pe+2],ne[1]=q*h[pe+2],ne[2]=B*h[pe+6],ne[3]=q*h[pe+6],te[0]=M*h[pe+1]+H*h[pe+3]+W*h[pe+5]+J*h[pe+7],te[1]=H*h[pe+1]-J*h[pe+3]-M*h[pe+5]-W*h[pe+7],te[2]=W*h[pe+1]-M*h[pe+3]+J*h[pe+5]+H*h[pe+7],te[3]=J*h[pe+1]-W*h[pe+3]+H*h[pe+5]-M*h[pe+7],re[0]=_*(h[pe+0]+h[pe+4]),re[3]=_*(h[pe+0]-h[pe+4]),re[1]=ne[0]+ne[3],re[2]=ne[1]-ne[2],ee[0]=re[0]+re[1],ee[1]=re[3]+re[2],ee[2]=re[3]-re[2],ee[3]=re[0]-re[1],h[pe+0]=ee[0]+te[0],h[pe+1]=ee[1]+te[1],h[pe+2]=ee[2]+te[2],h[pe+3]=ee[3]+te[3],h[pe+4]=ee[3]-te[3],h[pe+5]=ee[2]-te[2],h[pe+6]=ee[1]-te[1],h[pe+7]=ee[0]-te[0]}for(var me=0;me<8;++me)ne[0]=B*h[16+me],ne[1]=q*h[16+me],ne[2]=B*h[48+me],ne[3]=q*h[48+me],te[0]=M*h[8+me]+H*h[24+me]+W*h[40+me]+J*h[56+me],te[1]=H*h[8+me]-J*h[24+me]-M*h[40+me]-W*h[56+me],te[2]=W*h[8+me]-M*h[24+me]+J*h[40+me]+H*h[56+me],te[3]=J*h[8+me]-W*h[24+me]+H*h[40+me]-M*h[56+me],re[0]=_*(h[me]+h[32+me]),re[3]=_*(h[me]-h[32+me]),re[1]=ne[0]+ne[3],re[2]=ne[1]-ne[2],ee[0]=re[0]+re[1],ee[1]=re[3]+re[2],ee[2]=re[3]-re[2],ee[3]=re[0]-re[1],h[0+me]=ee[0]+te[0],h[8+me]=ee[1]+te[1],h[16+me]=ee[2]+te[2],h[24+me]=ee[3]+te[3],h[32+me]=ee[3]-te[3],h[40+me]=ee[2]-te[2],h[48+me]=ee[1]-te[1],h[56+me]=ee[0]-te[0]}function sl(h){for(var _=0;_<64;++_){var M=h[0][_],B=h[1][_],H=h[2][_];h[0][_]=M+1.5747*H,h[1][_]=M-.1873*B-.4682*H,h[2][_]=M+1.8556*B}}function Qs(h,_,M){for(var B=0;B<64;++B)_[M+B]=ui.toHalfFloat(Vs(h[B]))}function Vs(h){return h<=1?Math.sign(h)*Math.pow(Math.abs(h),2.2):Math.sign(h)*Math.pow(Z,Math.abs(h)-1)}function pu(h){return new DataView(h.array.buffer,h.offset.value,h.size)}function cl(h){var _=h.viewer.buffer.slice(h.offset.value,h.offset.value+h.size),M=new Uint8Array(du(_)),B=new Uint8Array(M.length);return Dt(M),fu(M,B),new DataView(B.buffer)}function Qi(h){var _=h.array.slice(h.offset.value,h.offset.value+h.size),M=La(_),B=new Uint8Array(M.length);return Dt(M),fu(M,B),new DataView(B.buffer)}function Gs(h){for(var _=h.viewer,M={value:h.offset.value},B=new Uint16Array(h.width*h.scanlineBlockSize*(h.channels*h.type)),H=new Uint8Array(8192),W=0,q=new Array(h.channels),J=0;J=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(ne<=te)for(var J=0;J0;){var J=Wl(_.buffer,M),ne=Tr(_,M),te=ne>>2&3,re=(ne>>4)-1,ee=new Int8Array([re])[0],Ve=Tr(_,M);W.push({name:J,index:ee,type:Ve,compression:te}),q-=J.length+3}for(var pe=Hn.channels,me=new Array(h.channels),ke=0;ke=0&&(Oe.idx[Me.index]=_e),Pe.offset=_e)}if(H.acCompressedSize>0)switch(H.acCompression){case 0:var Re=new Uint16Array(H.totalAcUncompressedCount);nn(h.array,_,M,H.acCompressedSize,Re,H.totalAcUncompressedCount);break;case 1:var Fe=h.array.slice(M.value,M.value+H.totalAcUncompressedCount),Xe=La(Fe),Re=new Uint16Array(Xe.buffer);M.value+=H.totalAcUncompressedCount;break}if(H.dcCompressedSize>0){var Je={array:h.array,offset:M,size:H.dcCompressedSize},At=new Uint16Array(Qi(Je).buffer);M.value+=H.dcCompressedSize}if(H.rleRawSize>0){var Fe=h.array.slice(M.value,M.value+H.rleCompressedSize),Xe=La(Fe),gt=du(Xe.buffer);M.value+=H.rleCompressedSize}for(var zt=0,Qe=new Array(me.length),ke=0;ke>10,M=h&1023;return(h>>15?-1:1)*(_?_===31?M?NaN:1/0:Math.pow(2,_-15)*(1+M/1024):6103515625e-14*(M/1024))}function dl(h,_){var M=h.getUint16(_.value,!0);return _.value+=2,M}function $s(h,_){return se(dl(h,_))}function qs(h,_,M,B){for(var H=M.value,W=[];M.valueIe.height?Ie.height-_:Ie.scanlineBlockSize;const B=Ie.size=Ie.height)break;for(let q=0;qw.size),o=ot(w=>w.viewport),a=typeof e=="number"?e:i.width*o.dpr,c=i.height*o.dpr,d=(typeof e=="number"?n:e)||{},{samples:p=0,depth:y,...m}=d,g=L.useMemo(()=>{const w=new Jd(a,c,{minFilter:Fn,magFilter:Fn,type:gn,...m});return y&&(w.depthTexture=new Rw(a,c,sr)),w.samples=p,w},[]);return L.useLayoutEffect(()=>{g.setSize(a,c),p&&(g.samples=p)},[p,g,a,c]),L.useEffect(()=>()=>g.dispose(),[]),g}const O2=e=>typeof e=="function",F2=L.forwardRef(({envMap:e,resolution:t=256,frames:n=1/0,children:i,makeDefault:o,...a},c)=>{const d=ot(({set:T})=>T),p=ot(({camera:T})=>T),y=ot(({size:T})=>T),m=L.useRef(null);L.useImperativeHandle(c,()=>m.current,[]);const g=L.useRef(null),w=L2(t);L.useLayoutEffect(()=>{a.manual||m.current.updateProjectionMatrix()},[y,a]),L.useLayoutEffect(()=>{m.current.updateProjectionMatrix()}),L.useLayoutEffect(()=>{if(o){const T=p;return d(()=>({camera:m.current})),()=>d(()=>({camera:T}))}},[m,o,d]);let C=0,P=null;const R=O2(i);return Hi(T=>{R&&(n===1/0||C{c=i.autoClear,n===1&&(i.autoClear=!0,i.render(e,t)),i.autoClear=!1,i.clearDepth(),i.render(o,a),i.autoClear=c},n),L.createElement("group",{onPointerOver:()=>null})}function U2({children:e,renderPriority:t=1}){const{scene:n,camera:i}=ot(),[o]=L.useState(()=>new Uo);return L.createElement(L.Fragment,null,ry(L.createElement(L.Fragment,null,e,L.createElement(D2,{defaultScene:n,defaultCamera:i,renderPriority:t})),o,{events:{priority:t+1}}))}const vy=L.createContext({}),A2=()=>L.useContext(vy),B2=2*Math.PI,u0=new Tw,a0=new Nw,[ri,Xf]=[new Oh,new Oh],s0=new Zt,c0=new Zt,j2=e=>"minPolarAngle"in e,f0=e=>"getTarget"in e,v3=({alignment:e="bottom-right",margin:t=[80,80],renderPriority:n=1,onUpdate:i,onTarget:o,children:a})=>{const c=ot(A=>A.size),d=ot(A=>A.camera),p=ot(A=>A.controls),y=ot(A=>A.invalidate),m=L.useRef(null),g=L.useRef(null),w=L.useRef(!1),C=L.useRef(0),P=L.useRef(new Zt(0,0,0)),R=L.useRef(new Zt(0,0,0));L.useEffect(()=>{R.current.copy(d.up)},[d]);const T=L.useCallback(A=>{w.current=!0,(p||o)&&(P.current=(o==null?void 0:o())||(f0(p)?p.getTarget(P.current):p==null?void 0:p.target)),C.current=d.position.distanceTo(s0),ri.copy(d.quaternion),c0.copy(A).multiplyScalar(C.current).add(s0),u0.lookAt(c0),Xf.copy(u0.quaternion),y()},[p,d,o,y]);Hi((A,G)=>{if(g.current&&m.current){var F;if(w.current)if(ri.angleTo(Xf)<.01)w.current=!1,j2(p)&&d.up.copy(R.current);else{const Z=G*B2;ri.rotateTowards(Xf,Z),d.position.set(0,0,1).applyQuaternion(ri).multiplyScalar(C.current).add(P.current),d.up.set(0,1,0).applyQuaternion(ri).normalize(),d.quaternion.copy(ri),f0(p)&&p.setPosition(d.position.x,d.position.y,d.position.z),i?i():p&&p.update(G),y()}a0.copy(d.matrix).invert(),(F=m.current)==null||F.quaternion.setFromRotationMatrix(a0)}});const S=L.useMemo(()=>({tweenCamera:T}),[T]),[E,k]=t,z=e.endsWith("-center")?0:e.endsWith("-left")?-c.width/2+E:c.width/2-E,O=e.startsWith("center-")?0:e.startsWith("top-")?c.height/2-k:-c.height/2+k;return L.createElement(U2,{renderPriority:n},L.createElement(vy.Provider,{value:S},L.createElement(F2,{makeDefault:!0,ref:g,position:[0,0,200]}),L.createElement("group",{ref:m,position:[z,O,0]},a)))};function Yf({scale:e=[.8,.05,.05],color:t,rotation:n}){return L.createElement("group",{rotation:n},L.createElement("mesh",{position:[.4,0,0]},L.createElement("boxGeometry",{args:e}),L.createElement("meshBasicMaterial",{color:t,toneMapped:!1})))}function li({onClick:e,font:t,disabled:n,arcStyle:i,label:o,labelColor:a,axisHeadScale:c=1,...d}){const p=ot(R=>R.gl),y=L.useMemo(()=>{const R=document.createElement("canvas");R.width=64,R.height=64;const T=R.getContext("2d");return T.beginPath(),T.arc(32,32,16,0,2*Math.PI),T.closePath(),T.fillStyle=i,T.fill(),o&&(T.font=t,T.textAlign="center",T.fillStyle=a,T.fillText(o,32,41)),new zw(R)},[i,o,a,t]),[m,g]=L.useState(!1),w=(o?1:.75)*(m?1.2:1)*c,C=R=>{R.stopPropagation(),g(!0)},P=R=>{R.stopPropagation(),g(!1)};return L.createElement("sprite",zn({scale:w,onPointerOver:n?void 0:C,onPointerOut:n?void 0:e||P},d),L.createElement("spriteMaterial",{map:y,"map-anisotropy":p.capabilities.getMaxAnisotropy()||1,alphaTest:.3,opacity:o?1:.75,toneMapped:!1}))}const h3=({hideNegativeAxes:e,hideAxisHeads:t,disabled:n,font:i="18px Inter var, Arial, sans-serif",axisColors:o=["#ff2060","#20df80","#2080ff"],axisHeadScale:a=1,axisScale:c,labels:d=["X","Y","Z"],labelColor:p="#000",onClick:y,...m})=>{const[g,w,C]=o,{tweenCamera:P}=A2(),R={font:i,disabled:n,labelColor:p,onClick:y,axisHeadScale:a,onPointerDown:n?void 0:T=>{P(T.object.position),T.stopPropagation()}};return L.createElement("group",zn({scale:40},m),L.createElement(Yf,{color:g,rotation:[0,0,0],scale:c}),L.createElement(Yf,{color:w,rotation:[0,0,Math.PI/2],scale:c}),L.createElement(Yf,{color:C,rotation:[0,-Math.PI/2,0],scale:c}),!t&&L.createElement(L.Fragment,null,L.createElement(li,zn({arcStyle:g,position:[1,0,0],label:d[0]},R)),L.createElement(li,zn({arcStyle:w,position:[0,1,0],label:d[1]},R)),L.createElement(li,zn({arcStyle:C,position:[0,0,1],label:d[2]},R)),!e&&L.createElement(L.Fragment,null,L.createElement(li,zn({arcStyle:g,position:[-1,0,0]},R)),L.createElement(li,zn({arcStyle:w,position:[0,-1,0]},R)),L.createElement(li,zn({arcStyle:C,position:[0,0,-1]},R)))))},H2=3e3,W2=3001,hy=(e,t,n)=>{let i;switch(e){case Ka:i=new Uint8ClampedArray(t*n*4);break;case gn:i=new Uint16Array(t*n*4);break;case Dw:i=new Uint32Array(t*n*4);break;case Fw:i=new Int8Array(t*n*4);break;case Ow:i=new Int16Array(t*n*4);break;case Lw:i=new Int32Array(t*n*4);break;case sr:i=new Float32Array(t*n*4);break;default:throw new Error("Unsupported data type")}return i};let Oa;const Q2=(e,t,n,i)=>{if(Oa!==void 0)return Oa;const o=new Jd(1,1,i);t.setRenderTarget(o);const a=new Yd(new k0,new Uw({color:16777215}));t.render(a,n),t.setRenderTarget(null);const c=hy(e,o.width,o.height);return t.readRenderTargetPixels(o,0,0,o.width,o.height,c),o.dispose(),a.geometry.dispose(),a.material.dispose(),Oa=c[0]!==0,Oa};class Kp{constructor(t){var n,i,o,a,c,d,p,y,m,g,w,C,P,R,T,S;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(k){throw this._renderer.setRenderTarget(null),k}this._renderer.setRenderTarget(null)},this._width=t.width,this._height=t.height,this._type=t.type,this._colorSpace=t.colorSpace;const E={format:Ri,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((n=t.renderTargetOptions)===null||n===void 0?void 0:n.anisotropy)!==void 0?(i=t.renderTargetOptions)===null||i===void 0?void 0:i.anisotropy:1,generateMipmaps:((o=t.renderTargetOptions)===null||o===void 0?void 0:o.generateMipmaps)!==void 0?(a=t.renderTargetOptions)===null||a===void 0?void 0:a.generateMipmaps:!1,magFilter:((c=t.renderTargetOptions)===null||c===void 0?void 0:c.magFilter)!==void 0?(d=t.renderTargetOptions)===null||d===void 0?void 0:d.magFilter:Fn,minFilter:((p=t.renderTargetOptions)===null||p===void 0?void 0:p.minFilter)!==void 0?(y=t.renderTargetOptions)===null||y===void 0?void 0:y.minFilter:Fn,samples:((m=t.renderTargetOptions)===null||m===void 0?void 0:m.samples)!==void 0?(g=t.renderTargetOptions)===null||g===void 0?void 0:g.samples:void 0,wrapS:((w=t.renderTargetOptions)===null||w===void 0?void 0:w.wrapS)!==void 0?(C=t.renderTargetOptions)===null||C===void 0?void 0:C.wrapS:Zr,wrapT:((P=t.renderTargetOptions)===null||P===void 0?void 0:P.wrapT)!==void 0?(R=t.renderTargetOptions)===null||R===void 0?void 0:R.wrapT:Zr};if(this._material=t.material,t.renderer?this._renderer=t.renderer:(this._renderer=Kp.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Uo,this._camera=new w0,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!Q2(this._type,this._renderer,this._camera,E)){let k;switch(this._type){case gn:k=this._renderer.extensions.has("EXT_color_buffer_float")?sr:void 0;break}k!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${sr}`),this._type=k):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Yd(new k0,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jd(this.width,this.height,E),this._renderTarget.texture.mapping=((T=t.renderTargetOptions)===null||T===void 0?void 0:T.mapping)!==void 0?(S=t.renderTargetOptions)===null||S===void 0?void 0:S.mapping:Ja}static instantiateRenderer(){const t=new E0;return t.setSize(128,128),t}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const t=hy(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,t),t}toDataTexture(t){const n=new Iw(this.toArray(),this.width,this.height,Ri,this._type,(t==null?void 0:t.mapping)||Ja,(t==null?void 0:t.wrapS)||Zr,(t==null?void 0:t.wrapT)||Zr,(t==null?void 0:t.magFilter)||Fn,(t==null?void 0:t.minFilter)||Fn,(t==null?void 0:t.anisotropy)||1,Kf);return n.generateMipmaps=(t==null?void 0:t.generateMipmaps)!==void 0?t==null?void 0:t.generateMipmaps:!1,n}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(t){this.disposeOnDemandRenderer(),t&&this.renderTarget.dispose(),this.material instanceof Kd&&Object.values(this.material.uniforms).forEach(n=>{n.value instanceof Gr&&n.value.dispose()}),Object.values(this.material).forEach(n=>{n instanceof Gr&&n.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(t){this._width=t,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(t){this._height=t,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(t){this._renderTarget=t,this._width=t.width,this._height=t.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}const V2=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,G2=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Z2 extends Kd{constructor({gamma:t,offsetHdr:n,offsetSdr:i,gainMapMin:o,gainMapMax:a,maxDisplayBoost:c,hdrCapacityMin:d,hdrCapacityMax:p,sdr:y,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:V2,fragmentShader:G2,uniforms:{sdr:{value:y},gainMap:{value:m},gamma:{value:new Zt(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:new Zt().fromArray(n)},offsetSdr:{value:new Zt().fromArray(i)},gainMapMin:{value:new Zt().fromArray(o)},gainMapMax:{value:new Zt().fromArray(a)},weightFactor:{value:(Math.log2(c)-d)/(p-d)}},blending:Hw,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=c,this._hdrCapacityMin=d,this._hdrCapacityMax=p,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const n=this.uniforms.gamma.value;n.x=1/t[0],n.y=1/t[1],n.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class my extends Error{}class gy extends Error{}const _o=(e,t,n)=>{var i;let o;const a=(i=e.attributes.getNamedItem(t))===null||i===void 0?void 0:i.nodeValue;if(a)o=a;else{const c=e.getElementsByTagName(t)[0];if(c){const d=c.getElementsByTagName("rdf:li");if(d.length===3)o=Array.from(d).map(p=>p.innerHTML);else throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`)}else{if(n)return n;throw new Error(`Can't find ${t} in gainmap metadata`)}}return o},X2=e=>{var t,n;let i;typeof TextDecoder<"u"?i=new TextDecoder().decode(e):i=e.toString();let o=i.indexOf("",o);i.slice(o,c+10);const d=i.slice(o,c+10);try{const y=a.parseFromString(d,"text/xml").getElementsByTagName("rdf:Description")[0],m=_o(y,"hdrgm:GainMapMin","0"),g=_o(y,"hdrgm:GainMapMax"),w=_o(y,"hdrgm:Gamma","1"),C=_o(y,"hdrgm:OffsetSDR","0.015625"),P=_o(y,"hdrgm:OffsetHDR","0.015625");let R=(t=y.attributes.getNamedItem("hdrgm:HDRCapacityMin"))===null||t===void 0?void 0:t.nodeValue;R||(R="0");const T=(n=y.attributes.getNamedItem("hdrgm:HDRCapacityMax"))===null||n===void 0?void 0:n.nodeValue;if(!T)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(m)?m.map(S=>parseFloat(S)):[parseFloat(m),parseFloat(m),parseFloat(m)],gainMapMax:Array.isArray(g)?g.map(S=>parseFloat(S)):[parseFloat(g),parseFloat(g),parseFloat(g)],gamma:Array.isArray(w)?w.map(S=>parseFloat(S)):[parseFloat(w),parseFloat(w),parseFloat(w)],offsetSdr:Array.isArray(C)?C.map(S=>parseFloat(S)):[parseFloat(C),parseFloat(C),parseFloat(C)],offsetHdr:Array.isArray(P)?P.map(S=>parseFloat(S)):[parseFloat(P),parseFloat(P),parseFloat(P)],hdrCapacityMin:parseFloat(R),hdrCapacityMax:parseFloat(T)}}catch{}o=i.indexOf("{const o=this.options.debug,a=new DataView(t.buffer);if(a.getUint16(0)!==65496){i(new Error("Not a valid jpeg"));return}const c=a.byteLength;let d=2,p=0,y;for(;d250){i(new Error(`Found no marker after ${p} loops 😵`));return}if(a.getUint8(d)!==255){i(new Error(`Not a valid marker at offset 0x${d.toString(16)}, found: 0x${a.getUint8(d).toString(16)}`));return}if(y=a.getUint8(d+1),o&&console.log(`Marker: ${y.toString(16)}`),y===226){o&&console.log("Found APP2 marker (0xffe2)");const m=d+4;if(a.getUint32(m)===1297106432){const g=m+4;let w;if(a.getUint16(g)===18761)w=!1;else if(a.getUint16(g)===19789)w=!0;else{i(new Error("No valid endianness marker found in TIFF header"));return}if(a.getUint16(g+2,!w)!==42){i(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const C=a.getUint32(g+4,!w);if(C<8){i(new Error("Not valid TIFF data! (First offset less than 8)"));return}const P=g+C,R=a.getUint16(P,!w),T=P+2;let S=0;for(let O=T;O{const t=X2(e);if(!t)throw new gy("Gain map XMP metadata not found");const i=await new Y2({extractFII:!0,extractNonFII:!0}).extract(e);if(i.length!==2)throw new my("Gain map recovery image not found");return{sdr:new Uint8Array(await i[0].arrayBuffer()),gainMap:new Uint8Array(await i[1].arrayBuffer()),metadata:t}},d0=e=>new Promise((t,n)=>{const i=document.createElement("img");i.onload=()=>{t(i)},i.onerror=o=>{n(o)},i.src=URL.createObjectURL(e)});class yy extends Aw{constructor(t,n){super(n),t&&(this._renderer=t),this._internalLoadingManager=new Bw}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: An existing WebGL Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const t=new Z2({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Gr,sdr:new Gr});return new Kp({width:16,height:16,type:gn,colorSpace:Kf,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(t,n,i,o){const a=o?new Blob([o],{type:"image/jpeg"}):void 0,c=new Blob([i],{type:"image/jpeg"});let d,p,y=!1;if(typeof createImageBitmap>"u"){const w=await Promise.all([a?d0(a):Promise.resolve(void 0),d0(c)]);p=w[0],d=w[1],y=!0}else{const w=await Promise.all([a?createImageBitmap(a,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(c,{imageOrientation:"flipY"})]);p=w[0],d=w[1]}const m=new Gr(p||new ImageData(2,2),Ja,Zr,Zr,Fn,Fh,Ri,Ka,1,Kf);m.flipY=y,m.needsUpdate=!0;const g=new Gr(d,Ja,Zr,Zr,Fn,Fh,Ri,Ka,1,jw);g.flipY=y,g.needsUpdate=!0,t.width=d.width,t.height=d.height,t.material.gainMap=m,t.material.sdr=g,t.material.gainMapMin=n.gainMapMin,t.material.gainMapMax=n.gainMapMax,t.material.offsetHdr=n.offsetHdr,t.material.offsetSdr=n.offsetSdr,t.material.gamma=n.gamma,t.material.hdrCapacityMin=n.hdrCapacityMin,t.material.hdrCapacityMax=n.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,n.hdrCapacityMax),t.material.needsUpdate=!0,t.render()}}class J2 extends yy{load([t,n,i],o,a,c){const d=this.prepareQuadRenderer();let p,y,m;const g=async()=>{if(p&&y&&m){try{await this.render(d,m,p,y)}catch(Z){this.manager.itemError(t),this.manager.itemError(n),this.manager.itemError(i),typeof c=="function"&&c(Z),d.disposeOnDemandRenderer();return}typeof o=="function"&&o(d),this.manager.itemEnd(t),this.manager.itemEnd(n),this.manager.itemEnd(i),d.disposeOnDemandRenderer()}};let w=!0,C=0,P=0,R=!0,T=0,S=0,E=!0,k=0,z=0;const O=()=>{if(typeof a=="function"){const Z=C+T+k,Y=P+S+z,K=w&&R&&E;a(new ProgressEvent("progress",{lengthComputable:K,loaded:Y,total:Z}))}};this.manager.itemStart(t),this.manager.itemStart(n),this.manager.itemStart(i);const A=new Fa(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async Z=>{if(typeof Z=="string")throw new Error("Invalid sdr buffer");p=Z,await g()},Z=>{w=Z.lengthComputable,P=Z.loaded,C=Z.total,O()},Z=>{this.manager.itemError(t),typeof c=="function"&&c(Z)});const G=new Fa(this._internalLoadingManager);G.setResponseType("arraybuffer"),G.setRequestHeader(this.requestHeader),G.setPath(this.path),G.setWithCredentials(this.withCredentials),G.load(n,async Z=>{if(typeof Z=="string")throw new Error("Invalid gainmap buffer");y=Z,await g()},Z=>{R=Z.lengthComputable,S=Z.loaded,T=Z.total,O()},Z=>{this.manager.itemError(n),typeof c=="function"&&c(Z)});const F=new Fa(this._internalLoadingManager);return F.setRequestHeader(this.requestHeader),F.setPath(this.path),F.setWithCredentials(this.withCredentials),F.load(i,async Z=>{if(typeof Z!="string")throw new Error("Invalid metadata string");m=JSON.parse(Z),await g()},Z=>{E=Z.lengthComputable,z=Z.loaded,k=Z.total,O()},Z=>{this.manager.itemError(i),typeof c=="function"&&c(Z)}),d}}class $2 extends yy{load(t,n,i,o){const a=this.prepareQuadRenderer(),c=new Fa(this._internalLoadingManager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(this.withCredentials),this.manager.itemStart(t),c.load(t,async d=>{if(typeof d=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const p=new Uint8Array(d);let y,m,g;try{const w=await K2(p);y=w.sdr,m=w.gainMap,g=w.metadata}catch(w){if(w instanceof gy||w instanceof my)console.warn(`Failure to reconstruct an HDR image from ${t}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),g={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},y=p;else throw w}try{await this.render(a,g,y,m)}catch(w){this.manager.itemError(t),typeof o=="function"&&o(w),a.disposeOnDemandRenderer();return}typeof n=="function"&&n(a),this.manager.itemEnd(t),a.disposeOnDemandRenderer()},i,d=>{this.manager.itemError(t),typeof o=="function"&&o(d)}),a}}const nu={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},wy="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Mi=e=>Array.isArray(e),Jp=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function As({files:e=Jp,path:t="",preset:n=void 0,encoding:i=void 0,extensions:o}={}){let a=null,c=!1;n&&($p(n),e=nu[n],t=wy),c=Mi(e);const{extension:d,isCubemap:p}=qp(e);if(a=bp(d),!a)throw new Error("useEnvironment: Unrecognized file extension: "+e);const y=ot(C=>C.gl);L.useLayoutEffect(()=>{if(d!=="webp"&&d!=="jpg"&&d!=="jpeg")return;function C(){Di.clear(a,c?[e]:e)}y.domElement.addEventListener("webglcontextlost",C,{once:!0})},[e,y.domElement]);const m=Di(a,c?[e]:e,C=>{(d==="webp"||d==="jpg"||d==="jpeg")&&C.setRenderer(y),C.setPath==null||C.setPath(t),o&&o(C)});let g=c?m[0]:m;if(d==="jpg"||d==="jpeg"||d==="webp"){var w;g=(w=g.renderTarget)==null?void 0:w.texture}return g.mapping=p?Ww:Qw,"colorSpace"in g?g.colorSpace=i??p?"srgb":"srgb-linear":g.encoding=i??p?W2:H2,g}const q2={files:Jp,path:"",preset:void 0,extensions:void 0};As.preload=e=>{const t={...q2,...e};let{files:n,path:i=""}=t;const{preset:o,extensions:a}=t;o&&($p(o),n=nu[o],i=wy);const{extension:c}=qp(n);if(c==="webp"||c==="jpg"||c==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const d=bp(c);if(!d)throw new Error("useEnvironment: Unrecognized file extension: "+n);Di.preload(d,Mi(n)?[n]:n,p=>{p.setPath==null||p.setPath(i),a&&a(p)})};const b2={files:Jp,preset:void 0};As.clear=e=>{const t={...b2,...e};let{files:n}=t;const{preset:i}=t;i&&($p(i),n=nu[i]);const{extension:o}=qp(n),a=bp(o);if(!a)throw new Error("useEnvironment: Unrecognized file extension: "+n);Di.clear(a,Mi(n)?[n]:n)};function $p(e){if(!(e in nu))throw new Error("Preset must be one of: "+Object.keys(nu).join(", "))}function qp(e){var t;const n=Mi(e)&&e.length===6,i=Mi(e)&&e.length===3&&e.some(c=>c.endsWith("json")),o=Mi(e)?e[0]:e;return{extension:n?"cube":i?"webp":o.startsWith("data:application/exr")?"exr":o.startsWith("data:application/hdr")?"hdr":o.startsWith("data:image/jpeg")?"jpg":(t=o.split(".").pop())==null||(t=t.split("?"))==null||(t=t.shift())==null?void 0:t.toLowerCase(),isCubemap:n,isGainmap:i}}function bp(e){return e==="cube"?Vw:e==="hdr"?z2:e==="exr"?I2:e==="jpg"||e==="jpeg"?$2:e==="webp"?J2:null}const e3=e=>e.current&&e.current.isScene,t3=e=>e3(e)?e.current:e;function ev(e,t,n,i,o={}){var a,c,d,p,y;o={backgroundBlurriness:(a=o.blur)!==null&&a!==void 0?a:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...o};const m=t3(t||n),g=m.background,w=m.environment,C={backgroundBlurriness:m.backgroundBlurriness,backgroundIntensity:m.backgroundIntensity,backgroundRotation:(c=(d=m.backgroundRotation)==null||d.clone==null?void 0:d.clone())!==null&&c!==void 0?c:[0,0,0],environmentIntensity:m.environmentIntensity,environmentRotation:(p=(y=m.environmentRotation)==null||y.clone==null?void 0:y.clone())!==null&&p!==void 0?p:[0,0,0]};return e!=="only"&&(m.environment=i),e&&(m.background=i),Wr(m,o),()=>{e!=="only"&&(m.environment=w),e&&(m.background=g),Wr(m,C)}}function tv({scene:e,background:t=!1,map:n,...i}){const o=ot(a=>a.scene);return L.useLayoutEffect(()=>{if(n)return ev(t,e,o,n,i)}),null}function Sy({background:e=!1,scene:t,blur:n,backgroundBlurriness:i,backgroundIntensity:o,backgroundRotation:a,environmentIntensity:c,environmentRotation:d,...p}){const y=As(p),m=ot(g=>g.scene);return L.useLayoutEffect(()=>ev(e,t,m,y,{blur:n,backgroundBlurriness:i,backgroundIntensity:o,backgroundRotation:a,environmentIntensity:c,environmentRotation:d})),null}function n3({children:e,near:t=1,far:n=1e3,resolution:i=256,frames:o=1,map:a,background:c=!1,blur:d,backgroundBlurriness:p,backgroundIntensity:y,backgroundRotation:m,environmentIntensity:g,environmentRotation:w,scene:C,files:P,path:R,preset:T=void 0,extensions:S}){const E=ot(F=>F.gl),k=ot(F=>F.scene),z=L.useRef(null),[O]=L.useState(()=>new Uo),A=L.useMemo(()=>{const F=new Gw(i);return F.texture.type=gn,F},[i]);L.useLayoutEffect(()=>(o===1&&z.current.update(E,O),ev(c,C,k,A.texture,{blur:d,backgroundBlurriness:p,backgroundIntensity:y,backgroundRotation:m,environmentIntensity:g,environmentRotation:w})),[e,O,A.texture,C,k,c,o,E]);let G=1;return Hi(()=>{(o===1/0||GV1({GroundProjectedEnvImpl:N2}),[]);const d=L.useMemo(()=>[c],[c]),p=(t=e.ground)==null?void 0:t.height,y=(n=e.ground)==null?void 0:n.radius,m=(i=(o=e.ground)==null?void 0:o.scale)!==null&&i!==void 0?i:1e3;return L.createElement(L.Fragment,null,L.createElement(tv,zn({},e,{map:c})),L.createElement("groundProjectedEnvImpl",{args:d,scale:m,height:p,radius:y}))}function m3(e){return e.ground?L.createElement(r3,e):e.map?L.createElement(tv,e):e.children?L.createElement(n3,e):L.createElement(Sy,e)}function l3(e,t){if(e===t)return!0;if(!e||!t)return e===t;for(const n in e)if(e[n]!==t[n])return!1;for(const n in t)if(e[n]!==t[n])return!1;return!0}function nv(e){const t=L.useRef();return l3(t.current,e)||(t.current=e),t.current}function p0(e){return/^on/g.test(e)}function v0(e){return e.replace(/^on/,"").replace(/[a-z][A-Z]/g,t=>`${t[0]}-${t[1]}`).toLowerCase()}function h0(e){return e.split("-")}function Ey(e,t){let n=e;const i=[...t];for(;i.length!==0;){const o=i.shift();n=n[o]}return n}function m0(e,t,n){const i=[...t],o=i.pop();Ey(e,i)[o]=n}function i3(e,t){L.useEffect(()=>{if(e!==null){for(const n in t)if(p0(n))e.addEventListener(v0(n),t[n]);else{const i=h0(n);Ey(e,i),m0(e,i,t[n])}return()=>{for(const n in t)p0(n)&&e.removeEventListener(v0(n),t[n]);for(const n in t){const i=h0(n);m0(e,i,t[n])}}}},[e,nv(t)])}function _y(e,t){L.useEffect(()=>{if(e===null)return;const n={};for(const i in t)i in e&&(n[i]=e[i],e[i]=t[i]);return()=>{for(const i in n)e[i]=n[i]}},[e,nv(t)])}const cu=L.createContext(null);function o3({children:e}){const t=L.useContext(cu),n=L.useRef();return L.useEffect(()=>{t&&(n.current.matrixWorld=t.group.matrixWorld)},[t]),lt.jsx("group",{ref:n,matrixWorldAutoUpdate:!1,matrixAutoUpdate:!1,children:e})}const g0=new Zt;function g3(e){const{lat:t=0,lon:n=0,height:i=0,az:o=0,el:a=0,roll:c=0,children:d}=e,p=L.useRef(),y=L.useContext(cu);return L.useEffect(()=>{if(y===null)return;const m=p.current;m.matrix.identity(),y.ellipsoid.getRotationMatrixFromAzElRoll(t,n,o,a,c,m.matrix),y.ellipsoid.getCartographicToPosition(t,n,i,g0),m.matrix.setPosition(g0),m.matrix.decompose(m.position,m.quaternion,m.scale),m.updateMatrixWorld()},[y,t,n,i,o,a,c]),lt.jsx("group",{ref:p,children:d})}const y3=L.forwardRef(function(t,n){const{plugin:i,args:o,...a}=t,c=L.useContext(cu),d=L.useMemo(()=>{if(c===null)return null;let p;return Array.isArray(o)?p=new i(...o):p=new i(o),p},[c,i,nv(o)]);_y(d,a),L.useEffect(()=>{n&&(n instanceof Function?n(d):n.current=d)},[d,n]),L.useEffect(()=>{if(c!==null)return c.registerPlugin(d),()=>{c.unregisterPlugin(d)}},[d,c])}),w3=L.forwardRef(function(t,n){const{url:i,children:o,...a}=t,[c,d]=L.useState(null),[p,y,m]=ot(g=>[g.camera,g.gl,g.invalidate]);return L.useEffect(()=>{const g=new Yw(i);return g.addEventListener("load-content",()=>m()),d(g),()=>{g.dispose()}},[i,m]),Hi(()=>{c!==null&&(p.updateMatrixWorld(),c.setResolutionFromRenderer(p,y),c.update())}),L.useEffect(()=>{if(c!==null)return c.setCamera(p),()=>{c.deleteCamera(p)}},[c,p]),L.useEffect(()=>{n&&(n instanceof Function?n(c):n.current=c)},[c,n]),i3(c,a),lt.jsxs(lt.Fragment,{children:[c?lt.jsx("primitive",{object:c.group}):null,lt.jsx(cu.Provider,{value:c,children:lt.jsx(o3,{children:o})})]})}),ky=L.forwardRef(function(t,n){const{controlsConstructor:i,domElement:o,scene:a,camera:c,tilesRenderer:d,...p}=t,[y]=ot(O=>[O.camera]),[m]=ot(O=>[O.gl]),[g]=ot(O=>[O.scene]),[w]=ot(O=>[O.invalidate]),[C]=ot(O=>[O.get]),[P]=ot(O=>[O.set]),R=L.useContext(cu),T=c||y||null,S=a||g||null,E=o||m.domElement||null,k=d||R||null,z=L.useMemo(()=>new i,[i]);L.useEffect(()=>{n&&(n instanceof Function?n(z):n.current=z)},[z,n]),L.useEffect(()=>{const O=()=>w();return z.addEventListener("change",O),z.addEventListener("start",O),z.addEventListener("end",O),()=>{z.removeEventListener("change",O),z.removeEventListener("start",O),z.removeEventListener("end",O)}},[z,w]),L.useEffect(()=>{z.setCamera(T)},[z,T]),L.useEffect(()=>{z.setScene(S)},[z,S]),L.useEffect(()=>{z.setTilesRenderer(k)},[z,k]),L.useEffect(()=>(z.attach(E),()=>{z.detach()}),[z,E]),L.useEffect(()=>{const O=C().controls;return P({controls:z}),()=>P({controls:O})},[z,C,P]),Hi(()=>{z.update()},-1),_y(z,p)});function S3(e){return lt.jsx(ky,{...e,controlsConstructor:Zw})}function E3(e){return lt.jsx(ky,{...e,controlsConstructor:Xw})}export{p3 as C,S3 as E,v3 as G,fS as R,w3 as T,zn as _,Hi as a,y3 as b,__ as c,m3 as d,V1 as e,h3 as f,E3 as g,g3 as h,Es as i,lt as j,ot as k,cu as l,D1 as m,d3 as n,f3 as o,A1 as p,L as r,L2 as u}; diff --git a/example/bundle/assets/CameraTransitionManager-BQ4iVDfk.js b/example/bundle/assets/CameraTransitionManager-BQ4iVDfk.js new file mode 100644 index 000000000..b3b8edc88 --- /dev/null +++ b/example/bundle/assets/CameraTransitionManager-BQ4iVDfk.js @@ -0,0 +1 @@ +import{k as m,E as w,a as u,o as E,O as F,n as c}from"./three.module-CA-qMkP1.js";const e=new m,s=new m,v=new m;class W extends w{get animating(){return this._alpha!==0&&this._alpha!==1}get camera(){return this._alpha===0?this.perspectiveCamera:this._alpha===1?this.orthographicCamera:this.transitionCamera}constructor(a=new u,o=new F){super(),this.perspectiveCamera=a,this.orthographicCamera=o,this.transitionCamera=new u,this.orthographicPositionalZoom=!0,this.orthographicOffset=50,this.fixedPoint=new m,this.duration=200,this._target=0,this._alpha=0,this._clock=new E}toggle(){this._target=this._target===1?0:1}update(){const{perspectiveCamera:a,orthographicCamera:o,transitionCamera:t,camera:n}=this,h=this._clock.getDelta()*1e3;if(this._syncCameras(),this._alpha!==this._target){const d=Math.sign(this._target-this._alpha)*h/this.duration;this._alpha=c.clamp(this._alpha+d,0,1),this.dispatchEvent({type:"change"})}const p=n;let r=null;this._alpha===0?r=a:this._alpha===1?r=o:(r=t,this._updateTransitionCamera()),p!==r&&this.dispatchEvent({type:"camera-changed",camera:r,prevCamera:p})}_syncCameras(){const a=this._getFromCamera(),{perspectiveCamera:o,orthographicCamera:t,transitionCamera:n,fixedPoint:i}=this;if(e.set(0,0,-1).transformDirection(a.matrixWorld).normalize(),a.isPerspectiveCamera){if(this.orthographicPositionalZoom)t.position.copy(o.position).addScaledVector(e,-this.orthographicOffset),t.rotation.copy(o.rotation),t.updateMatrixWorld();else{const l=s.subVectors(i,t.position).dot(e),d=s.subVectors(i,o.position).dot(e);s.copy(o.position).addScaledVector(e,d),t.rotation.copy(o.rotation),t.position.copy(s).addScaledVector(e,-l),t.updateMatrixWorld()}const h=Math.abs(s.subVectors(o.position,i).dot(e)),p=2*Math.tan(c.DEG2RAD*o.fov*.5)*h,r=t.top-t.bottom;t.zoom=r/p,t.updateProjectionMatrix()}else{const h=Math.abs(s.subVectors(t.position,i).dot(e)),r=(t.top-t.bottom)/t.zoom*.5/Math.tan(c.DEG2RAD*o.fov*.5);o.rotation.copy(t.rotation),o.position.copy(t.position).addScaledVector(e,h).addScaledVector(e,-r),o.updateMatrixWorld(),this.orthographicPositionalZoom&&(t.position.copy(o.position).addScaledVector(e,-this.orthographicOffset),t.updateMatrixWorld())}n.position.copy(o.position),n.rotation.copy(o.rotation)}_getTransitionDirection(){return Math.sign(this._target-this._alpha)}_getToCamera(){const a=this._getTransitionDirection();return a===0?this._target===0?this.perspectiveCamera:this.orthographicCamera:a>0?this.orthographicCamera:this.perspectiveCamera}_getFromCamera(){const a=this._getTransitionDirection();return a===0?this._target===0?this.perspectiveCamera:this.orthographicCamera:a>0?this.perspectiveCamera:this.orthographicCamera}_updateTransitionCamera(){const{perspectiveCamera:a,orthographicCamera:o,transitionCamera:t,fixedPoint:n}=this,i=this._alpha;e.set(0,0,-1).transformDirection(a.matrixWorld).normalize();const h=Math.abs(s.subVectors(a.position,n).dot(e)),p=2*Math.tan(c.DEG2RAD*a.fov*.5)*h,r=c.lerp(a.fov,1,i),l=p*.5/Math.tan(c.DEG2RAD*r*.5),d=0,P=o.far-o.near;v.copy(o.position).addScaledVector(e,o.near);const g=Math.abs(s.subVectors(a.position,n).dot(e)),C=Math.abs(s.subVectors(v,n).dot(e)),D=g-a.near,M=C-d,y=c.lerp(D,M,i),V=g-a.far,x=C-P,b=c.lerp(V,x,i),f=l-y,_=l-b,T=_-f;t.aspect=a.aspect,t.fov=r,t.near=Math.max(f,T*1e-5),t.far=_,t.position.copy(a.position).addScaledVector(e,g-l),t.rotation.copy(a.rotation),t.updateProjectionMatrix(),t.updateMatrixWorld()}}export{W as C}; diff --git a/example/bundle/assets/CesiumIonAuthPlugin-IKQrMOf_.js b/example/bundle/assets/CesiumIonAuthPlugin-IKQrMOf_.js new file mode 100644 index 000000000..b39b44a39 --- /dev/null +++ b/example/bundle/assets/CesiumIonAuthPlugin-IKQrMOf_.js @@ -0,0 +1 @@ +import{G as o}from"./GoogleCloudAuthPlugin-B6MTG2Cr.js";class l{constructor({apiToken:e,assetId:i=null,autoRefreshToken:t=!1}){this.name="CESIUM_ION_AUTH_PLUGIN",this.apiToken=e,this.assetId=i,this.autoRefreshToken=t,this.tiles=null,this.endpointURL=null,this._bearerToken=null,this._tileSetVersion=-1,this._tokenRefreshPromise=null,this._attributions=[]}init(e){this.assetId!==null&&(e.rootURL=`https://api.cesium.com/v1/assets/${this.assetId}/endpoint`),this.tiles=e,this.endpointURL=e.rootURL}loadRootTileSet(){return this._refreshToken().then(()=>this.tiles.loadRootTileSet())}preprocessURL(e){return e=new URL(e),/^http/.test(e.protocol)&&this._tileSetVersion!=-1&&e.searchParams.append("v",this._tileSetVersion),e.toString()}fetchData(e,i){return this.tiles.getPluginByName("GOOGLE_CLOUD_AUTH_PLUGIN")!==null?null:Promise.resolve().then(async()=>{this._tokenRefreshPromise!==null&&(await this._tokenRefreshPromise,e=this.preprocessURL(e));const s=await fetch(e,i);return s.status>=400&&s.status<=499&&this.autoRefreshToken?(await this._refreshToken(i),fetch(this.preprocessURL(e),i)):s})}getAttributions(e){this.tiles.visibleTiles.size>0&&e.push(...this._attributions)}_refreshToken(e){if(this._tokenRefreshPromise===null){const i=new URL(this.endpointURL);i.searchParams.append("access_token",this.apiToken),this._tokenRefreshPromise=fetch(i,e).then(t=>{if(!t.ok)throw new Error(`CesiumIonAuthPlugin: Failed to load data with error code ${t.status}`);return t.json()}).then(t=>{const s=this.tiles;if("externalType"in t){const r=new URL(t.options.url);s.rootURL=t.options.url,s.registerPlugin(new o({apiToken:r.searchParams.get("key")}))}else{if(s.rootURL=t.url,s.fetchOptions.headers=s.fetchOptions.headers||{},s.fetchOptions.headers.Authorization=`Bearer ${t.accessToken}`,i.searchParams.has("v")&&this._tileSetVersion===-1){const r=new URL(t.url);this._tileSetVersion=r.searchParams.get("v")}this._bearerToken=t.accessToken,t.attributions&&(this._attributions=t.attributions.map(r=>({value:r.html,type:"html",collapsible:r.collapsible})))}return this._tokenRefreshPromise=null,t})}return this._tokenRefreshPromise}}export{l as C}; diff --git a/example/bundle/assets/DRACOLoader-Dj1M3u4C.js b/example/bundle/assets/DRACOLoader-Dj1M3u4C.js new file mode 100644 index 000000000..ee925943e --- /dev/null +++ b/example/bundle/assets/DRACOLoader-Dj1M3u4C.js @@ -0,0 +1,2 @@ +import{q as C,F as A,a1 as L,a2 as P,ak as D,al as T,C as R}from"./three.module-CA-qMkP1.js";const _=new WeakMap;class U extends C{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,o,s,r){const n=new A(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,t=>{this.parse(t,o,r)},s,r)}parse(e,o,s=()=>{}){this.decodeDracoFile(e,o,null,null,L,s).catch(s)}decodeDracoFile(e,o,s,r,n=P,t=()=>{}){const i={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:n};return this.decodeGeometry(e,i).then(o).catch(t)}decodeGeometry(e,o){const s=JSON.stringify(o);if(_.has(e)){const a=_.get(e);if(a.key===s)return a.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const n=this.workerNextTaskID++,t=e.byteLength,i=this._getWorker(n,t).then(a=>(r=a,new Promise((h,d)=>{r._callbacks[n]={resolve:h,reject:d},r.postMessage({type:"decode",id:n,taskConfig:o,buffer:e},[e])}))).then(a=>this._createGeometry(a.geometry));return i.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),_.set(e,{key:s,promise:i}),i}_createGeometry(e){const o=new D;e.index&&o.setIndex(new T(e.index.array,1));for(let s=0;s{s.load(e,r,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",o=[];return e?o.push(this._loadLibrary("draco_decoder.js","text")):(o.push(this._loadLibrary("draco_wasm_wrapper.js","text")),o.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(o).then(s=>{const r=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const n=I.toString(),t=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([t]))}),this.decoderPending}_getWorker(e,o){return this._initDecoder().then(()=>{if(this.workerPool.lengthn._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=o,s._taskLoad+=o,s})}_releaseTask(e,o){e._taskLoad-=e._taskCosts[o],delete e._callbacks[o],delete e._taskCosts[o]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const u=d.draco,c=new u.Decoder;try{const l=o(u,c,new Int8Array(a),h),f=l.attributes.map(y=>y.array.buffer);l.index&&f.push(l.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:l},f)}catch(l){console.error(l),self.postMessage({type:"error",id:i.id,error:l.message})}finally{u.destroy(c)}});break}};function o(t,i,a,h){const d=h.attributeIDs,u=h.attributeTypes;let c,l;const f=i.GetEncodedGeometryType(a);if(f===t.TRIANGULAR_MESH)c=new t.Mesh,l=i.DecodeArrayToMesh(a,a.byteLength,c);else if(f===t.POINT_CLOUD)c=new t.PointCloud,l=i.DecodeArrayToPointCloud(a,a.byteLength,c);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!l.ok()||c.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const y={index:null,attributes:[]};for(const p in d){const m=self[u[p]];let g,b;if(h.useUniqueIDs)b=d[p],g=i.GetAttributeByUniqueId(c,b);else{if(b=i.GetAttributeId(c,t[d[p]]),b===-1)continue;g=i.GetAttribute(c,b)}const w=r(t,i,c,p,m,g);p==="color"&&(w.vertexColorSpace=h.vertexColorSpace),y.attributes.push(w)}return f===t.TRIANGULAR_MESH&&(y.index=s(t,i,c)),t.destroy(c),y}function s(t,i,a){const d=a.num_faces()*3,u=d*4,c=t._malloc(u);i.GetTrianglesUInt32Array(a,u,c);const l=new Uint32Array(t.HEAPF32.buffer,c,d).slice();return t._free(c),{array:l,itemSize:1}}function r(t,i,a,h,d,u){const c=u.num_components(),f=a.num_points()*c,y=f*d.BYTES_PER_ELEMENT,p=n(t,d),m=t._malloc(y);i.GetAttributeDataArrayForAllPoints(a,u,p,y,m);const g=new d(t.HEAPF32.buffer,m,f).slice();return t._free(m),{name:h,array:g,itemSize:c}}function n(t,i){switch(i){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}}export{U as D}; diff --git a/example/bundle/assets/Ellipsoid-_mEueZip.js b/example/bundle/assets/Ellipsoid-_mEueZip.js new file mode 100644 index 000000000..43463e277 --- /dev/null +++ b/example/bundle/assets/Ellipsoid-_mEueZip.js @@ -0,0 +1 @@ +import{k as l,n as R,m as W,p as B,d as K,i as Q,b7 as tt}from"./three.module-CA-qMkP1.js";const d=new W,U=new l,et={};function it(r){const{x:t,y:e,z:i}=r;r.x=i,r.y=t,r.z=e}function ot(r){return-(r-Math.PI/2)}function H(r){return-r+Math.PI/2}function st(r,t,e={}){return d.theta=t,d.phi=H(r),U.setFromSpherical(d),d.setFromVector3(U),e.lat=ot(d.phi),e.lon=d.theta,e}function X(r,t="E",e="W"){const i=r<0?e:t;r=Math.abs(r);const o=~~r,s=(r-o)*60,n=~~s,y=~~((s-n)*60);return`${o}° ${n}' ${y}" ${i}`}function lt(r,t,e=!1){const i=st(r,t,et);let o,s;return e?(o=`${(R.RAD2DEG*i.lat).toFixed(4)}°`,s=`${(R.RAD2DEG*i.lon).toFixed(4)}°`):(o=X(R.RAD2DEG*i.lat,"N","S"),s=X(R.RAD2DEG*i.lon,"E","W")),`${o} ${s}`}const Y=new W,m=new l,c=new l,w=new l,nt=new l,p=new B,u=new B,A=new K,a=new tt,Z=new l,b=new l,T=new l,D=new l,G=new Q,rt=1e-12,at=.1,V=0,L=1,O=2;class ut{constructor(t=1,e=1,i=1){this.radius=new l(t,e,i)}intersectRay(t,e){return p.makeScale(...this.radius).invert(),A.center.set(0,0,0),A.radius=1,G.copy(t).applyMatrix4(p),G.intersectSphere(A,e)?(p.makeScale(...this.radius),e.applyMatrix4(p),e):null}getEastNorthUpFrame(t,e,i){return this.getEastNorthUpAxes(t,e,Z,b,T,D),i.makeBasis(Z,b,T).setPosition(D)}getEastNorthUpAxes(t,e,i,o,s,n=D){this.getCartographicToPosition(t,e,0,n),this.getCartographicToNormal(t,e,s),i.set(-n.y,n.x,0).normalize(),o.crossVectors(s,i).normalize()}getNorthernTangent(t,e,i,o=nt){return console.log("Ellipsoid: getNorthernTangent has been deprecated. Use getEastNorthUpAxes instead."),this.getEastNorthUpAxes(t,e,o,i,T),o.multiplyScalar(-1),i}getAzElRollFromRotationMatrix(t,e,i,o,s=V){return s===L?(a.set(-Math.PI/2,0,0,"XYZ"),u.makeRotationFromEuler(a).premultiply(i)):s===O?(a.set(-Math.PI/2,0,Math.PI,"XYZ"),u.makeRotationFromEuler(a).premultiply(i)):u.copy(i),this.getEastNorthUpFrame(t,e,p).invert(),u.premultiply(p),a.setFromRotationMatrix(u,"ZXY"),o.azimuth=-a.z,o.elevation=a.x,o.roll=a.y,o}getRotationMatrixFromAzElRoll(t,e,i,o,s,n,h=V){return this.getEastNorthUpFrame(t,e,p),a.set(o,s,-i,"ZXY"),n.makeRotationFromEuler(a).premultiply(p).setPosition(0,0,0),h===L?(a.set(Math.PI/2,0,0,"XYZ"),u.makeRotationFromEuler(a),n.multiply(u)):h===O&&(a.set(-Math.PI/2,0,Math.PI,"XYZ"),u.makeRotationFromEuler(a),n.multiply(u)),n}getCartographicToPosition(t,e,i,o){this.getCartographicToNormal(t,e,m);const s=this.radius;c.copy(m),c.x*=s.x**2,c.y*=s.y**2,c.z*=s.z**2;const n=Math.sqrt(m.dot(c));return c.divideScalar(n),o.copy(c).addScaledVector(m,i)}getPositionToCartographic(t,e){this.getPositionToSurfacePoint(t,c),this.getPositionToNormal(t,m);const i=w.subVectors(t,c);return e.lon=Math.atan2(m.y,m.x),e.lat=Math.asin(m.z),e.height=Math.sign(i.dot(t))*i.length(),e}getCartographicToNormal(t,e,i){return Y.set(1,H(t),e),i.setFromSpherical(Y).normalize(),it(i),i}getPositionToNormal(t,e){const i=this.radius;return e.copy(t),e.x/=i.x**2,e.y/=i.y**2,e.z/=i.z**2,e.normalize(),e}getPositionToSurfacePoint(t,e){const i=this.radius,o=1/i.x**2,s=1/i.y**2,n=1/i.z**2,h=t.x*t.x*o,y=t.y*t.y*s,z=t.z*t.z*n,v=h+y+z,f=Math.sqrt(1/v),S=c.copy(t).multiplyScalar(f);if(vrt);return e.set(t.x*M,t.y*E,t.z*x)}calculateHorizonDistance(t,e){const i=this.calculateEffectiveRadius(t);return Math.sqrt(2*i*e+e**2)}calculateEffectiveRadius(t){const e=this.radius.x,o=1-this.radius.z**2/e**2,s=t*R.DEG2RAD,n=Math.sin(s)**2;return e/Math.sqrt(1-o*n)}getPositionElevation(t){this.getPositionToSurfacePoint(t,c);const e=w.subVectors(t,c);return Math.sign(e.dot(t))*e.length()}copy(t){return this.radius.copy(t.radius),this}clone(){return new this.constructor().copy(this)}}export{L as C,ut as E,O,lt as t}; diff --git a/example/bundle/assets/EllipsoidRegion-CSZafkN2.js b/example/bundle/assets/EllipsoidRegion-CSZafkN2.js new file mode 100644 index 000000000..f436bc899 --- /dev/null +++ b/example/bundle/assets/EllipsoidRegion-CSZafkN2.js @@ -0,0 +1 @@ +import{k as f,p as R,n as g}from"./three.module-CA-qMkP1.js";import{E as C}from"./Ellipsoid-_mEueZip.js";const l=Math.PI,u=l/2,m=new f,c=new f,h=new f,y=new R;let d=0;const w=[];function T(M=!1){return M?(w[d]||(w[d]=new f),d++,w[d-1]):new f}function I(){d=0}class H extends C{constructor(i,t,o,n=-u,e=u,p=0,E=2*l,a=0,s=0){super(i,t,o),this.latStart=n,this.latEnd=e,this.lonStart=p,this.lonEnd=E,this.heightStart=a,this.heightEnd=s}_getPoints(i=!1){const{latStart:t,latEnd:o,lonStart:n,lonEnd:e,heightStart:p,heightEnd:E}=this,a=g.mapLinear(.5,0,1,t,o),s=g.mapLinear(.5,0,1,n,e),r=Math.floor(n/u)*u,k=[[-l/2,0],[l/2,0],[0,r],[0,r+l/2],[0,r+l],[0,r+3*l/2],[t,e],[o,e],[t,n],[o,n],[0,n],[0,e],[a,s],[t,s],[o,s],[a,n],[a,e]],B=[],V=k.length;for(let P=0;P<=1;P++){const v=g.mapLinear(P,0,1,p,E);for(let L=0,F=V;L=t&&_<=o&&S>=n&&S<=e){const x=T(i);B.push(x),this.getCartographicToPosition(_,S,v,x)}}}return B}getBoundingBox(i,t){I();const{latStart:o,latEnd:n,lonStart:e,lonEnd:p}=this;if(n-o.1&&(l.z>0&&w.multiplyScalar(-1),f.setXYZ(r,...w))}return u}class T extends S{constructor(t=new I,e=16776960){super(),this.ellipsoidRegion=t,this.material.color.set(e),this.update()}update(){const t=L(this.ellipsoidRegion);this.geometry.dispose(),this.geometry=new z(t,80)}dispose(){this.geometry.dispose(),this.material.dispose()}}class k extends N{constructor(t=new I,e=16776960){super(),this.ellipsoidRegion=t,this.material.color.set(e),this.update()}update(){this.geometry.dispose();const t=L(this.ellipsoidRegion),{lonStart:e,lonEnd:a}=this;a-e>=2*Math.PI?(t.groups.splice(2,2),this.geometry=H(t)):this.geometry=t}dispose(){this.geometry.dispose(),this.material.dispose()}}export{k as E,F as S,T as a}; diff --git a/example/bundle/assets/EnvironmentControls-7w_Q0bky.js b/example/bundle/assets/EnvironmentControls-7w_Q0bky.js new file mode 100644 index 000000000..bf512ec0d --- /dev/null +++ b/example/bundle/assets/EnvironmentControls-7w_Q0bky.js @@ -0,0 +1,45 @@ +import{g as at,aX as ct,b as ht,V as g,p as ot,i as lt,k as f,j as nt,E as pt,R as dt,o as ut,Q as rt,n as mt}from"./three.module-CA-qMkP1.js";class ft extends at{constructor(){super(new ct(0,0),new Pt),this.renderOrder=1/0}onBeforeRender(t){const e=this.material.uniforms;t.getSize(e.resolution.value)}updateMatrixWorld(){this.matrixWorld.makeTranslation(this.position)}dispose(){this.geometry.dispose(),this.material.dispose()}}class Pt extends ht{constructor(){super({depthWrite:!1,depthTest:!1,transparent:!0,uniforms:{resolution:{value:new g},size:{value:15},thickness:{value:2},opacity:{value:1}},vertexShader:` + + uniform float pixelRatio; + uniform float size; + uniform float thickness; + uniform vec2 resolution; + varying vec2 vUv; + + void main() { + + vUv = uv; + + float aspect = resolution.x / resolution.y; + vec2 offset = uv * 2.0 - vec2( 1.0 ); + offset.y *= aspect; + + vec4 screenPoint = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + screenPoint.xy += offset * ( size + thickness ) * screenPoint.w / resolution.x; + + gl_Position = screenPoint; + + } + `,fragmentShader:` + + uniform float size; + uniform float thickness; + uniform float opacity; + + varying vec2 vUv; + void main() { + + float ht = 0.5 * thickness; + float planeDim = size + thickness; + float offset = ( planeDim - ht - 2.0 ) / planeDim; + float texelThickness = ht / planeDim; + + vec2 vec = vUv * 2.0 - vec2( 1.0 ); + float dist = abs( length( vec ) - offset ); + float fw = fwidth( dist ) * 0.5; + float a = smoothstep( texelThickness - fw, texelThickness + fw, dist ); + + gl_FragColor = vec4( 1, 1, 1, opacity * ( 1.0 - a ) ); + + } + `})}}const Q=new g,Y=new g;class vt{constructor(){this.domElement=null,this.buttons=0,this.pointerType=null,this.pointerOrder=[],this.previousPositions={},this.pointerPositions={},this.startPositions={},this.pointerSetThisFrame={},this.hoverPosition=new g,this.hoverSet=!1}reset(){this.buttons=0,this.pointerType=null,this.pointerOrder=[],this.previousPositions={},this.pointerPositions={},this.startPositions={},this.pointerSetThisFrame={},this.hoverPosition=new g,this.hoverSet=!1}updateFrame(){const{previousPositions:t,pointerPositions:e}=this;for(const i in e)t[i].copy(e[i])}setHoverEvent(t){(t.pointerType==="mouse"||t.type==="wheel")&&(this.getAdjustedPointer(t,this.hoverPosition),this.hoverSet=!0)}getLatestPoint(t){return this.pointerType!==null?(this.getCenterPoint(t),t):this.hoverSet?(t.copy(this.hoverPosition),t):null}getAdjustedPointer(t,e){const s=(this.domElement?this.domElement:t.target).getBoundingClientRect(),n=t.clientX-s.left,c=t.clientY-s.top;e.set(n,c)}addPointer(t){const e=t.pointerId,i=new g;this.getAdjustedPointer(t,i),this.pointerOrder.push(e),this.pointerPositions[e]=i,this.previousPositions[e]=i.clone(),this.startPositions[e]=i.clone(),this.getPointerCount()===1&&(this.pointerType=t.pointerType,this.buttons=t.buttons)}updatePointer(t){const e=t.pointerId;return e in this.pointerPositions?(this.getAdjustedPointer(t,this.pointerPositions[e]),!0):!1}deletePointer(t){const e=t.pointerId,i=this.pointerOrder;i.splice(i.indexOf(e),1),delete this.pointerPositions[e],delete this.previousPositions[e],delete this.startPositions[e],this.getPointerCount.length===0&&(this.buttons=0,this.pointerType=null)}getPointerCount(){return this.pointerOrder.length}getCenterPoint(t,e=this.pointerPositions){const i=this.pointerOrder;if(this.getPointerCount()===1||this.getPointerType()==="mouse"){const s=i[0];return t.copy(e[s]),t}else if(this.getPointerCount()===2){const s=this.pointerOrder[0],n=this.pointerOrder[1],c=e[s],p=e[n];return t.addVectors(c,p).multiplyScalar(.5),t}return null}getPreviousCenterPoint(t){return this.getCenterPoint(t,this.previousPositions)}getStartCenterPoint(t){return this.getCenterPoint(t,this.startPositions)}getMoveDistance(){return this.getCenterPoint(Q),this.getPreviousCenterPoint(Y),Q.sub(Y).length()}getTouchPointerDistance(t=this.pointerPositions){if(this.getPointerCount()<=1||this.getPointerType()==="mouse")return 0;const{pointerOrder:e}=this,i=e[0],s=e[1],n=t[i],c=t[s];return n.distanceTo(c)}getPreviousTouchPointerDistance(){return this.getTouchPointerDistance(this.previousPositions)}getStartTouchPointerDistance(){return this.getTouchPointerDistance(this.startPositions)}getPointerType(){return this.pointerType}isPointerTouch(){return this.getPointerType()==="touch"}getPointerButtons(){return this.buttons}isLeftClicked(){return!!(this.buttons&1)}isRightClicked(){return!!(this.buttons&2)}}const x=new ot,X=new lt,q=new f;function A(l,t,e){return e.makeTranslation(-l.x,-l.y,-l.z),x.makeRotationFromQuaternion(t),e.premultiply(x),x.makeTranslation(l.x,l.y,l.z),e.premultiply(x),e}function R(l,t,e,i){i.x=(l-e.offsetLeft)/e.clientWidth*2-1,i.y=-((t-e.offsetTop)/e.clientHeight)*2+1,i.isVector3&&(i.z=0)}function Dt(l,t,e){return t.intersectRay(l,e)?e:(x.makeScale(...t.radius).invert(),X.copy(l).applyMatrix4(x),q.set(0,0,0),X.closestPointToPoint(q,e).normalize(),x.makeScale(...t.radius),e.applyMatrix4(x))}function Mt(l,t,e){const i=l.origin.length(),s=Math.acos(t/i);e.copy(l.origin).multiplyScalar(-1).normalize();const n=q.crossVectors(e,l.direction).normalize();e.multiplyScalar(-1).applyAxisAngle(n,-s).normalize().multiplyScalar(t)}function W(l,t,e){const{origin:i,direction:s}=l.ray;i.set(t.x,t.y,-1).unproject(e),s.set(t.x,t.y,1).unproject(e).sub(i),l.near=0,l.far=s.length(),l.camera=e,s.normalize()}const _=0,E=1,w=2,I=3,V=4,F=.05,Z=.025,yt=1e-4,gt=.01,D=new ot,U=new f,y=new f,j=new f,$=new f,z=new f,M=new rt,J=new nt,S=new f,H=new f,N=new f,St=new rt,L=new g,u=new g,K=new g,T=new g,B=new g,tt=new g,et={type:"change"},it={type:"start"},st={type:"end"};class xt extends pt{get enabled(){return this._enabled}set enabled(t){t!==this.enabled&&(this._enabled=t,this.resetState(),this.pointerTracker.reset(),this.enabled||(this.dragInertia.set(0,0,0),this.rotationInertia.set(0,0)))}constructor(t=null,e=null,i=null,s=null){super(),this.domElement=null,this.camera=null,this.scene=null,this.tilesRenderer=null,this._enabled=!0,this.cameraRadius=5,this.rotationSpeed=1,this.minAltitude=0,this.maxAltitude=.45*Math.PI,this.minDistance=10,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.zoomSpeed=1,this.adjustHeight=!0,this.enableDamping=!1,this.dampingFactor=.15,this.reorientOnDrag=!0,this.scaleZoomOrientationAtEdges=!1,this.state=_,this.pointerTracker=new vt,this.needsUpdate=!1,this.actionHeightOffset=0,this.pivotPoint=new f,this.zoomDirectionSet=!1,this.zoomPointSet=!1,this.zoomDirection=new f,this.zoomPoint=new f,this.zoomDelta=0,this.rotationInertia=new g,this.dragInertia=new f,this.pivotMesh=new ft,this.pivotMesh.raycast=()=>{},this.pivotMesh.scale.setScalar(.25),this.raycaster=new dt,this.raycaster.firstHitOnly=!0,this.up=new f(0,1,0),this.clock=new ut,this.fallbackPlane=new nt(new f(0,1,0),0),this.useFallbackPlane=!0,this._detachCallback=null,this._upInitialized=!1,this._lastUsedState=_,this._zoomPointWasSet=!1,this._tilesOnChangeCallback=()=>this.zoomPointSet=!1,i&&this.attach(i),e&&this.setCamera(e),t&&this.setScene(t),s&&this.setTilesRenderer(s)}setScene(t){this.scene=t}setCamera(t){this.camera=t,this._upInitialized=!1,this.zoomDirectionSet=!1,this.zoomPointSet=!1,this.needsUpdate=!0,this.raycaster.camera=t,this.resetState()}setTilesRenderer(t){this.tilesRenderer&&this.tilesRenderer.removeEventListener("tile-visibility-change",this._tilesOnChangeCallback),this.tilesRenderer=t,this.tilesRenderer!==null&&(this.tilesRenderer.addEventListener("tile-visibility-change",this._tilesOnChangeCallback),this.scene===null&&this.setScene(this.tilesRenderer.group))}attach(t){if(this.domElement)throw new Error("EnvironmentControls: Controls already attached to element");this.domElement=t,this.pointerTracker.domElement=t,t.style.touchAction="none";let e=!1;const i=o=>{o.preventDefault()},s=o=>{o.key==="Shift"&&(e=!0)},n=o=>{o.key==="Shift"&&(e=!1)},c=o=>{o.preventDefault();const{camera:a,raycaster:m,domElement:C,up:k,pivotMesh:b,pointerTracker:v}=this;if(v.addPointer(o),this.needsUpdate=!0,v.isPointerTouch()){if(b.visible=!1,v.getPointerCount()===0)C.setPointerCapture(o.pointerId);else if(v.getPointerCount()>2){this.resetState();return}}v.getCenterPoint(u),R(u.x,u.y,C,u),W(m,u,a);const G=Math.abs(m.ray.direction.dot(k));if(G{o.preventDefault(),this.zoomDirectionSet=!1,this.zoomPointSet=!1,this.state!==_&&(this.needsUpdate=!0);const{pointerTracker:a}=this;a.setHoverEvent(o),a.updatePointer(o)&&(a.isPointerTouch()&&a.getPointerCount()===2&&(p||(p=!0,queueMicrotask(()=>{p=!1,a.getCenterPoint(B);const m=a.getStartTouchPointerDistance(),C=a.getTouchPointerDistance(),k=C-m;if(this.state===_||this.state===V){a.getCenterPoint(B),a.getStartCenterPoint(tt);const b=2*window.devicePixelRatio,v=B.distanceTo(tt);(Math.abs(k)>b||v>b)&&(Math.abs(k)>v?(this.setState(I),this.zoomDirectionSet=!1):this.setState(w))}if(this.state===I){const b=a.getPreviousTouchPointerDistance();this.zoomDelta+=C-b}else this.state===w&&(this.pivotMesh.visible=this.enabled)}))),this.dispatchEvent(et))},h=o=>{const{pointerTracker:a}=this;a.deletePointer(o),a.getPointerType()==="touch"&&a.getPointerCount()===0&&t.releasePointerCapture(o.pointerId),this.resetState(),this.needsUpdate=!0},P=o=>{o.preventDefault();const{pointerTracker:a}=this;a.setHoverEvent(o),a.updatePointer(o),this.dispatchEvent(it);let m;switch(o.deltaMode){case 2:m=o.deltaY*100;break;case 1:m=o.deltaY*16;break;case 0:m=o.deltaY;break}const C=Math.sign(m),k=Math.log(Math.abs(m)+1);this.zoomDelta-=3*C*k,this.needsUpdate=!0,this._lastUsedState=I,this.dispatchEvent(st)},r=o=>{const{pointerTracker:a}=this;e=!1,o.buttons!==a.getPointerButtons()&&(a.deletePointer(o),this.resetState())};t.addEventListener("contextmenu",i),t.addEventListener("keydown",s),t.addEventListener("keyup",n),t.addEventListener("pointerdown",c),t.addEventListener("pointermove",d),t.addEventListener("pointerup",h),t.addEventListener("wheel",P),t.addEventListener("pointerenter",r),this._detachCallback=()=>{t.removeEventListener("contextmenu",i),t.removeEventListener("keydown",s),t.removeEventListener("keyup",n),t.removeEventListener("pointerdown",c),t.removeEventListener("pointermove",d),t.removeEventListener("pointerup",h),t.removeEventListener("wheel",P),t.removeEventListener("pointerenter",r)}}getUpDirection(t,e){e.copy(this.up)}getCameraUpDirection(t){this.getUpDirection(this.camera.position,t)}getPivotPoint(t){return this._lastUsedState===I?this._zoomPointWasSet?(t.copy(this.zoomPoint),t):null:this._lastUsedState===w||this._lastUsedState===E?(t.copy(this.pivotPoint),t):null}detach(){this.domElement=null,this._detachCallback&&(this._detachCallback(),this._detachCallback=null,this.pointerTracker.reset())}resetState(){this.state!==_&&this.dispatchEvent(st),this.state=_,this.pivotMesh.removeFromParent(),this.pivotMesh.visible=this.enabled,this.actionHeightOffset=0}setState(t=this.state,e=!0){this.state!==t&&(this.state===_&&e&&this.dispatchEvent(it),this.pivotMesh.visible=this.enabled,this.dragInertia.set(0,0,0),this.rotationInertia.set(0,0),this.state=t,t!==_&&t!==V&&(this._lastUsedState=t))}update(t=Math.min(this.clock.getDelta(),64/1e3)){if(!this.enabled||!this.camera||t===0)return;const{camera:e,cameraRadius:i,pivotPoint:s,up:n,state:c,adjustHeight:p}=this;e.updateMatrixWorld(),this.getCameraUpDirection(S),this._upInitialized||(this._upInitialized=!0,this.up.copy(S));const d=this._inertiaNeedsUpdate();if(this.needsUpdate||d){const r=this.zoomDelta;(c===I||r!==0)&&(this._updateZoom(),this.rotationInertia.set(0,0),this.dragInertia.set(0,0,0)),this._updatePosition(t),this._updateRotation(t),(c!==_||r!==0||d)&&this.dispatchEvent(et),this.needsUpdate=!1}d&&this._updateInertiaDamping(t);const h=e.isOrthographicCamera?null:p&&this._getPointBelowCamera()||null,P=e.isOrthographicCamera?s:h&&h.point||null;if(this.getCameraUpDirection(S),this._setFrame(S,P),(this.state===E||this.state===w)&&this.actionHeightOffset!==0){const{actionHeightOffset:r}=this;e.position.addScaledVector(n,-r),s.addScaledVector(n,-r),h&&(h.distance-=r)}if(this.actionHeightOffset=0,h){const r=h.distance;if(r0?1/Math.abs(o):o;i.zoom=Math.max(d,Math.min(h,i.zoom*a*P)),i.updateProjectionMatrix(),R(u.x,u.y,p,N),N.unproject(i),i.position.sub(N).add(H),i.updateMatrixWorld()}else{const o=Math.pow(.95,Math.abs(r*.05)),a=r>0?1/Math.abs(o):o;i.zoom=Math.max(d,Math.min(h,i.zoom*a*P)),i.updateProjectionMatrix()}else{this._updateZoomDirection();const o=y.copy(e);if(this.zoomPointSet||this._updateZoomPoint()){const a=t.distanceTo(i.position);if(r<0){const m=Math.min(0,a-n);r=r*a*P*.0025,r=Math.max(r,m)}else{const m=Math.max(0,a-s);r=r*(a-s)*P*.0025,r=Math.min(r,m)}i.position.addScaledVector(e,r),i.updateMatrixWorld()}else{const a=this._getPointBelowCamera();if(a){const m=a.distance;o.set(0,0,-1).transformDirection(i.matrixWorld),i.position.addScaledVector(o,r*m*.01),i.updateMatrixWorld()}}}}_updateZoomDirection(){if(this.zoomDirectionSet)return;const{domElement:t,raycaster:e,camera:i,zoomDirection:s,pointerTracker:n}=this;n.getLatestPoint(u),R(u.x,u.y,t,H),W(e,H,i),s.copy(e.ray.direction).normalize(),this.zoomDirectionSet=!0}_updateZoomPoint(){const{camera:t,zoomDirectionSet:e,zoomDirection:i,raycaster:s,zoomPoint:n,pointerTracker:c,domElement:p}=this;if(this._zoomPointWasSet=!1,!e)return!1;t.isOrthographicCamera&&c.getLatestPoint(L)?(R(L.x,L.y,p,L),W(s,L,t)):(s.ray.origin.copy(t.position),s.ray.direction.copy(i),s.near=0,s.far=1/0);const d=this._raycast(s);return d?(n.copy(d.point),this.zoomPointSet=!0,this._zoomPointWasSet=!0,!0):!1}_getPointBelowCamera(){const{camera:t,raycaster:e,up:i}=this;e.ray.direction.copy(i).multiplyScalar(-1),e.ray.origin.copy(t.position).addScaledVector(i,1e5),e.near=0,e.far=1/0;const s=this._raycast(e);return s&&(s.distance-=1e5),s}_updatePosition(t){const{raycaster:e,camera:i,pivotPoint:s,up:n,pointerTracker:c,domElement:p,state:d,dragInertia:h,enableDamping:P}=this;if(d===E){if(c.getCenterPoint(u),R(u.x,u.y,p,u),J.setFromNormalAndCoplanarPoint(n,s),W(e,u,i),Math.abs(e.ray.direction.dot(n))0?(h=Math.min(r-n-.01,h),h=Math.max(0,h)):(h=Math.max(r-c,h),h=Math.min(0,h)),M.setFromAxisAngle(S,d),A(i,M,D),s.matrixWorld.premultiply(D),z.set(-1,0,0).transformDirection(s.matrixWorld),M.setFromAxisAngle(z,h),A(i,M,D),s.matrixWorld.premultiply(D),s.matrixWorld.decompose(s.position,s.quaternion,y)}_setFrame(t,e){const{up:i,camera:s,state:n,zoomPoint:c,zoomDirectionSet:p,zoomPointSet:d,reorientOnDrag:h,scaleZoomOrientationAtEdges:P}=this;s.updateMatrixWorld(),M.setFromUnitVectors(i,t);const r=n;if(p&&(d||this._updateZoomPoint())){if(this.getUpDirection(c,y),P){let o=Math.max(y.dot(i)-.6,0)/.4;o=mt.mapLinear(o,0,.5,0,1),o=Math.min(o,1),s.isOrthographicCamera&&(o*=.1),M.slerp(St,1-o)}A(c,M,D),s.matrixWorld.premultiply(D),s.matrixWorld.decompose(s.position,s.quaternion,y),this.zoomDirectionSet=!1,this._updateZoomDirection()}else r===E&&h&&e&&(A(e,M,D),s.matrixWorld.premultiply(D),s.matrixWorld.decompose(s.position,s.quaternion,y));i.copy(t),s.updateMatrixWorld()}_raycast(t){const{scene:e,useFallbackPlane:i,fallbackPlane:s}=this,n=t.intersectObject(e)[0]||null;if(n)return n;if(i){const c=s;if(t.ray.intersectPlane(c,y))return{point:y.clone(),distance:t.ray.origin.distanceTo(y)}}return null}}export{E as D,xt as E,_ as N,R as a,Mt as b,Dt as c,A as m,W as s}; diff --git a/example/bundle/assets/FlyOrbitControls-BAcl0bbv.js b/example/bundle/assets/FlyOrbitControls-BAcl0bbv.js new file mode 100644 index 000000000..8072ddfea --- /dev/null +++ b/example/bundle/assets/FlyOrbitControls-BAcl0bbv.js @@ -0,0 +1 @@ +import{G as _,ah as N,M as F,f as V,d as I,C as P,k as U,ai as W,o as z}from"./three.module-CA-qMkP1.js";import{S as j,a as q}from"./EllipsoidRegionHelper-CaOebIdf.js";import{O as J}from"./OrbitControls-BpFvfpv4.js";const E=Symbol("ORIGINAL_MATERIAL"),k=Symbol("HAS_RANDOM_COLOR"),M=Symbol("HAS_RANDOM_NODE_COLOR"),v=Symbol("LOAD_TIME"),O=new I,L=()=>{},G={};function R(x){if(!G[x]){const e=Math.random(),t=.5+Math.random()*.5,i=.375+Math.random()*.25;G[x]=new P().setHSL(e,t,i)}return G[x]}const C=0,Q=1,X=2,Y=3,Z=4,$=5,ee=6,S=7,w=8,te=9,A=10;class le{constructor(e){e={displayBoxBounds:!1,displaySphereBounds:!1,displayRegionBounds:!1,colorMode:C,maxDebugDepth:-1,maxDebugDistance:-1,maxDebugError:-1,customColorCallback:null,...e},this.name="DEBUG_TILES_PLUGIN",this.tiles=null,this.extremeDebugDepth=-1,this.extremeDebugError=-1,this.boxGroup=null,this.sphereGroup=null,this.regionGroup=null,this.displayBoxBounds=e.displayBoxBounds,this.displaySphereBounds=e.displaySphereBounds,this.displayRegionBounds=e.displayRegionBounds,this.colorMode=e.colorMode,this.maxDebugDepth=e.maxDebugDepth,this.maxDebugDistance=e.maxDebugDistance,this.maxDebugError=e.maxDebugError,this.customColorCallback=e.customColorCallback,this.getDebugColor=(t,i)=>{i.setRGB(t,t,t)}}init(e){this.tiles=e;const t=e.group;this.boxGroup=new _,this.boxGroup.name="DebugTilesRenderer.boxGroup",t.add(this.boxGroup),this.boxGroup.updateMatrixWorld(),this.sphereGroup=new _,this.sphereGroup.name="DebugTilesRenderer.sphereGroup",t.add(this.sphereGroup),this.sphereGroup.updateMatrixWorld(),this.regionGroup=new _,this.regionGroup.name="DebugTilesRenderer.regionGroup",t.add(this.regionGroup),this.regionGroup.updateMatrixWorld(),this._onLoadTileSetCB=()=>{this._initExtremes()},this._onLoadModelCB=({scene:i,tile:a})=>{this._onLoadModel(i,a)},this._onDisposeModelCB=({tile:i})=>{this._onDisposeModel(i)},this._onUpdateAfterCB=()=>{this._onUpdateAfter()},this._onTileVisibilityChangeCB=({scene:i,tile:a,visible:h})=>{this._onTileVisibilityChange(a,h)},e.addEventListener("load-tile-set",this._onLoadTileSetCB),e.addEventListener("load-model",this._onLoadModelCB),e.addEventListener("dispose-model",this._onDisposeModelCB),e.addEventListener("update-after",this._onUpdateAfterCB),e.addEventListener("tile-visibility-change",this._onTileVisibilityChangeCB),e.traverse(i=>{i.cached.scene&&this._onLoadModel(i.cached.scene,i)}),e.visibleTiles.forEach(i=>{this._onTileVisibilityChange(i,!0)})}getTileInformationFromActiveObject(e){let t=null;return this.tiles.activeTiles.forEach(a=>{if(t)return!0;const h=a.cached.scene;h&&h.traverse(n=>{n===e&&(t=a)})}),t?{distanceToCamera:t.__distanceFromCamera,geometricError:t.geometricError,screenSpaceError:t.__error,depth:t.__depth,isLeaf:t.__isLeaf}:null}_initExtremes(){let e=-1;this.tiles.traverse(i=>{e=Math.max(e,i.__depth)});let t=-1;this.tiles.traverse(i=>{t=Math.max(t,i.geometricError)}),this.extremeDebugDepth=e,this.extremeDebugError=t}_onUpdateAfter(){const e=this.tiles;if(!e.root)return;this.boxGroup.visible=this.displayBoxBounds,this.sphereGroup.visible=this.displaySphereBounds,this.regionGroup.visible=this.displayRegionBounds;let t=-1;this.maxDebugDepth===-1?t=this.extremeDebugDepth:t=this.maxDebugDepth;let i=-1;this.maxDebugError===-1?i=this.extremeDebugError:i=this.maxDebugError;let a=-1;this.maxDebugDistance===-1?(e.getBoundingSphere(O),a=O.radius):a=this.maxDebugDistance;const h=this.errorTarget,n=this.colorMode,d=e.visibleTiles;let s;n===A&&(s=Array.from(d).sort((r,u)=>r[v]-u[v])),d.forEach(r=>{const u=r.cached.scene;let b,f,g;n===S&&(b=Math.random(),f=.5+Math.random()*.5,g=.375+Math.random()*.25),u.traverse(o=>{n===w&&(b=Math.random(),f=.5+Math.random()*.5,g=.375+Math.random()*.25);const D=o.material;if(D){const y=o[E];if(n===C&&D!==y)o.material.dispose(),o.material=o[E];else if(n!==C&&D===y)if(o.isPoints){const l=new N;l.size=y.size,l.sizeAttenuation=y.sizeAttenuation,o.material=l}else o.material=new F,o.material.flatShading=!0;switch(n!==S&&delete o.material[k],n!==w&&delete o.material[M],n){case Z:{const l=r.__depth/t;this.getDebugColor(l,o.material.color);break}case $:{const l=r.__depthFromRenderedParent/t;this.getDebugColor(l,o.material.color);break}case Q:{const l=r.__error/h;l>1?o.material.color.setRGB(1,0,0):this.getDebugColor(l,o.material.color);break}case X:{const l=Math.min(r.geometricError/i,1);this.getDebugColor(l,o.material.color);break}case Y:{const l=Math.min(r.__distanceFromCamera/a,1);this.getDebugColor(l,o.material.color);break}case ee:{!r.children||r.children.length===0?this.getDebugColor(1,o.material.color):this.getDebugColor(0,o.material.color);break}case w:{o.material[M]||(o.material.color.setHSL(b,f,g),o.material[M]=!0);break}case S:{o.material[k]||(o.material.color.setHSL(b,f,g),o.material[k]=!0);break}case te:{this.customColorCallback?this.customColorCallback(r,o):console.warn("DebugTilesRenderer: customColorCallback not defined");break}case A:{const l=s.indexOf(r);this.getDebugColor(l/(s.length-1),o.material.color);break}}}})})}_onTileVisibilityChange(e,t){const i=e.cached,a=this.sphereGroup,h=this.boxGroup,n=this.regionGroup,d=i.boxHelperGroup,s=i.sphereHelper,r=i.regionHelper;t?(d&&(h.add(d),d.updateMatrixWorld(!0)),s&&(a.add(s),s.updateMatrixWorld(!0)),r&&(n.add(r),r.updateMatrixWorld(!0))):(d&&h.remove(d),s&&a.remove(s),r&&n.remove(r))}_onLoadModel(e,t){t[v]=performance.now();const i=this.tiles,a=t.cached,{sphere:h,obb:n,region:d}=a.boundingVolume;if(n){const s=new _;s.name="DebugTilesRenderer.boxHelperGroup",s.matrix.copy(n.transform),s.matrixAutoUpdate=!1;const r=new V(n.box,R(t.__depth));r.raycast=L,s.add(r),a.boxHelperGroup=s,i.visibleTiles.has(t)&&this.displayBoxBounds&&(this.boxGroup.add(s),s.updateMatrixWorld(!0))}if(h){const s=new j(h,R(t.__depth));s.raycast=L,a.sphereHelper=s,i.visibleTiles.has(t)&&this.displaySphereBounds&&(this.sphereGroup.add(s),s.updateMatrixWorld(!0))}if(d){const s=new q(d,R(t.__depth));s.raycast=L;const r=new I;d.getBoundingSphere(r),s.position.copy(r.center),r.center.multiplyScalar(-1),s.geometry.translate(...r.center),a.regionHelper=s,i.visibleTiles.has(t)&&this.displayRegionBounds&&(this.regionGroup.add(s),s.updateMatrixWorld(!0))}e.traverse(s=>{const r=s.material;r&&(s[E]=r)})}_onDisposeModel(e){const t=e.cached;t.boxHelperGroup&&(t.boxHelperGroup.children[0].geometry.dispose(),delete t.boxHelperGroup),t.sphereHelper&&(t.sphereHelper.geometry.dispose(),delete t.sphereHelper),t.regionHelper&&(t.regionHelper.geometry.dispose(),delete t.regionHelper)}dispose(){const e=this.tiles;e.removeEventListener("load-tile-set",this._onLoadTileSetCB),e.removeEventListener("load-model",this._onLoadModelCB),e.removeEventListener("dispose-model",this._onDisposeModelCB),e.removeEventListener("update-after",this._onUpdateAfterCB),this.colorMode=C,this._onUpdateAfter(),e.traverse(t=>{this._onDisposeModel(t)}),this.boxGroup.removeFromParent(),this.sphereGroup.removeFromParent(),this.regionGroup.removeFromParent()}}const se={type:"fly-change"},re={type:"fly-start"},ie={type:"fly-end"},p=new W(0,0,0,0);class he extends J{constructor(e,t){const i=c=>{this.enabled&&Object.defineProperty(c,"shiftKey",{get(){return!1}})};t.addEventListener("pointerdown",i),super(e,t),this.enableKeys=!1,this.enableFlight=!0,this.baseSpeed=1,this.fastSpeed=4,this.forwardKey="w",this.backKey="s",this.leftKey="a",this.rightKey="d",this.upKey="q",this.downKey="e",this.fastKey="shift";let a=!1,h=!1,n=!1,d=!1,s=!1,r=!1,u=!1,b=0,f=0,g=0,o=-1;const D=new U,y=new z,l=()=>{if(o!==-1){cancelAnimationFrame(o),o=-1,this.minDistance=f,this.maxDistance=g;const c=Math.min(b,e.position.distanceTo(D));p.set(0,0,-1,0).applyMatrix4(e.matrixWorld),this.target.copy(e.position).addScaledVector(p,c),this.dispatchEvent(ie)}},H=()=>{if(!this.enabled||!this.enableFlight)return;o=requestAnimationFrame(H),p.set(0,0,0,0),h&&(p.z-=1),n&&(p.z+=1),d&&(p.x-=1),s&&(p.x+=1),r&&(p.y+=1),u&&(p.y-=1),p.applyMatrix4(e.matrixWorld);const c=60*y.getDelta(),m=a?this.fastSpeed:this.baseSpeed;e.position.addScaledVector(p,m*c),this.target.addScaledVector(p,m*c),this.dispatchEvent(se)},T=c=>{const m=c.key.toLowerCase();switch(o===-1&&(g=this.maxDistance,f=this.minDistance,b=e.position.distanceTo(this.target),D.copy(this.target)),m){case this.forwardKey:h=!0;break;case this.backKey:n=!0;break;case this.leftKey:d=!0;break;case this.rightKey:s=!0;break;case this.upKey:r=!0;break;case this.downKey:u=!0;break;case this.fastKey:a=!0;break}switch(m){case this.fastKey:case this.forwardKey:case this.backKey:case this.leftKey:case this.rightKey:case this.upKey:case this.downKey:c.stopPropagation(),c.preventDefault()}(h||n||d||s||r||u||a)&&(this.minDistance=.01,this.maxDistance=.01,p.set(0,0,-1,0).applyMatrix4(e.matrixWorld),this.target.copy(e.position).addScaledVector(p,.01),o===-1&&(this.dispatchEvent(re),y.getDelta(),H()))},B=c=>{const m=c.key.toLowerCase();switch(m){case this.fastKey:case this.forwardKey:case this.backKey:case this.leftKey:case this.rightKey:case this.upKey:case this.downKey:c.stopPropagation(),c.preventDefault()}switch(m){case this.forwardKey:h=!1;break;case this.backKey:n=!1;break;case this.leftKey:d=!1;break;case this.rightKey:s=!1;break;case this.upKey:r=!1;break;case this.downKey:u=!1;break;case this.fastKey:a=!1;break}h||n||d||s||r||u||a||l()},K=()=>{l()};this.blurCallback=K,this.keyDownCallback=T,this.keyUpCallback=B,this.disableShiftKeyCallback=i,this.domElement.addEventListener("blur",K),this.domElement.addEventListener("keydown",T),this.domElement.addEventListener("keyup",B)}dispose(){super.dispose(),this.domElement.removeEventListener("blur",this.blurCallback),this.domElement.removeEventListener("keydown",this.keyDownCallback),this.domElement.removeEventListener("keyup",this.keyUpCallback),this.domElement.removeEventListener("pointerdown",this.disableShiftKeyCallback)}}export{te as C,Y as D,he as F,X as G,ee as I,A as L,C as N,$ as R,Q as S,Z as a,S as b,w as c,le as d}; diff --git a/example/bundle/assets/GLTFExtensionLoader-Bl-gplNT.js b/example/bundle/assets/GLTFExtensionLoader-Bl-gplNT.js new file mode 100644 index 000000000..8196d2738 --- /dev/null +++ b/example/bundle/assets/GLTFExtensionLoader-Bl-gplNT.js @@ -0,0 +1 @@ +import{b8 as d}from"./three.module-CA-qMkP1.js";import{G as l}from"./GLTFLoader-JNhhxs0g.js";import{L as p}from"./LoaderBase-CVSPpjX2.js";class h{constructor(){this.name="CESIUM_RTC"}afterRoot(e){if(e.parser.json.extensions&&e.parser.json.extensions.CESIUM_RTC){const{center:t}=e.parser.json.extensions.CESIUM_RTC;t&&(e.scene.position.x+=t[0],e.scene.position.y+=t[1],e.scene.position.z+=t[2])}}}class u extends p{constructor(e=d){super(),this.manager=e}parse(e){return new Promise((t,o)=>{const a=this.manager,n=this.fetchOptions;let s=a.getHandler("path.gltf")||a.getHandler("path.glb");s||(s=new l(a),s.register(()=>new h)),n.credentials==="include"&&n.mode==="cors"&&s.setCrossOrigin("use-credentials"),"credentials"in n&&s.setWithCredentials(n.credentials==="include"),n.headers&&s.setRequestHeader(n.headers);let r=s.resourcePath||s.path||this.workingPath;!/[\\/]$/.test(r)&&r.length&&(r+="/"),s.parse(e,r,c=>{t(c)},o)})}}export{u as G,h as a}; diff --git a/example/bundle/assets/GLTFLoader-JNhhxs0g.js b/example/bundle/assets/GLTFLoader-JNhhxs0g.js new file mode 100644 index 000000000..8256f173b --- /dev/null +++ b/example/bundle/assets/GLTFLoader-JNhhxs0g.js @@ -0,0 +1 @@ +import{ba as Re,bb as W,bc as ce,q as Ee,bd as G,F as ue,C,a2 as w,be as xe,bf as _e,D as Le,aa as k,a1 as B,az as b,V as le,k as F,b9 as Se,bg as be,aq as fe,af as Me,ae as we,al as j,bh as ye,v as de,w as he,bi as Y,ah as Ne,aK as K,am as Ie,M as pe,aR as Oe,bj as Ce,ak as Fe,bk as De,g as Pe,aj as He,av as ke,bl as Ge,bm as Be,G as V,a as Ue,n as ve,O as je,bn as Ke,bo as Ve,bp as Xe,bq as me,br as J,p as U,Q as Ae,bs as ze,bt as qe,bu as We,bv as Ye,aW as Qe,bw as Ze,bx as Je,aw as $e,by as et,aI as $,bz as ee,bA as te,bB as ne,B as tt,d as nt,bC as st}from"./three.module-CA-qMkP1.js";function Bt(f){let t=0;for(const i in f.attributes){const n=f.getAttribute(i);t+=n.count*n.itemSize*n.array.BYTES_PER_ELEMENT}const e=f.getIndex();return t+=e?e.count*e.itemSize*e.array.BYTES_PER_ELEMENT:0,t}function se(f,t){if(t===Re)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(t===W||t===ce){let e=f.getIndex();if(e===null){const s=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o=2.0 are supported."));return}const c=new Ht(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,r){i.parse(t,e,n,r)})}}function rt(){let f={};return{get:function(t){return f[t]},add:function(t,e){f[t]=e},remove:function(t){delete f[t]},removeAll:function(){f={}}}}const A={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class it{constructor(t){this.parser=t,this.name=A.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Rt{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Et{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class xt{constructor(t){this.name=A.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,l=n.count,u=n.byteStride,d=new Uint8Array(a,o,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(l,u,d,n.mode,n.filter).then(function(h){return h.buffer}):s.ready.then(function(){const h=new ArrayBuffer(l*u);return s.decodeGltfBuffer(new Uint8Array(h),l,u,d,n.mode,n.filter),h})})}else return null}}class _t{constructor(t){this.name=A.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=e.meshes[i.mesh];for(const c of n.primitives)if(c.mode!==_.TRIANGLES&&c.mode!==_.TRIANGLE_STRIP&&c.mode!==_.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=i.extensions[this.name].attributes,a=[],o={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(l=>(o[c]=l,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const l=c.pop(),u=l.isGroup?l.children:[l],d=c[0].count,h=[];for(const p of u){const T=new U,m=new F,g=new Ae,E=new F(1,1,1),x=new Se(p.geometry,p.material,d);for(let R=0;R0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Pt=new U;class Ht{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new rt,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=-1,r=!1,s=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=i&&o?parseInt(o[1],10):-1,r=a.indexOf("Firefox")>-1,s=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&n<17||r&&s<98?this.textureLoader=new Me(this.options.manager):this.textureLoader=new we(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ue(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:i,userData:{}};return O(r,a,n),M(a,n),Promise.all(i._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let n=0,r=e.length;n{const o=this.associations.get(s);o!=null&&this.associations.set(a,o);for(const[c,l]of s.children.entries())r(l,a.children[c])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i=2&&m.setY(N,y[L*o+1]),o>=3&&m.setZ(N,y[L*o+2]),o>=4&&m.setW(N,y[L*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(t){const e=this.json,i=this.options,r=e.textures[t].source,s=e.images[r];let a=this.textureLoader;if(s.uri){const o=i.manager.getHandler(s.uri);o!==null&&(a=o)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,i){const n=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,i).then(function(l){l.flipY=!1,l.name=s.name||a.name||"",l.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(l.name=a.uri);const d=(r.samplers||{})[s.sampler]||{};return l.magFilter=ie[d.magFilter]||de,l.minFilter=ie[d.minFilter]||he,l.wrapS=oe[d.wrapS]||Y,l.wrapT=oe[d.wrapT]||Y,n.associations.set(l,{textures:t}),l}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const i=this,n=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());const s=n.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",c=!1;if(s.bufferView!==void 0)o=i.getDependency("bufferView",s.bufferView).then(function(u){c=!0;const d=new Blob([u],{type:s.mimeType});return o=a.createObjectURL(d),o});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(o).then(function(u){return new Promise(function(d,h){let p=d;e.isImageBitmapLoader===!0&&(p=function(T){const m=new $(T);m.needsUpdate=!0,d(m)}),e.load(G.resolveURL(u,r.path),p,void 0,h)})}).then(function(u){return c===!0&&a.revokeObjectURL(o),M(u,s),u.userData.mimeType=s.mimeType||Dt(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),u});return this.sourceCache[t]=l,l}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),r.extensions[A.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[A.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(s);s=r.extensions[A.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,o)}}return n!==void 0&&(s.colorSpace=n),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,s=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new Ne,K.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,o.sizeAttenuation=!1,this.cache.add(a,o)),i=o}else if(t.isLine){const a="LineBasicMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new Ie,K.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,this.cache.add(a,o)),i=o}if(n||r||s){let a="ClonedMaterial:"+i.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=i.clone(),r&&(o.vertexColors=!0),s&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(i))),i=o}t.material=i}getMaterialType(){return pe}loadMaterial(t){const e=this,i=this.json,n=this.extensions,r=i.materials[t];let s;const a={},o=r.extensions||{},c=[];if(o[A.KHR_MATERIALS_UNLIT]){const u=n[A.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(a,r,e))}else{const u=r.pbrMetallicRoughness||{};if(a.color=new C(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],w),a.opacity=d[3]}u.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",u.baseColorTexture,B)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),s=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=Oe);const l=r.alphaMode||z.OPAQUE;if(l===z.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===z.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==k&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new le(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;a.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&s!==k&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==k){const u=r.emissiveFactor;a.emissive=new C().setRGB(u[0],u[1],u[2],w)}return r.emissiveTexture!==void 0&&s!==k&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,B)),Promise.all(c).then(function(){const u=new s(a);return r.name&&(u.name=r.name),M(u,r),e.associations.set(u,{materials:t}),r.extensions&&O(n,u,r),u})}createUniqueName(t){const e=Ce.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function r(a){return i[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return ae(o,a,e)})}const s=[];for(let a=0,o=t.length;a0&&Ct(g,r),g.name=e.createUniqueName(r.name||"mesh_"+t),M(g,r),m.extensions&&O(n,g,m),e.assignFinalMaterial(g),u.push(g)}for(let h=0,p=u.length;h1?l=new V:c.length===1?l=c[0]:l=new fe,l!==c[0])for(let u=0,d=c.length;u{const u=new Map;for(const[d,h]of n.associations)(d instanceof K||d instanceof $)&&u.set(d,h);return l.traverse(d=>{const h=n.associations.get(d);h!=null&&u.set(d,h)}),u};return n.associations=c(r),r})}_createAnimationTracks(t,e,i,n,r){const s=[],a=t.name?t.name:t.uuid,o=[];I[r.path]===I.weights?t.traverse(function(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}):o.push(a);let c;switch(I[r.path]){case I.weights:c=te;break;case I.rotation:c=ne;break;case I.position:case I.scale:c=ee;break;default:switch(i.itemSize){case 1:c=te;break;case 2:case 3:default:c=ee;break}break}const l=n.interpolation!==void 0?Nt[n.interpolation]:me,u=this._getArrayFromAccessor(i);for(let d=0,h=o.length;do.value===r);return n===null?"":n.name}}adjustValueScaleOffset(e){return ie(this.type)?Ce(this,e):e}}class G{constructor(e,s={},t={},r=null){this.definition=e,this.class=s[e.class],this.className=e.class,this.enums=t,this.data=r,this.name="name"in e?e.name:null,this.properties=null}getPropertyNames(){return Object.keys(this.class.properties)}includesData(e){return!!this.definition.properties[e]}dispose(){}_initProperties(e=R){const s={};for(const t in this.class.properties)s[t]=new e(this.enums,this.class.properties[t],this.definition.properties[t]);this.properties=s}}class ge extends R{constructor(e,s,t=null){super(e,s,t),this.attribute=t.attribute}}class Me extends G{constructor(...e){super(...e),this.isPropertyAttributeAccessor=!0,this._initProperties(ge)}getData(e,s,t={}){const r=this.properties;M(r,t);for(const n in r)t[n]=this.getPropertyValue(n,e,s,t[n]);return t}getPropertyValue(e,s,t,r=null){if(s>=this.count)throw new Error("PropertyAttributeAccessor: Requested index is outside the range of the buffer.");const n=this.properties[e],o=n.type;if(n){if(!this.definition.properties[e])return n.resolveDefault(r)}else throw new Error("PropertyAttributeAccessor: Requested class property does not exist.");r=n.shapeToProperty(r);const a=t.getAttribute(n.attribute.toLowerCase());if(V(o)){const u=r.elements;for(let f=0,p=u.length;f>h&1)===1}return r}getPropertyValue(e,s,t=null){if(s>=this.count)throw new Error("PropertyTableAccessor: Requested index is outside the range of the table.");const r=this.properties[e];if(r){if(!this.definition.properties[e])return r.resolveDefault(t)}else throw new Error("PropertyTableAccessor: Requested property does not exist.");const n=r.array,o=this.data,a=r.getArrayLengthFromId(o,s);if(t=r.shapeToProperty(t,a),n)for(let u=0,f=t.length;u=165,Le=parseInt(ne)>=166,O=new be,k=new re,U=new T,E=new class{constructor(){this._renderer=new Ae,this._target=new v(1,1),this._texTarget=new v,this._quad=new Be(new Te({blending:xe,blendDst:we,blendSrc:Ee,uniforms:{map:{value:null},pixel:{value:new T}},vertexShader:` + void main() { + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + } + `,fragmentShader:` + uniform sampler2D map; + uniform ivec2 pixel; + + void main() { + + gl_FragColor = texelFetch( map, pixel, 0 ); + + } + `}))}increaseSizeTo(i){this._target.setSize(Math.max(this._target.width,i),1)}readDataAsync(i){const{_renderer:e,_target:s}=this;return X?e.readRenderTargetPixelsAsync(s,0,0,i.length/4,1,i):Promise.resolve().then(()=>this.readData(i))}readData(i){const{_renderer:e,_target:s}=this;e.readRenderTargetPixels(s,0,0,i.length/4,1,i)}renderPixelToTarget(i,e,s){const{_quad:t,_renderer:r,_target:n,_texTarget:o}=this;if(Le)O.min.copy(e),O.max.copy(e),O.max.x+=1,O.max.y+=1,r.initRenderTarget(n),r.copyTextureToTexture(i,n.texture,O,s,0);else{const a=r.autoClear,u=r.getRenderTarget(),f=r.getScissorTest();r.getScissor(k),o.setSize(i.image.width,i.image.height),r.setRenderTarget(o),U.set(0,0),X?r.copyTextureToTexture(i,o.texture,null,U):r.copyTextureToTexture(U,i,o.texture),t.material.uniforms.map.value=o.texture,t.material.uniforms.pixel.value.copy(e),r.setRenderTarget(n),r.setScissorTest(!0),r.setScissor(s.x,s.y,1,1),r.autoClear=!1,t.render(r),r.setScissorTest(f),r.setScissor(k),r.setRenderTarget(u),r.autoClear=a,o.dispose()}}},$=new T,Q=new T,W=new T;function je(i,e){return e===0?i.getAttribute("uv"):i.getAttribute(`uv${e}`)}function ae(i,e,s=new Array(3)){let t=3*e,r=3*e+1,n=3*e+2;return i.index&&(t=i.index.getX(t),r=i.index.getX(r),n=i.index.getX(n)),s[0]=t,s[1]=r,s[2]=n,s}function ue(i,e,s,t,r){const[n,o,a]=t,u=je(i,e);$.fromBufferAttribute(u,n),Q.fromBufferAttribute(u,o),W.fromBufferAttribute(u,a),r.set(0,0,0).addScaledVector($,s.x).addScaledVector(Q,s.y).addScaledVector(W,s.z)}function ce(i,e,s,t){const r=i.x-Math.floor(i.x),n=i.y-Math.floor(i.y),o=Math.floor(r*e%e),a=Math.floor(n*s%s);return t.set(o,a),t}const H=new T,Z=new T,J=new T;class Ge extends R{constructor(e,s,t=null){super(e,s,t),this.channels=d(t,"channels",[0]),this.index=d(t,"index",null),this.texCoord=d(t,"texCoord",null),this.valueLength=parseInt(this.type.replace(/[^0-9]/g,""))||1}readDataFromBuffer(e,s,t=null){const r=this.type;if(r==="BOOLEAN"||r==="STRING")throw new Error("PropertyTextureAccessor: BOOLEAN and STRING types not supported.");return oe(e,s*this.valueLength,r,t)}}class ze extends G{constructor(...e){super(...e),this.isPropertyTextureAccessor=!0,this._asyncRead=!1,this._initProperties(Ge)}getData(e,s,t,r={}){const n=this.properties;M(n,r);const o=Object.keys(n),a=o.map(u=>r[u]);return this.getPropertyValuesAtTexel(o,e,s,t,a),o.forEach((u,f)=>r[u]=a[f]),r}async getDataAsync(e,s,t,r={}){const n=this.properties;M(n,r);const o=Object.keys(n),a=o.map(u=>r[u]);return await this.getPropertyValuesAtTexelAsync(o,e,s,t,a),o.forEach((u,f)=>r[u]=a[f]),r}getPropertyValuesAtTexelAsync(...e){this._asyncRead=!0;const s=this.getPropertyValuesAtTexel(...e);return this._asyncRead=!1,s}getPropertyValuesAtTexel(e,s,t,r,n=[]){for(;n.length(c.call(this),n));return E.readData(p),c.call(this),n;function c(){for(let l=0,y=e.length;lp[4*l+I]),w=h.componentType,D=S(w,A),F=new D(x);if(new Uint8Array(F.buffer).set(b),h.array){const I=n[l];for(let N=0,le=I.length;N{e&&(e.dispose(),e.image instanceof ImageBitmap&&e.image.close())})}}class K{constructor(e,s,t,r=null,n=null){const{schema:o,propertyTables:a=[],propertyTextures:u=[],propertyAttributes:f=[]}=e,{enums:p,classes:c}=o,l=a.map(h=>new Re(h,c,p,t));let y=[],m=[];r&&(r.propertyTextures&&(y=r.propertyTextures.map(h=>new ze(u[h],c,p,s))),r.propertyAttributes&&(m=r.propertyAttributes.map(h=>new Me(f[h],c,p)))),this.schema=o,this.tableAccessors=l,this.textureAccessors=y,this.attributeAccessors=m,this.object=n,this.textures=s,this.nodeMetadata=r}getPropertyTableData(e,s,t=null){if(!Array.isArray(e)||!Array.isArray(s))t=t||{},t=this.tableAccessors[e].getData(s,t);else{t=t||[];const r=Math.min(e.length,s.length);t.length=r;for(let n=0;nt)),Array.isArray(e))return e.map(s=>{const t=this.tableAccessors[s];return{name:t.name,className:t.definition.class}});{const s=this.tableAccessors[e];return{name:s.name,className:s.definition.class}}}getPropertyTextureData(e,s,t=[]){const r=this.textureAccessors;t.length=r.length;for(let n=0;n{t[o]=f});n.push(u)}return await Promise.all(n),t}getPropertyTextureInfo(){return this.textureAccessors}getPropertyAttributeData(e,s=[]){const t=this.attributeAccessors;s.length=t.length;for(let r=0;r({name:e.name,className:e.definition.class}))}dispose(){this.textureAccessors.forEach(e=>e.dispose()),this.tableAccessors.forEach(e=>e.dispose()),this.attributeAccessors.forEach(e=>e.dispose())}}const _="EXT_structural_metadata";function ve(i,e=[]){var r;const s=((r=i.json.textures)==null?void 0:r.length)||0,t=new Array(s).fill(null);return e.forEach(({properties:n})=>{for(const o in n){const{index:a}=n[o];t[a]===null&&(t[a]=i.loadTexture(a))}}),Promise.all(t)}function qe(i,e=[]){var r;const s=((r=i.json.bufferViews)==null?void 0:r.length)||0,t=new Array(s).fill(null);return e.forEach(({properties:n})=>{for(const o in n){const{values:a,arrayOffsets:u,stringOffsets:f}=n[o];t[a]===null&&(t[a]=i.loadBufferView(a)),t[u]===null&&(t[u]=i.loadBufferView(u)),t[f]===null&&(t[f]=i.loadBufferView(f))}}),Promise.all(t)}class Qe{constructor(e){this.parser=e,this.name=_}async afterRoot({scene:e,parser:s}){const t=s.json.extensionsUsed;if(!t||!t.includes(_))return;let r=null,n=s.json.extensions[_];if(n.schemaUri){const{manager:f,path:p,requestHeader:c,crossOrigin:l}=s.options,y=new URL(n.schemaUri,p).toString(),m=new Ie(f);m.setCrossOrigin(l),m.setResponseType("json"),m.setRequestHeader(c),r=m.loadAsync(y).then(h=>{n={...n,schema:h}})}const[o,a]=await Promise.all([ve(s,n.propertyTextures),qe(s,n.propertyTables),r]),u=new K(n,o,a);e.userData.structuralMetadata=u,e.traverse(f=>{if(s.associations.has(f)){const{meshes:p,primitives:c}=s.associations.get(f),l=s.json.meshes[p].primitives[c];if(l&&l.extensions&&l.extensions[_]){const y=l.extensions[_];f.userData.structuralMetadata=new K(n,o,a,y,f)}else f.userData.structuralMetadata=u}})}}const Y=new T,ee=new T,te=new T;function Xe(i){return i.x>i.y&&i.x>i.z?0:i.y>i.z?1:2}class ke{constructor(e,s,t){this.geometry=e,this.textures=s,this.data=t,this._asyncRead=!1,this.featureIds=t.featureIds.map(r=>{const{texture:n,...o}=r,a={label:null,propertyTable:null,nullFeatureId:null,...o};return n&&(a.texture={texCoord:0,channels:[0],...n}),a})}getTextures(){return this.textures}getFeatureInfo(){return this.featureIds}getFeaturesAsync(...e){this._asyncRead=!0;const s=this.getFeatures(...e);return this._asyncRead=!1,s}getFeatures(e,s){const{geometry:t,textures:r,featureIds:n}=this,o=new Array(n.length).fill(null),a=n.length;E.increaseSizeTo(a);const u=ae(t,e),f=u[Xe(s)];for(let l=0,y=n.length;l(c(),o));return E.readData(p),c(),o;function c(){const l=new Uint32Array(1);for(let y=0,m=n.length;yp[4*y+D]);new Uint8Array(l.buffer).set(b);const w=l[0];w!==A&&(o[y]=w)}}}}dispose(){this.textures.forEach(e=>{e&&(e.dispose(),e.image instanceof ImageBitmap&&e.image.close())})}}const P="EXT_mesh_features";function se(i,e,s){i.traverse(t=>{if(e.associations.has(t)){const{meshes:r,primitives:n}=e.associations.get(t),o=e.json.meshes[r].primitives[n];o&&o.extensions&&o.extensions[P]&&s(t,o.extensions[P])}})}class We{constructor(e){this.parser=e,this.name=P}async afterRoot({scene:e,parser:s}){var a;const t=s.json.extensionsUsed;if(!t||!t.includes(P))return;const r=((a=s.json.textures)==null?void 0:a.length)||0,n=new Array(r).fill(null);se(e,s,(u,{featureIds:f})=>{f.forEach(p=>{if(p.texture&&n[p.texture.index]===null){const c=p.texture.index;n[c]=s.loadTexture(c)}})});const o=await Promise.all(n);se(e,s,(u,f)=>{u.userData.meshFeatures=new ke(u.geometry,o,f)})}}export{We as G,Qe as a}; diff --git a/example/bundle/assets/GlobeControls-B_ZEgOcW.js b/example/bundle/assets/GlobeControls-B_ZEgOcW.js new file mode 100644 index 000000000..a1f147835 --- /dev/null +++ b/example/bundle/assets/GlobeControls-B_ZEgOcW.js @@ -0,0 +1 @@ +import{p as N,k as D,i as q,V as E,Q as Z,n as p}from"./three.module-CA-qMkP1.js";import{E as H,c as A,N as L,D as j,m as W,a as V,s as k,b as I}from"./EnvironmentControls-7w_Q0bky.js";import{E as Q}from"./Ellipsoid-_mEueZip.js";const u=new N,x=new N,y=new D,s=new D,f=new D,R=new D,c=new D,v=new D,T=new D,O=new D,l=new Z,F=new D,w=new D,G={},P=new q,S=new Q,M=new E,C=new E,z=new E,B=400;class $ extends H{get ellipsoid(){return this.tilesRenderer?this.tilesRenderer.ellipsoid:null}get tilesGroup(){return this.tilesRenderer?this.tilesRenderer.group:null}constructor(t=null,i=null,o=null,r=null){super(t,i,o),this._dragMode=0,this._rotationMode=0,this.maxZoom=.01,this.useFallbackPlane=!1,this.reorientOnDrag=!1,this.inertiaAxis=new D,this.dragQuaternion=new Z,this.inertiaDragMode=0,this.allowNegativeNearPlanes=!0,this.setTilesRenderer(r)}setScene(t){t===null&&this.tilesRenderer!==null?super.setScene(this.tilesRenderer.group):super.setScene(t)}getPivotPoint(t){const{camera:i,tilesGroup:o,ellipsoid:r}=this;return c.set(0,0,-1).transformDirection(i.matrixWorld),u.copy(o.matrixWorld).invert(),P.origin.copy(i.position),P.direction.copy(c),P.applyMatrix4(u),A(P,r,s),s.applyMatrix4(o.matrixWorld),(super.getPivotPoint(t)===null||t.distanceTo(P.origin)>s.distanceTo(P.origin))&&t.copy(s),t}getVectorToCenter(t){const{tilesGroup:i,camera:o}=this;return t.setFromMatrixPosition(i.matrixWorld).sub(o.position)}getDistanceToCenter(){return this.getVectorToCenter(s).length()}getUpDirection(t,i){const{tilesGroup:o,ellipsoid:r}=this;u.copy(o.matrixWorld).invert(),s.copy(t).applyMatrix4(u),r.getPositionToNormal(s,i),i.transformDirection(o.matrixWorld)}getCameraUpDirection(t){const{tilesGroup:i,ellipsoid:o,camera:r}=this;r.isOrthographicCamera?(this._getVirtualOrthoCameraPosition(s),u.copy(i.matrixWorld).invert(),s.applyMatrix4(u),o.getPositionToNormal(s,t),t.transformDirection(i.matrixWorld)):this.getUpDirection(r.position,t)}update(t=Math.min(this.clock.getDelta(),64/1e3)){if(!this.enabled||!this.tilesGroup||!this.camera||t===0)return;const{camera:i,tilesGroup:o,pivotMesh:r}=this;if(this._isNearControls()?this.scaleZoomOrientationAtEdges=this.zoomDelta<0:(this.state!==L&&this._dragMode!==1&&this._rotationMode!==1&&(r.visible=!1),this.scaleZoomOrientationAtEdges=!1),super.update(t),i.isPerspectiveCamera){let e=this.getDistanceToCenter();const n=this._getMaxPerspectiveDistance();e>n&&(s.setFromMatrixPosition(o.matrixWorld).sub(i.position).normalize().multiplyScalar(-1),i.position.setFromMatrixPosition(o.matrixWorld).addScaledVector(s,n),i.updateMatrixWorld(),e=n)}this.updateCameraClipPlanes(i)}updateCameraClipPlanes(t){const{tilesGroup:i,ellipsoid:o}=this;if(t.isPerspectiveCamera){const r=s.setFromMatrixPosition(i.matrixWorld).sub(t.position).length(),e=Math.max(...o.radius),n=.25*e,a=p.clamp((r-e)/n,0,1),m=p.lerp(1,1e3,a);t.near=Math.max(m,r-e-n);const d=u.copy(i.matrixWorld).invert();y.copy(t.position).applyMatrix4(d),o.getPositionToCartographic(y,G);const h=Math.max(o.getPositionElevation(y),B),g=o.calculateHorizonDistance(G.lat,h);t.far=g*2.5+.1,t.updateProjectionMatrix()}else{this._getVirtualOrthoCameraPosition(t.position,t),t.updateMatrixWorld(),u.copy(t.matrixWorld).invert(),s.setFromMatrixPosition(i.matrixWorld).applyMatrix4(u);const r=-s.z;t.near=r-Math.max(...o.radius)*1.1,t.far=r+.1,!this.allowNegativeNearPlanes&&t.near<0&&(t.position.addScaledVector(c,t.near),t.far-=t.near,t.near=0),t.updateProjectionMatrix(),t.updateMatrixWorld()}}resetState(){super.resetState(),this._dragMode=0,this._rotationMode=0}_updatePosition(t){if(this.state!==j){const{enableDamping:i,inertiaDragMode:o,tilesGroup:r,dragQuaternion:e,dragInertia:n,camera:a}=this;i&&(o===1?(e.w===1&&(e.x!==0||e.y!==0||e.z!==0)&&(e.w=Math.min(e.w,1-1e-9)),f.setFromMatrixPosition(r.matrixWorld),l.identity().slerp(e,n.x*t),W(f,l,x),a.matrixWorld.premultiply(x),a.matrixWorld.decompose(a.position,a.quaternion,s)):o===-1&&this._applyZoomedOutRotation(n.x*t,n.y*t))}else if(this._dragMode===1||this._isNearControls()){this._dragMode=1;const{raycaster:i,camera:o,pivotPoint:r,pointerTracker:e,domElement:n,tilesGroup:a}=this,m=y,d=T;e.getCenterPoint(M),V(M.x,M.y,n,M),k(i,M,o),u.copy(a.matrixWorld).invert(),i.ray.applyMatrix4(u);const h=s.copy(r).applyMatrix4(u).length();S.radius.setScalar(h),o.isPerspectiveCamera?S.intersectRay(i.ray,s)||I(i.ray,h,s):A(i.ray,S,s),s.applyMatrix4(a.matrixWorld),f.setFromMatrixPosition(a.matrixWorld),m.subVectors(r,f).normalize(),d.subVectors(s,f).normalize(),l.setFromUnitVectors(d,m),W(f,l,x),o.matrixWorld.premultiply(x),o.matrixWorld.decompose(o.position,o.quaternion,s),this.inertiaDragMode=1;const{dragInertia:g,dragQuaternion:_}=this;e.getMoveDistance()/t<2*window.devicePixelRatio?(_.slerp(l,.5),g.set(1/t,0,0)):(_.copy(l),g.set(1/t,0,0))}else{this._dragMode=-1;const{pointerTracker:i,rotationSpeed:o,camera:r,pivotMesh:e,tilesGroup:n,ellipsoid:a,domElement:m}=this;let d;if(r.isPerspectiveCamera){i.getCenterPoint(M),i.getPreviousCenterPoint(C),V(M.x,M.y,m,M),V(C.x,C.y,m,C),s.set(M.x,M.y,-1).unproject(r),y.set(C.x,C.y,-1).unproject(r),s.sub(y);const _=Math.max(...a.radius),b=this.getDistanceToCenter()-_,U=s.distanceTo(y)*b/r.near;d=7.5*1e-4*U/_}else d=p.mapLinear(r.zoom,this._getOrthographicTransitionZoom(),this._getMinOrthographicZoom(),.001,.005);i.getCenterPoint(M),i.getPreviousCenterPoint(C),z.subVectors(M,C).multiplyScalar(d);const h=-z.x*o,g=-z.y*o;f.setFromMatrixPosition(n.matrixWorld),v.set(1,0,0).transformDirection(r.matrixWorld),R.set(0,1,0).transformDirection(r.matrixWorld),l.setFromAxisAngle(v,g),r.quaternion.premultiply(l),W(f,l,x),r.matrixWorld.premultiply(x),l.setFromAxisAngle(R,h),r.quaternion.premultiply(l),W(f,l,x),r.matrixWorld.premultiply(x),r.matrixWorld.decompose(r.position,r.quaternion,s),e.visible=!1,this.inertiaDragMode=-1,z.multiplyScalar(1/t),i.getMoveDistance()/t<2*window.devicePixelRatio?this.dragInertia.lerp(z,.5):this.dragInertia.copy(z)}this._alignCameraUp(this.up)}_applyZoomedOutRotation(t,i){const{rotationSpeed:o,tilesGroup:r,camera:e}=this,n=-t*o,a=-i*o;e.updateMatrixWorld(),f.setFromMatrixPosition(r.matrixWorld),v.set(1,0,0).transformDirection(e.matrixWorld),R.set(0,1,0).transformDirection(e.matrixWorld),l.setFromAxisAngle(v,a),e.quaternion.premultiply(l),W(f,l,x),e.matrixWorld.premultiply(x),l.setFromAxisAngle(R,n),e.quaternion.premultiply(l),W(f,l,x),e.matrixWorld.premultiply(x),e.matrixWorld.decompose(e.position,e.quaternion,s)}_updateRotation(...t){this._rotationMode===1||this._isNearControls()?(this._rotationMode=1,super._updateRotation(...t)):(this.pivotMesh.visible=!1,this._rotationMode=-1),this._alignCameraUp(this.up)}_updateZoom(){const{zoomDelta:t,ellipsoid:i,zoomSpeed:o,zoomPoint:r,camera:e,maxZoom:n}=this,a=p.clamp(p.mapLinear(Math.abs(t),0,20,0,1),0,1);if(this._isNearControls()||t>0){if(this._updateZoomDirection(),t<0&&(this.zoomPointSet||this._updateZoomPoint())){c.set(0,0,-1).transformDirection(e.matrixWorld).normalize(),w.copy(this.up).multiplyScalar(-1),this.getUpDirection(r,F);const m=p.clamp(p.mapLinear(-F.dot(w),1,.95,0,1),0,1),d=1-c.dot(w),h=e.isOrthographicCamera?.05:1,g=p.clamp(a*3,0,1),_=Math.min(m*d*h*g,.1);w.lerpVectors(c,w,_).normalize(),l.setFromUnitVectors(c,w),W(r,l,x),e.matrixWorld.premultiply(x),e.matrixWorld.decompose(e.position,e.quaternion,w),this.zoomDirection.subVectors(r,e.position).normalize()}super._updateZoom()}else if(e.isPerspectiveCamera){const m=this._getPerspectiveTransitionDistance(),d=this._getMaxPerspectiveDistance(),h=p.mapLinear(this.getDistanceToCenter(),m,d,0,1);this._tiltTowardsCenter(p.lerp(0,.4,h*a)),this._alignCameraUpToNorth(p.lerp(0,.2,h*a));const g=this.getDistanceToCenter()-i.radius.x,_=t*g*o*.0025;this.getVectorToCenter(s).normalize(),this.camera.position.addScaledVector(s,_),this.camera.updateMatrixWorld(),this.zoomDelta=0}else{const m=this._getOrthographicTransitionZoom(),d=this._getMinOrthographicZoom(),h=p.mapLinear(e.zoom,m,d,0,1);this._tiltTowardsCenter(p.lerp(0,.4,h*a)),this._alignCameraUpToNorth(p.lerp(0,.2,h*a));const g=this.zoomDelta,_=Math.pow(.95,Math.abs(g*.05)),b=g>0?1/Math.abs(_):_;e.zoom=Math.max(this._getMinOrthographicZoom(),Math.min(n,e.zoom*b*o)),e.updateProjectionMatrix(),this.zoomDelta=0,this.zoomDirectionSet=!1}}_alignCameraUpToNorth(t){const{tilesGroup:i}=this;O.set(0,0,1).transformDirection(i.matrixWorld),this._alignCameraUp(O,t)}_alignCameraUp(t,i=null){const{camera:o}=this;c.set(0,0,-1).transformDirection(o.matrixWorld),v.set(-1,0,0).transformDirection(o.matrixWorld),T.crossVectors(t,c),i===null&&(i=1-Math.abs(c.dot(t)),i=p.mapLinear(i,0,1,-.01,1),i=p.clamp(i,0,1)**2),T.lerp(v,1-i).normalize(),l.setFromUnitVectors(v,T),o.quaternion.premultiply(l),o.updateMatrixWorld()}_tiltTowardsCenter(t){const{camera:i,tilesGroup:o}=this;c.set(0,0,-1).transformDirection(i.matrixWorld).normalize(),s.setFromMatrixPosition(o.matrixWorld).sub(i.position).normalize(),s.lerp(c,1-t).normalize(),l.setFromUnitVectors(c,s),i.quaternion.premultiply(l),i.updateMatrixWorld()}_getPerspectiveTransitionDistance(){const{camera:t,ellipsoid:i}=this;if(!t.isPerspectiveCamera)throw new Error;const o=Math.max(...i.radius),r=2*Math.atan(Math.tan(p.DEG2RAD*t.fov*.5)*t.aspect),e=o/Math.tan(p.DEG2RAD*t.fov*.5),n=o/Math.tan(r*.5);return Math.max(e,n)}_getMaxPerspectiveDistance(){const{camera:t,ellipsoid:i}=this;if(!t.isPerspectiveCamera)throw new Error;const o=Math.max(...i.radius),r=2*Math.atan(Math.tan(p.DEG2RAD*t.fov*.5)*t.aspect),e=o/Math.tan(p.DEG2RAD*t.fov*.5),n=o/Math.tan(r*.5);return 2*Math.max(e,n)}_getOrthographicTransitionZoom(){const{camera:t,ellipsoid:i}=this;if(!t.isOrthographicCamera)throw new Error;const o=t.top-t.bottom,r=t.right-t.left,e=Math.max(o,r),a=2*Math.max(...i.radius);return 2*e/a}_getMinOrthographicZoom(){const{camera:t,ellipsoid:i}=this;if(!t.isOrthographicCamera)throw new Error;const o=t.top-t.bottom,r=t.right-t.left,e=Math.min(o,r),a=2*Math.max(...i.radius);return .5*e/a}_getVirtualOrthoCameraPosition(t,i=this.camera){const{tilesGroup:o,ellipsoid:r}=this;if(!i.isOrthographicCamera)throw new Error;u.copy(o.matrixWorld).invert(),P.origin.copy(i.position),P.direction.set(0,0,-1).transformDirection(i.matrixWorld),P.applyMatrix4(u),A(P,r,y),y.applyMatrix4(o.matrixWorld);const e=i.top-i.bottom,n=i.right-i.left,a=Math.max(e,n)/i.zoom;c.set(0,0,-1).transformDirection(i.matrixWorld);const m=y.sub(i.position).dot(c);t.copy(i.position).addScaledVector(c,m-a*4)}_isNearControls(){const{camera:t}=this;return t.isPerspectiveCamera?this.getDistanceToCenter()this._getOrthographicTransitionZoom()}}export{$ as G}; diff --git a/example/bundle/assets/GoogleCloudAuthPlugin-B6MTG2Cr.js b/example/bundle/assets/GoogleCloudAuthPlugin-B6MTG2Cr.js new file mode 100644 index 000000000..f355acd7a --- /dev/null +++ b/example/bundle/assets/GoogleCloudAuthPlugin-B6MTG2Cr.js @@ -0,0 +1 @@ +import{t as h}from"./TilesRenderer-5XUDbyI2.js";class u{constructor(){this.creditsCount={}}_adjustAttributions(t,e){const s=this.creditsCount,i=t.split(/;/g);for(let n=0,l=i.length;n{const i=e[1];return s[1]-i}).map(e=>e[0]).join("; ")}}function a(r){let t=null;return h(r,e=>{if(e.content&&e.content.uri){const[,s]=e.content.uri.split("?");return t=new URLSearchParams(s).get("session"),!0}return!1}),t}class b{constructor({apiToken:t,autoRefreshToken:e=!1,logoUrl:s=null,useRecommendedSettings:i=!0}){this.name="GOOGLE_CLOUD_AUTH_PLUGIN",this.apiToken=t,this.autoRefreshToken=e,this.useRecommendedSettings=i,this.logoUrl=s,this.sessionToken=null,this.tiles=null,this._onLoadCallback=null,this._visibilityChangeCallback=null,this._tokenRefreshPromise=null,this._attributionsManager=new u,this._logoAttribution={value:"",type:"image",collapsible:!1},this._attribution={value:"",type:"string",collapsible:!0}}init(t){t!=null&&(t.rootURL==null&&(t.rootURL="https://tile.googleapis.com/v1/3dtiles/root.json"),this.useRecommendedSettings&&(t.parseQueue.maxJobs=10,t.downloadQueue.maxJobs=30,t.errorTarget=40),this.tiles=t,this._onLoadCallback=({tileSet:e})=>{this.sessionToken=a(e.root),t.removeEventListener("load-tile-set",this._onLoadCallback)},this._visibilityChangeCallback=({tile:e,visible:s})=>{const i=e.cached.metadata.asset.copyright||"";s?this._attributionsManager.addAttributions(i):this._attributionsManager.removeAttributions(i)},t.addEventListener("load-tile-set",this._onLoadCallback),t.addEventListener("tile-visibility-change",this._visibilityChangeCallback))}getAttributions(t){this.tiles.visibleTiles.size>0&&(this.logoUrl&&(this._logoAttribution.value=this.logoUrl,t.push(this._logoAttribution)),this._attribution.value=this._attributionsManager.toString(),t.push(this._attribution))}preprocessURL(t){return t=new URL(t),/^http/.test(t.protocol)&&(t.searchParams.append("key",this.apiToken),this.sessionToken!==null&&t.searchParams.append("session",this.sessionToken)),t.toString()}dispose(){const{tiles:t}=this;t.removeEventListener("load-tile-set",this._onLoadCallback),t.removeEventListener("tile-visibility-change",this._visibilityChangeCallback)}async fetchData(t,e){this._tokenRefreshPromise!==null&&(await this._tokenRefreshPromise,t=this.preprocessURL(t));const s=await fetch(t,e);return s.status>=400&&s.status<=499&&this.autoRefreshToken?(await this._refreshToken(e),fetch(this.preprocessURL(t),e)):s}_refreshToken(t){if(this._tokenRefreshPromise===null){const e=new URL(this.tiles.rootURL);e.searchParams.append("key",this.apiToken),this._tokenRefreshPromise=fetch(e,t).then(s=>s.json()).then(s=>{this.sessionToken=a(s.root),this._tokenRefreshPromise=null})}return this._tokenRefreshPromise}}export{b as G}; diff --git a/example/bundle/assets/GoogleTilesRenderer-BOTt9IiB.js b/example/bundle/assets/GoogleTilesRenderer-BOTt9IiB.js new file mode 100644 index 000000000..15ab2034a --- /dev/null +++ b/example/bundle/assets/GoogleTilesRenderer-BOTt9IiB.js @@ -0,0 +1 @@ +import{T as o}from"./TilesRenderer-5XUDbyI2.js";const s="https://tile.googleapis.com",r=`${s}/v1/3dtiles/root.json`,i=e=>class extends e{constructor(t=r){super(t),console.warn('GooglePhotorealisticTilesRenderer: Class has been deprecated. Use "TilesRenderer" with "GoogleCloudAuthPlugin" instead.'),this.parseQueue.maxJobs=10,this.downloadQueue.maxJobs=30,this.errorTarget=40}getCreditsString(){return console.warn('GooglePhotorealisticTilesRenderer: "getCreditsString" function is deprecated. Use "getAttributions", instead.'),this.getAttributions()[0].value}},l=i(o);export{l as G}; diff --git a/example/bundle/assets/I3DMLoader-Bb2sAfDf.js b/example/bundle/assets/I3DMLoader-Bb2sAfDf.js new file mode 100644 index 000000000..7021fccce --- /dev/null +++ b/example/bundle/assets/I3DMLoader-Bb2sAfDf.js @@ -0,0 +1 @@ +import{r as Z,F as J,B as q,a as K}from"./readMagicBytes-Da5ueiou.js";import{L as X}from"./LoaderBase-CVSPpjX2.js";import{p as y,b8 as Y,k as g,b9 as tt,Q}from"./three.module-CA-qMkP1.js";import{G as et}from"./GLTFLoader-JNhhxs0g.js";import{E as j}from"./Ellipsoid-_mEueZip.js";const Lt=-1,ht=0,ut=1,gt=2,ft=3,R=6378137,st=1/298.257223563,at=-(st*R-R),nt=1736*1e3,H=1738.1*1e3;class ot extends X{parse(o){const a=new DataView(o),s=Z(a);console.assert(s==="i3dm");const O=a.getUint32(4,!0);console.assert(O===1);const I=a.getUint32(8,!0);console.assert(I===o.byteLength);const S=a.getUint32(12,!0),U=a.getUint32(16,!0),i=a.getUint32(20,!0),f=a.getUint32(24,!0),m=a.getUint32(28,!0),L=32,M=o.slice(L,L+S+U),n=new J(M,0,S,U),e=L+S+U,p=o.slice(e,e+i+f),E=new q(p,n.getData("INSTANCES_LENGTH"),0,i,f),N=e+i+f,h=new Uint8Array(o,N,I-N);let A=null,T=null,b=null;if(m)A=h,T=Promise.resolve();else{const r=this.resolveExternalURL(K(h)),u=r.split(/[\\/]/g);u.pop(),b=u.join("/"),T=fetch(r,this.fetchOptions).then(c=>{if(!c.ok)throw new Error(`I3DMLoaderBase : Failed to load file "${r}" with status ${c.status} : ${c.statusText}`);return c.arrayBuffer()}).then(c=>{A=new Uint8Array(c)})}return T.then(()=>({version:O,featureTable:n,batchTable:E,glbBytes:A,gltfWorkingPath:b}))}}const rt=new j(R,R,at),mt=new j(H,H,nt),W=new g,F=new g,P=new g,C=new g,x=new Q,_=new g,w=new y,V=new y,v=new g,k=new y,B=new Q,G={};class Et extends ot{constructor(o=Y){super(),this.manager=o,this.adjustmentTransform=new y,this.ellipsoid=rt.clone()}resolveExternalURL(o){return this.manager.resolveURL(super.resolveExternalURL(o))}parse(o){return super.parse(o).then(a=>{const{featureTable:s,batchTable:O}=a,I=a.glbBytes.slice().buffer;return new Promise((S,U)=>{const i=this.fetchOptions,f=this.manager,m=f.getHandler("path.gltf")||new et(f);i.credentials==="include"&&i.mode==="cors"&&m.setCrossOrigin("use-credentials"),"credentials"in i&&m.setWithCredentials(i.credentials==="include"),i.headers&&m.setRequestHeader(i.headers);let L=a.gltfWorkingPath??this.workingPath;/[\\/]$/.test(L)||(L+="/");const M=this.adjustmentTransform;m.parse(I,L,n=>{const e=s.getData("INSTANCES_LENGTH"),p=s.getData("POSITION",e,"FLOAT","VEC3"),E=s.getData("NORMAL_UP",e,"FLOAT","VEC3"),N=s.getData("NORMAL_RIGHT",e,"FLOAT","VEC3"),h=s.getData("SCALE_NON_UNIFORM",e,"FLOAT","VEC3"),A=s.getData("SCALE",e,"FLOAT","SCALAR"),T=s.getData("RTC_CENTER"),b=s.getData("EAST_NORTH_UP");["QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach(t=>{t in s.header&&console.warn(`I3DMLoader: Unsupported FeatureTable feature "${t}" detected.`)});const r=new g;for(let t=0;t{if(t.isMesh){c.push(t);const{geometry:d,material:D}=t,l=new tt(d,D,e);l.position.copy(r),T&&(l.position.x+=T[0],l.position.y+=T[1],l.position.z+=T[2]),u.push(l)}});for(let t=0;t{if(!r.ok)throw new Error(`Failed to load file "${t}" with status ${r.status} : ${r.statusText}`);return r.arrayBuffer()}).then(r=>(this.workingPath===""&&(this.workingPath=this.workingPathForURL(t)),this.parse(r)))}resolveExternalURL(t){return/^[^\\/]/.test(t)&&!/^http/.test(t)?this.workingPath+"/"+t:t}workingPathForURL(t){const r=t.split(/[\\/]/g);return r.pop(),r.join("/")+"/"}parse(t){throw new Error("LoaderBase: Parse not implemented.")}}export{n as L}; diff --git a/example/bundle/assets/OrbitControls-BpFvfpv4.js b/example/bundle/assets/OrbitControls-BpFvfpv4.js new file mode 100644 index 000000000..118a80938 --- /dev/null +++ b/example/bundle/assets/OrbitControls-BpFvfpv4.js @@ -0,0 +1 @@ +import{i as Ve,j as We,E as Ge,k as u,l as N,T as S,Q as Pe,m as Te,V as m,n as qe}from"./three.module-CA-qMkP1.js";const Oe={type:"change"},J={type:"start"},we={type:"end"},X=new Ve,Me=new We,Be=Math.cos(70*qe.DEG2RAD);class et extends Ge{constructor(F,je){super(),this.object=F,this.domElement=je,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new u,this.cursor=new u,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:N.ROTATE,MIDDLE:N.DOLLY,RIGHT:N.PAN},this.touches={ONE:S.ROTATE,TWO:S.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return s.phi},this.getAzimuthalAngle=function(){return s.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",v),this._domElementKeyEvents=t},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",v),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(Oe),e.update(),r=a.NONE},this.update=function(){const t=new u,o=new Pe().setFromUnitVectors(F.up,new u(0,1,0)),n=o.clone().invert(),i=new u,l=new Pe,g=new u,d=2*Math.PI;return function(Fe=null){const ge=e.object.position;t.copy(ge).sub(e.target),t.applyQuaternion(o),s.setFromVector3(t),e.autoRotate&&r===a.NONE&&C(Ae(Fe)),e.enableDamping?(s.theta+=p.theta*e.dampingFactor,s.phi+=p.phi*e.dampingFactor):(s.theta+=p.theta,s.phi+=p.phi);let h=e.minAzimuthAngle,f=e.maxAzimuthAngle;isFinite(h)&&isFinite(f)&&(h<-Math.PI?h+=d:h>Math.PI&&(h-=d),f<-Math.PI?f+=d:f>Math.PI&&(f-=d),h<=f?s.theta=Math.max(h,Math.min(f,s.theta)):s.theta=s.theta>(h+f)/2?Math.max(h,s.theta):Math.min(f,s.theta)),s.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,s.phi)),s.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(j,e.dampingFactor):e.target.add(j),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor);let z=!1;if(e.zoomToCursor&&K||e.object.isOrthographicCamera)s.radius=B(s.radius);else{const b=s.radius;s.radius=B(s.radius*E),z=b!=s.radius}if(t.setFromSpherical(s),t.applyQuaternion(n),ge.copy(e.target).add(t),e.object.lookAt(e.target),e.enableDamping===!0?(p.theta*=1-e.dampingFactor,p.phi*=1-e.dampingFactor,j.multiplyScalar(1-e.dampingFactor)):(p.set(0,0,0),j.set(0,0,0)),e.zoomToCursor&&K){let b=null;if(e.object.isPerspectiveCamera){const _=t.length();b=B(_*E);const Z=_-b;e.object.position.addScaledVector($,Z),e.object.updateMatrixWorld(),z=!!Z}else if(e.object.isOrthographicCamera){const _=new u(y.x,y.y,0);_.unproject(e.object);const Z=e.object.zoom;e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/E)),e.object.updateProjectionMatrix(),z=Z!==e.object.zoom;const Ee=new u(y.x,y.y,0);Ee.unproject(e.object),e.object.position.sub(Ee).add(_),e.object.updateMatrixWorld(),b=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;b!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(b).add(e.object.position):(X.origin.copy(e.object.position),X.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(X.direction))V||8*(1-l.dot(e.object.quaternion))>V||g.distanceToSquared(e.target)>V?(e.dispatchEvent(Oe),i.copy(e.object.position),l.copy(e.object.quaternion),g.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",be),e.domElement.removeEventListener("pointerdown",de),e.domElement.removeEventListener("pointercancel",Y),e.domElement.removeEventListener("wheel",me),e.domElement.removeEventListener("pointermove",Q),e.domElement.removeEventListener("pointerup",Y),e.domElement.getRootNode().removeEventListener("keydown",pe,{capture:!0}),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",v),e._domElementKeyEvents=null)};const e=this,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=a.NONE;const V=1e-6,s=new Te,p=new Te;let E=1;const j=new u,P=new m,T=new m,A=new m,O=new m,w=new m,L=new m,D=new m,R=new m,M=new m,$=new u,y=new m;let K=!1;const c=[],I={};let W=!1;function Ae(t){return t!==null?2*Math.PI/60*e.autoRotateSpeed*t:2*Math.PI/60/60*e.autoRotateSpeed}function H(t){const o=Math.abs(t*.01);return Math.pow(.95,e.zoomSpeed*o)}function C(t){p.theta-=t}function U(t){p.phi-=t}const ee=function(){const t=new u;return function(n,i){t.setFromMatrixColumn(i,0),t.multiplyScalar(-n),j.add(t)}}(),te=function(){const t=new u;return function(n,i){e.screenSpacePanning===!0?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(e.object.up,t)),t.multiplyScalar(n),j.add(t)}}(),x=function(){const t=new u;return function(n,i){const l=e.domElement;if(e.object.isPerspectiveCamera){const g=e.object.position;t.copy(g).sub(e.target);let d=t.length();d*=Math.tan(e.object.fov/2*Math.PI/180),ee(2*n*d/l.clientHeight,e.object.matrix),te(2*i*d/l.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(ee(n*(e.object.right-e.object.left)/e.object.zoom/l.clientWidth,e.object.matrix),te(i*(e.object.top-e.object.bottom)/e.object.zoom/l.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function G(t){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?E/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function oe(t){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?E*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function q(t,o){if(!e.zoomToCursor)return;K=!0;const n=e.domElement.getBoundingClientRect(),i=t-n.left,l=o-n.top,g=n.width,d=n.height;y.x=i/g*2-1,y.y=-(l/d)*2+1,$.set(y.x,y.y,1).unproject(e.object).sub(e.object.position).normalize()}function B(t){return Math.max(e.minDistance,Math.min(e.maxDistance,t))}function ne(t){P.set(t.clientX,t.clientY)}function Le(t){q(t.clientX,t.clientX),D.set(t.clientX,t.clientY)}function ae(t){O.set(t.clientX,t.clientY)}function De(t){T.set(t.clientX,t.clientY),A.subVectors(T,P).multiplyScalar(e.rotateSpeed);const o=e.domElement;C(2*Math.PI*A.x/o.clientHeight),U(2*Math.PI*A.y/o.clientHeight),P.copy(T),e.update()}function Re(t){R.set(t.clientX,t.clientY),M.subVectors(R,D),M.y>0?G(H(M.y)):M.y<0&&oe(H(M.y)),D.copy(R),e.update()}function xe(t){w.set(t.clientX,t.clientY),L.subVectors(w,O).multiplyScalar(e.panSpeed),x(L.x,L.y),O.copy(w),e.update()}function ke(t){q(t.clientX,t.clientY),t.deltaY<0?oe(H(t.deltaY)):t.deltaY>0&&G(H(t.deltaY)),e.update()}function Ne(t){let o=!1;switch(t.code){case e.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?U(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):x(0,e.keyPanSpeed),o=!0;break;case e.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?U(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):x(0,-e.keyPanSpeed),o=!0;break;case e.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?C(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):x(e.keyPanSpeed,0),o=!0;break;case e.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?C(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):x(-e.keyPanSpeed,0),o=!0;break}o&&(t.preventDefault(),e.update())}function ie(t){if(c.length===1)P.set(t.pageX,t.pageY);else{const o=k(t),n=.5*(t.pageX+o.x),i=.5*(t.pageY+o.y);P.set(n,i)}}function se(t){if(c.length===1)O.set(t.pageX,t.pageY);else{const o=k(t),n=.5*(t.pageX+o.x),i=.5*(t.pageY+o.y);O.set(n,i)}}function re(t){const o=k(t),n=t.pageX-o.x,i=t.pageY-o.y,l=Math.sqrt(n*n+i*i);D.set(0,l)}function Se(t){e.enableZoom&&re(t),e.enablePan&&se(t)}function Ie(t){e.enableZoom&&re(t),e.enableRotate&&ie(t)}function ce(t){if(c.length==1)T.set(t.pageX,t.pageY);else{const n=k(t),i=.5*(t.pageX+n.x),l=.5*(t.pageY+n.y);T.set(i,l)}A.subVectors(T,P).multiplyScalar(e.rotateSpeed);const o=e.domElement;C(2*Math.PI*A.x/o.clientHeight),U(2*Math.PI*A.y/o.clientHeight),P.copy(T)}function le(t){if(c.length===1)w.set(t.pageX,t.pageY);else{const o=k(t),n=.5*(t.pageX+o.x),i=.5*(t.pageY+o.y);w.set(n,i)}L.subVectors(w,O).multiplyScalar(e.panSpeed),x(L.x,L.y),O.copy(w)}function ue(t){const o=k(t),n=t.pageX-o.x,i=t.pageY-o.y,l=Math.sqrt(n*n+i*i);R.set(0,l),M.set(0,Math.pow(R.y/D.y,e.zoomSpeed)),G(M.y),D.copy(R);const g=(t.pageX+o.x)*.5,d=(t.pageY+o.y)*.5;q(g,d)}function Ce(t){e.enableZoom&&ue(t),e.enablePan&&le(t)}function Ye(t){e.enableZoom&&ue(t),e.enableRotate&&ce(t)}function de(t){e.enabled!==!1&&(c.length===0&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",Q),e.domElement.addEventListener("pointerup",Y)),!Xe(t)&&(Ue(t),t.pointerType==="touch"?fe(t):ze(t)))}function Q(t){e.enabled!==!1&&(t.pointerType==="touch"?He(t):_e(t))}function Y(t){switch(Ze(t),c.length){case 0:e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",Q),e.domElement.removeEventListener("pointerup",Y),e.dispatchEvent(we),r=a.NONE;break;case 1:const o=c[0],n=I[o];fe({pointerId:o,pageX:n.x,pageY:n.y});break}}function ze(t){let o;switch(t.button){case 0:o=e.mouseButtons.LEFT;break;case 1:o=e.mouseButtons.MIDDLE;break;case 2:o=e.mouseButtons.RIGHT;break;default:o=-1}switch(o){case N.DOLLY:if(e.enableZoom===!1)return;Le(t),r=a.DOLLY;break;case N.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enablePan===!1)return;ae(t),r=a.PAN}else{if(e.enableRotate===!1)return;ne(t),r=a.ROTATE}break;case N.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enableRotate===!1)return;ne(t),r=a.ROTATE}else{if(e.enablePan===!1)return;ae(t),r=a.PAN}break;default:r=a.NONE}r!==a.NONE&&e.dispatchEvent(J)}function _e(t){switch(r){case a.ROTATE:if(e.enableRotate===!1)return;De(t);break;case a.DOLLY:if(e.enableZoom===!1)return;Re(t);break;case a.PAN:if(e.enablePan===!1)return;xe(t);break}}function me(t){e.enabled===!1||e.enableZoom===!1||r!==a.NONE||(t.preventDefault(),e.dispatchEvent(J),ke(Ke(t)),e.dispatchEvent(we))}function Ke(t){const o=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(o){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return t.ctrlKey&&!W&&(n.deltaY*=10),n}function pe(t){t.key==="Control"&&(W=!0,e.domElement.getRootNode().addEventListener("keyup",he,{passive:!0,capture:!0}))}function he(t){t.key==="Control"&&(W=!1,e.domElement.getRootNode().removeEventListener("keyup",he,{passive:!0,capture:!0}))}function v(t){e.enabled===!1||e.enablePan===!1||Ne(t)}function fe(t){switch(ye(t),c.length){case 1:switch(e.touches.ONE){case S.ROTATE:if(e.enableRotate===!1)return;ie(t),r=a.TOUCH_ROTATE;break;case S.PAN:if(e.enablePan===!1)return;se(t),r=a.TOUCH_PAN;break;default:r=a.NONE}break;case 2:switch(e.touches.TWO){case S.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Se(t),r=a.TOUCH_DOLLY_PAN;break;case S.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Ie(t),r=a.TOUCH_DOLLY_ROTATE;break;default:r=a.NONE}break;default:r=a.NONE}r!==a.NONE&&e.dispatchEvent(J)}function He(t){switch(ye(t),r){case a.TOUCH_ROTATE:if(e.enableRotate===!1)return;ce(t),e.update();break;case a.TOUCH_PAN:if(e.enablePan===!1)return;le(t),e.update();break;case a.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ce(t),e.update();break;case a.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Ye(t),e.update();break;default:r=a.NONE}}function be(t){e.enabled!==!1&&t.preventDefault()}function Ue(t){c.push(t.pointerId)}function Ze(t){delete I[t.pointerId];for(let o=0;o>11,t=L>>5&63,o=L&31,g=Math.round(s/31*255),n=Math.round(t/63*255),c=Math.round(o/31*255);return[g,n,c]}const D={RGB:"color",POSITION:"position"};class Q extends x{constructor(s=w){super(),this.manager=s}parse(s){return super.parse(s).then(async t=>{const{featureTable:o,batchTable:g}=t,n=new G,c=o.header.extensions,l=new P;let a;if(c&&c["3DTILES_draco_point_compression"]){const{byteOffset:e,byteLength:u,properties:i}=c["3DTILES_draco_point_compression"],f=this.manager.getHandler("draco.drc");if(f==null)throw new Error("PNTSLoader: dracoLoader not available.");const b={};for(const p in i)if(p in D&&p in i){const S=D[p];b[S]=i[p]}const N={attributeIDs:b,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},B=o.getBuffer(e,u);a=await f.decodeGeometry(B,N),a.attributes.color&&(n.vertexColors=!0)}else{const e=o.getData("POINTS_LENGTH"),u=o.getData("POSITION",e,"FLOAT","VEC3"),i=o.getData("RGB",e,"UNSIGNED_BYTE","VEC3"),f=o.getData("RGBA",e,"UNSIGNED_BYTE","VEC4"),b=o.getData("RGB565",e,"UNSIGNED_SHORT","SCALAR"),N=o.getData("CONSTANT_RGBA",e,"UNSIGNED_BYTE","VEC4"),B=o.getData("POSITION_QUANTIZED",e,"UNSIGNED_SHORT","VEC3"),p=o.getData("QUANTIZED_VOLUME_SCALE",e,"FLOAT","VEC3"),S=o.getData("QUANTIZED_VOLUME_OFFSET",e,"FLOAT","VEC3");if(a=new m,B){const E=new Float32Array(e*3);for(let r=0;r{e in o.header&&console.warn(`PNTSLoader: Unsupported FeatureTable feature "${e}" detected.`)});const O=new V(a,n);O.position.copy(l),t.scene=O,t.scene.featureTable=o,t.scene.batchTable=g;const T=o.getData("RTC_CENTER");return T&&(t.scene.position.x+=T[0],t.scene.position.y+=T[1],t.scene.position.z+=T[2]),t})}}export{Q as P}; diff --git a/example/bundle/assets/TileCompressionPlugin-a_ThVUk-.js b/example/bundle/assets/TileCompressionPlugin-a_ThVUk-.js new file mode 100644 index 000000000..1f8565b10 --- /dev/null +++ b/example/bundle/assets/TileCompressionPlugin-a_ThVUk-.js @@ -0,0 +1 @@ +import{k as w,al as z,n as S}from"./three.module-CA-qMkP1.js";const I=new w;function A(t,o){if(t.isInterleavedBufferAttribute||t.array instanceof o)return t;const f=o===Int8Array||o===Int16Array||o===Int32Array?-1:0,s=new o(t.count*t.itemSize),y=new z(s,t.itemSize,!0),d=t.itemSize,v=t.count;for(let c=0;c{if(r.material&&s){const a=r.material;for(const e in a){const n=a[e];n&&n.isTexture&&(n.generateMipmaps=!1)}}if(r.geometry){const a=r.geometry,e=a.attributes;if(d){const{uv:n,uv1:m,uv2:l,uv3:p}=e;n&&(e.uv=A(n,i)),m&&(e.uv1=A(m,i)),l&&(e.uv2=A(l,i)),p&&(e.uv3=A(p,i))}if(f&&!e.normals&&a.computeVertexNormals(),v&&e.normals&&(e.normals=A(e.normals,u)),c&&B(r,x),y&&a.index){const n=e.position.count,m=a.index,l=n>65535?Uint32Array:n>255?Uint16Array:Uint8Array;if(!(m.array instanceof l)){const p=new l(a.index.count);p.set(m.array);const b=new z(p,1);a.setIndex(b)}}}})}}export{C as T}; diff --git a/example/bundle/assets/TilesFadePlugin-ChL3fYSz.js b/example/bundle/assets/TilesFadePlugin-ChL3fYSz.js new file mode 100644 index 000000000..345b6ef33 --- /dev/null +++ b/example/bundle/assets/TilesFadePlugin-ChL3fYSz.js @@ -0,0 +1,47 @@ +import{n as I,k as _,G as b,p as y,Q as D}from"./three.module-CA-qMkP1.js";const{clamp:p}=I;class L{constructor(){this.duration=250,this.fadeCount=0,this._lastTick=-1,this._fadeState=new Map,this._fadeParams=new WeakMap,this.onFadeComplete=null,this.onFadeStart=null,this.onFadeSetComplete=null,this.onFadeSetStart=null}prepareObject(e){e.traverse(a=>{a.material&&this.prepareMaterial(a.material)})}deleteObject(e){if(!e)return;this.completeFade(e);const a=this._fadeParams;e.traverse(i=>{const t=i.material;t&&(a.delete(t),t.onBeforeCompile=()=>{},t.needsUpdate=!0)})}prepareMaterial(e){const a=this._fadeParams;if(a.has(e))return;const i={fadeIn:{value:0},fadeOut:{value:0}};e.defines={FEATURE_FADE:0},e.onBeforeCompile=t=>{t.uniforms={...t.uniforms,...i},t.fragmentShader=t.fragmentShader.replace(/void main\(/,r=>` + #if FEATURE_FADE + + // adapted from https://www.shadertoy.com/view/Mlt3z8 + float bayerDither2x2( vec2 v ) { + + return mod( 3.0 * v.y + 2.0 * v.x, 4.0 ); + + } + + float bayerDither4x4( vec2 v ) { + + vec2 P1 = mod( v, 2.0 ); + vec2 P2 = floor( 0.5 * mod( v, 4.0 ) ); + return 4.0 * bayerDither2x2( P1 ) + bayerDither2x2( P2 ); + + } + + uniform float fadeIn; + uniform float fadeOut; + #endif + + ${r} + `).replace(/#include /,r=>` + + ${r} + + #if FEATURE_FADE + + float bayerValue = bayerDither4x4( floor( mod( gl_FragCoord.xy, 4.0 ) ) ); + float bayerBins = 16.0; + float dither = ( 0.5 + bayerValue ) / bayerBins; + if ( dither >= fadeIn ) { + + discard; + + } + + if ( dither < fadeOut ) { + + discard; + + } + + #endif + + `)},a.set(e,i)}guaranteeState(e){const a=this._fadeState;if(a.has(e))return!1;const i={fadeInTarget:0,fadeOutTarget:0,fadeIn:0,fadeOut:0};a.set(e,i);const t=this._fadeParams;return e.traverse(r=>{const d=r.material;if(d&&t.has(d)){const f=t.get(d);f.fadeIn.value=0,f.fadeOut.value=0}}),!0}completeFade(e){const a=this._fadeState;a.has(e)&&(a.delete(e),e.traverse(i=>{const t=i.material;t&&t.defines.FEATURE_FADE!==0&&(t.defines.FEATURE_FADE=0,t.needsUpdate=!0)}),this.fadeCount--,this.onFadeComplete&&this.onFadeComplete(e),this.fadeCount===0&&this.onFadeSetComplete&&this.onFadeSetComplete())}completeAllFades(){this._fadeState.forEach((e,a)=>{this.completeFade(a)})}forEachObject(e){this._fadeState.forEach((a,i)=>e(i))}fadeIn(e){const a=this.guaranteeState(e),i=this._fadeState.get(e);i.fadeInTarget=1,i.fadeOutTarget=0,i.fadeOut=0,a&&(this.fadeCount++,this.fadeCount===1&&this.onFadeSetStart&&this.onFadeSetStart(),this.onFadeStart&&this.onFadeStart(e))}fadeOut(e){const a=this.guaranteeState(e),i=this._fadeState.get(e);i.fadeOutTarget=1,a&&(i.fadeInTarget=1,i.fadeIn=1,this.fadeCount++,this.fadeCount===1&&this.onFadeSetStart&&this.onFadeSetStart(),this.onFadeStart&&this.onFadeStart(e))}update(){const e=window.performance.now();this._lastTick===-1&&(this._lastTick=e);const a=p((e-this._lastTick)/this.duration,0,1);this._lastTick=e;const i=this._fadeState,t=this._fadeParams;i.forEach((r,d)=>{const{fadeOutTarget:f,fadeInTarget:h}=r;let{fadeOut:o,fadeIn:n}=r;const u=Math.sign(h-n);n=p(n+u*a,0,1);const m=Math.sign(f-o);o=p(o+m*a,0,1),r.fadeIn=n,r.fadeOut=o;const c=+(o!==f||n!==h);d.traverse(P=>{const l=P.material;if(l&&t.has(l)){const T=t.get(l);T.fadeIn.value=n,T.fadeOut.value=o,c!==l.defines.FEATURE_FADE&&(l.defines.FEATURE_FADE=c,l.needsUpdate=!0)}}),((o===1||o===0)&&(n===1||n===0)||o>=n)&&this.completeFade(d)})}}const E=Symbol("HAS_POPPED_IN"),F=new _,M=new _,C=new D,S=new D,A=new _;function U(s,e,a){s.visible=!0,a?e.__depthFromRenderedParent===1?((e[E]||this.fadeRootTiles)&&this._fadeManager.fadeIn(s),e[E]=!0):this._fadeManager.fadeIn(s):(this._fadeGroup.add(s),this._fadeManager.fadeOut(s))}function O(s,e){this._fadeManager.prepareObject(s),this._tileMap.set(s,e)}function w(s){this._fadeManager.deleteObject(s),this._tileMap.delete(s)}function x(s){s.parent===this._fadeGroup&&this._fadeGroup.remove(s)}function R(s){this._prevCameraTransforms.set(s,new y)}function G(s){this._prevCameraTransforms.delete(s)}function B(){const s=this._fadeManager,e=this.tiles;this._fadingBefore=s.fadeCount,this._displayActiveTiles=e.displayActiveTiles,e.displayActiveTiles=!0}function k(){const s=this._fadeManager,e=this._fadeGroup,a=this._displayActiveTiles,i=this._fadingBefore,t=this.tiles,r=this._prevCameraTransforms,d=this._tileMap,f=t.lruCache,h=t.cameras;t.displayActiveTiles=a,s.update();const o=s.fadeCount;if(i!==0&&o!==0&&t.dispatchEvent({type:"fade-change"}),a||t.visibleTiles.forEach(n=>{n.cached.scene.visible=n.__inFrustum}),this.maximumFadeOutTiles{if(!r.has(u))return;const m=u.matrixWorld,c=r.get(u);m.decompose(M,S,A),c.decompose(F,C,A);const v=S.angleTo(C),g=M.distanceTo(F);n=n&&(v>.25||g>.1)}),n&&s.completeAllFades()}h.forEach(n=>{r.get(n).copy(n.matrixWorld)}),s.forEachObject(n=>{f.markUsed(d.get(n))})}class N{get fadeDuration(){return this._fadeManager.duration}set fadeDuration(e){this._fadeManager.duration=Number(e)}get fadingTiles(){return this._fadeManager.fadeCount}constructor(e){e={maximumFadeOutTiles:50,fadeRootTiles:!1,fadeDuration:250,...e},this.name="FADE_TILES_PLUGIN",this.tiles=null,this._fadeManager=new L,this._prevCameraTransforms=null,this._fadeGroup=null,this._tileMap=null,this.maximumFadeOutTiles=e.maximumFadeOutTiles,this.fadeRootTiles=e.fadeRootTiles,this.fadeDuration=e.fadeDuration}init(e){const a=new b;a.name="TilesFadeGroup",e.group.add(a);const i=this._fadeManager;i.onFadeSetStart=()=>e.dispatchEvent({type:"fade-start"}),i.onFadeSetComplete=()=>e.dispatchEvent({type:"fade-end"}),i.onFadeComplete=x.bind(this),this.tiles=e,this._fadeManager=i,this._fadeGroup=a,this._tileMap=new Map,this._prevCameraTransforms=new Map,e.cameras.forEach(t=>{this._prevCameraTransforms.set(t,new y)}),e.forEachLoadedModel((t,r)=>{O.call(this,t,r)}),this._onLoadModel=t=>O.call(this,t.scene,t.tile),this._onDisposeModel=t=>w.call(this,t.scene),this._onTileVisibilityChange=t=>U.call(this,t.scene,t.tile,t.visible),this._onAddCamera=t=>R.call(this,t.camera),this._onDeleteCamera=t=>G.call(this,t.camera),this._onUpdateBefore=()=>B.call(this),this._onUpdateAfter=()=>k.call(this),e.addEventListener("load-model",this._onLoadModel),e.addEventListener("dispose-model",this._onDisposeModel),e.addEventListener("tile-visibility-change",this._onTileVisibilityChange),e.addEventListener("add-camera",this._onAddCamera),e.addEventListener("delete-camera",this._onDeleteCamera),e.addEventListener("update-before",this._onUpdateBefore),e.addEventListener("update-after",this._onUpdateAfter)}dispose(){const e=this.tiles;e.removeEventListener("load-model",this._onLoadModel),e.removeEventListener("dispose-model",this._onDisposeModel),e.removeEventListener("tile-visibility-change",this._onTileVisibilityChange),e.removeEventListener("add-camera",this._onAddCamera),e.removeEventListener("delete-camera",this._onDeleteCamera),e.removeEventListener("update-before",this._onUpdateBefore),e.removeEventListener("update-after",this._onUpdateAfter),e.forEachLoadedModel(a=>{this._fadeManager.deleteObject(a),this._tileMap.delete(a),a.visible=!0}),this._fadeGroup.removeFromParent()}}export{N as T}; diff --git a/example/bundle/assets/TilesRenderer-5XUDbyI2.js b/example/bundle/assets/TilesRenderer-5XUDbyI2.js new file mode 100644 index 000000000..6dda7ebd1 --- /dev/null +++ b/example/bundle/assets/TilesRenderer-5XUDbyI2.js @@ -0,0 +1 @@ +import{F as W,a as J,U as B,b as E,P as Q,W as Le,I as Ae}from"./I3DMLoader-Bb2sAfDf.js";import{B as Ie}from"./B3DMLoader-QE4NIaTt.js";import{P as Be}from"./PNTSLoader-CZfdYf2b.js";import{C as Ee}from"./CMPTLoader-C0bkMPP6.js";import{G as De}from"./GLTFExtensionLoader-Bl-gplNT.js";import{p as w,G as Ve,i as pe,k as y,aF as me,j as Oe,B as Ne,d as ze,aA as qe,b6 as We,aP as je,V as _e,E as Je,b7 as Ge,L as Qe}from"./three.module-CA-qMkP1.js";import{r as $e}from"./readMagicBytes-Da5ueiou.js";import{E as He}from"./EllipsoidRegion-CSZafkN2.js";import{e as Ye}from"./GLTFLoader-JNhhxs0g.js";function se(i){let e;try{e=new URL(i,"http://fakehost.com/")}catch{return null}const t=e.pathname.split("/").pop(),s=t.lastIndexOf(".");return s===-1||s===t.length-1?null:t.substring(s+1)}const ne=2**30;class Xe{get unloadPriorityCallback(){return this._unloadPriorityCallback}set unloadPriorityCallback(e){e.length===1?(console.warn('LRUCache: "unloadPriorityCallback" function has been changed to take two arguments.'),this._unloadPriorityCallback=(t,s)=>{const n=e(t),o=e(s);return no?1:0}):this._unloadPriorityCallback=e}constructor(){this.minSize=6e3,this.maxSize=8e3,this.minBytesSize=.3*ne,this.maxBytesSize=.4*ne,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.markUnusedQueued=!1,this.unloadingHandle=-1,this.cachedBytes=0,this.bytesMap=new Map,this.loadedSet=new Set,this._unloadPriorityCallback=null,this.computeMemoryUsageCallback=()=>null;const e=this.itemSet;this.defaultPriorityCallback=t=>e.get(t)}isFull(){return this.itemSet.size>=this.maxSize||this.cachedBytes>=this.maxBytesSize}getMemoryUsage(e){return this.bytesMap.get(e)??null}add(e,t){this.markUnusedQueued&&this.markAllUnused();const s=this.itemSet;if(s.has(e)||this.isFull())return!1;const n=this.usedSet,o=this.itemList,r=this.callbacks,a=this.bytesMap;o.push(e),n.add(e),s.set(e,Date.now()),r.set(e,t);const l=this.computeMemoryUsageCallback(e);return this.cachedBytes+=l||0,a.set(e,l),!0}remove(e){const t=this.usedSet,s=this.itemSet,n=this.itemList,o=this.bytesMap,r=this.callbacks,a=this.loadedSet;if(s.has(e)){this.cachedBytes-=o.get(e)||0,o.delete(e),r.get(e)(e);const l=n.indexOf(e);return n.splice(l,1),t.delete(e),s.delete(e),r.delete(e),a.delete(e),!0}return!1}setLoaded(e,t){const{itemSet:s,loadedSet:n}=this;s.has(e)&&(t===!0?n.add(e):n.delete(e))}updateMemoryUsage(e){const t=this.itemSet,s=this.bytesMap;if(!t.has(e))return;this.cachedBytes-=s.get(e)||0;const n=this.computeMemoryUsageCallback(e);s.set(e,n),this.cachedBytes+=n}markUsed(e){this.markUnusedQueued&&this.markAllUnused();const t=this.itemSet,s=this.usedSet;t.has(e)&&!s.has(e)&&(t.set(e,Date.now()),s.add(e))}markAllUnused(){this.usedSet.clear(),this.markUnusedQueued=!1,this.unloadingHandle!==-1&&(cancelAnimationFrame(this.unloadingHandle),this.unloadingHandle=-1)}unloadUnusedContent(){const{unloadPercent:e,minSize:t,maxSize:s,itemList:n,itemSet:o,usedSet:r,loadedSet:a,callbacks:l,bytesMap:c,minBytesSize:d,maxBytesSize:f}=this,p=n.length-r.size,m=n.length-a.size,h=Math.max(Math.min(n.length-t,p),0),_=this.cachedBytes-d,v=this.unloadPriorityCallback||this.defaultPriorityCallback;let g=!1;const U=h>0&&p>0||m&&n.length>s;if(p&&this.cachedBytes>d||m&&this.cachedBytes>f||U){n.sort((b,C)=>{const ee=r.has(b),Fe=r.has(C);if(ee===Fe){const te=a.has(b),Ue=a.has(C);return te===Ue?-v(b,C):te?1:-1}else return ee?1:-1});const I=Math.max(t*e,h*e),L=Math.ceil(Math.min(I,p,h)),u=Math.max(e*_,e*d),F=Math.min(u,_);let x=0,T=0;for(;this.cachedBytes-T>f||n.length-x>s;){const b=n[x],C=c.get(b)||0;if(r.has(b)&&a.has(b)||this.cachedBytes-T-C=L)break;T+=C,x++}n.splice(0,x).forEach(b=>{this.cachedBytes-=c.get(b)||0,l.get(b)(b),c.delete(b),o.delete(b),l.delete(b),a.delete(b),r.delete(b)}),g=x0}g&&(this.unloadingHandle=requestAnimationFrame(()=>this.scheduleUnload()))}scheduleUnload(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.unloadUnusedContent(),this.markUnusedQueued=!0}))}}class ie{constructor(){this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=()=>{throw new Error("PriorityQueue: PriorityCallback function not defined.")},this.schedulingCallback=e=>{requestAnimationFrame(e)},this._runjobs=()=>{this.tryRunJobs(),this.scheduled=!1}}sort(){const e=this.priorityCallback;this.items.sort(e)}add(e,t){return new Promise((s,n)=>{const o=(...l)=>t(...l).then(s).catch(n),r=this.items,a=this.callbacks;r.push(e),a.set(e,o),this.autoUpdate&&this.scheduleJobRun()})}remove(e){const t=this.items,s=this.callbacks,n=t.indexOf(e);n!==-1&&(t.splice(n,1),s.delete(e))}tryRunJobs(){this.sort();const e=this.items,t=this.callbacks,s=this.maxJobs;let n=this.currJobs;for(;s>n&&e.length>0;){n++;const o=e.pop(),r=t.get(o);t.delete(o),r(o).then(()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()}).catch(()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()})}this.currJobs=n}scheduleJobRun(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}function Z(i){return i===J||i===W}function k(i,e){return i.__lastFrameVisited===e&&i.__used}function K(i,e){i.__lastFrameVisited!==e.frameCount&&(i.__lastFrameVisited=e.frameCount,i.__used=!1,i.__inFrustum=!1,i.__isLeaf=!1,i.__visible=!1,i.__active=!1,i.__error=1/0,i.__distanceFromCamera=1/0,i.__childrenWereVisible=!1,i.__allChildrenLoaded=!1,i.__inFrustum=e.tileInView(i),e.calculateError(i))}function ge(i,e){if(e.ensureChildrenArePreprocessed(i),K(i,e),X(i,e),!i.__hasRenderableContent){const t=i.children;for(let s=0,n=t.length;s0&&i.__depth+1>=e.maxDepth)}function ye(i,e=null,t=null,s=null,n=0){if(e&&e(i,s,n)){t&&t(i,s,n);return}const o=i.children;for(let r=0,a=o.length;ri.__depthFromRenderedParent!==e.__depthFromRenderedParent?i.__depthFromRenderedParent>e.__depthFromRenderedParent?-1:1:i.__inFrustum!==e.__inFrustum?i.__inFrustum?1:-1:i.__used!==e.__used?i.__used?1:-1:i.__error!==e.__error?i.__error>e.__error?1:-1:i.__distanceFromCamera!==e.__distanceFromCamera?i.__distanceFromCamera>e.__distanceFromCamera?-1:1:0,Ke=(i,e)=>i.__depthFromRenderedParent!==e.__depthFromRenderedParent?i.__depthFromRenderedParent>e.__depthFromRenderedParent?1:-1:i.__loadingState!==e.__loadingState?i.__loadingState>e.__loadingState?-1:1:i.__lastFrameVisited!==e.__lastFrameVisited?i.__lastFrameVisited>e.__lastFrameVisited?-1:1:i.__hasUnrenderableContent!==e.__hasUnrenderableContent?i.__hasUnrenderableContent?-1:1:i.__error!==e.__error?i.__error>e.__error?-1:1:0;class et{get root(){const e=this.rootTileSet;return e?e.root:null}set loadSiblings(e){console.warn('TilesRenderer: "loadSiblings" option has been removed.')}set stopAtEmptyTiles(e){console.warn('TilesRenderer: "stopAtEmptyTiles" option has been removed.')}set preprocessURL(e){console.warn('TilesRendererBase: The "preprocessURL" callback has been deprecated. Use a plugin, instead.'),this._preprocessURL=e}get preprocessURL(){return this._preprocessURL}constructor(e=null){this.rootTileSetTriggered=!1,this.rootTileSet=null,this.rootURL=e,this.fetchOptions={},this.plugins=[],this.queuedTiles=[],this._preprocessURL=null;const t=new Xe;t.unloadPriorityCallback=Ke;const s=new ie;s.maxJobs=4,s.priorityCallback=re;const n=new ie;n.maxJobs=1,n.priorityCallback=re,this.lruCache=t,this.downloadQueue=s,this.parseQueue=n,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.displayActiveTiles=!1,this.maxDepth=1/0}registerPlugin(e){if(e[oe]===!0)throw new Error("TilesRendererBase: A plugin can only be registered to a single tile set");this.plugins.push(e),e[oe]=!0,e.init&&e.init(this)}unregisterPlugin(e){const t=this.plugins;if(typeof e=="string"&&(e=this.getPluginByName(name)),t.includes(e)){const s=t.indexOf(e);return t.splice(s,1),e.dispose&&e.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}traverse(e,t){this.root&&ye(this.root,(s,...n)=>(this.ensureChildrenArePreprocessed(s),e?e(s,...n):!1),t)}queueTileForDownload(e){this.queuedTiles.push(e)}update(){const e=this.stats,t=this.lruCache;if(this.rootTileSetTriggered||(this.rootTileSetTriggered=!0,this.invokeOnePlugin(o=>o.loadRootTileSet&&o.loadRootTileSet())),!this.root)return;const s=this.root;e.inFrustum=0,e.used=0,e.active=0,e.visible=0,this.frameCount++,xe(s,this),ve(s,this),Se(s,this),Te(s,this);const n=this.queuedTiles;n.sort(t.unloadPriorityCallback);for(let o=0,r=n.length;o{t.__loadingState===W&&(t.__loadingState=B)}),e.failed=0)}dispose(){this.invokeAllPlugins(s=>{s!==this&&s.dispose&&s.dispose()});const e=this.lruCache,t=[];this.traverse(s=>(t.push(s),!1));for(let s=0,n=t.length;s{o!==this&&o.preprocessNode&&o.preprocessNode(e,t,s)})}setTileActive(e,t){}setTileVisible(e,t){}calculateError(e){return 0}tileInView(e){return!0}ensureChildrenArePreprocessed(e){const t=e.children;for(let s=0,n=t.length;sparseInt(l));console.assert(o<=1,"TilesRenderer: asset.version is expected to be a 1.x or a compatible version."),o===1&&r>0&&console.warn("TilesRenderer: tiles versions at 1.1 or higher have limited support. Some new extensions and features may not be supported.");let a=t.replace(/\/[^/]*\/?$/,"");a=new URL(a,window.location.href).toString(),this.preprocessNode(e.root,a,s)}loadRootTileSet(){let e=this.rootURL;this.invokeAllPlugins(s=>e=s.preprocessURL?s.preprocessURL(e,null):e);const t=this.invokeOnePlugin(s=>s.fetchData&&s.fetchData(e,this.fetchOptions)).then(s=>{if(s.ok)return s.json();throw new Error(`TilesRenderer: Failed to load tileset "${e}" with status ${s.status} : ${s.statusText}`)}).then(s=>{this.preprocessTileSet(s,e),this.rootTileSet=s});return t.catch(s=>{console.error(s),this.rootTileSet=null}),t}requestTileContents(e){if(e.__loadingState!==B)return;let t=!1,s=new URL(e.content.uri,e.__basePath+"/").toString();this.invokeAllPlugins(h=>s=h.preprocessURL?h.preprocessURL(s,e):s);const n=this.stats,o=this.lruCache,r=this.downloadQueue,a=this.parseQueue,l=se(s);if(!o.add(e,h=>{h.__loadingState===E?(h.__loadAbort.abort(),h.__loadAbort=null):t?h.children.length=0:this.invokeAllPlugins(_=>{_.disposeTile&&_.disposeTile(h)}),h.__loadingState===E?n.downloading--:h.__loadingState===Q&&n.parsing--,h.__loadingState=B,h.__loadIndex++,a.remove(h),r.remove(h)}))return;e.__loadIndex++;const d=e.__loadIndex,f=new AbortController,p=f.signal;n.downloading++,e.__loadAbort=f,e.__loadingState=E;const m=h=>{e.__loadIndex===d&&(h.name!=="AbortError"?(a.remove(e),r.remove(e),e.__loadingState===Q?n.parsing--:e.__loadingState===E&&n.downloading--,n.failed++,console.error(`TilesRenderer : Failed to load tile at url "${e.content.uri}".`),console.error(h),e.__loadingState=W,o.setLoaded(e,!0)):o.remove(e))};return r.add(e,h=>h.__loadIndex!==d?Promise.resolve():this.invokeOnePlugin(_=>_.fetchData&&_.fetchData(s,{...this.fetchOptions,signal:p}))).then(h=>{if(e.__loadIndex===d){if(h.ok)return l==="json"?h.json():h.arrayBuffer();throw new Error(`Failed to load model with error code ${h.status}`)}}).then(h=>{if(e.__loadIndex===d)return n.downloading--,n.parsing++,e.__loadAbort=null,e.__loadingState=Q,a.add(e,_=>_.__loadIndex!==d?Promise.resolve():l==="json"&&h.root?(this.preprocessTileSet(h,s,e),e.children.push(h.root),t=!0,Promise.resolve()):this.invokeOnePlugin(v=>v.parseTile&&v.parseTile(h,_,l,s)))}).then(()=>{e.__loadIndex===d&&(n.parsing--,e.__loadingState=J,o.setLoaded(e,!0),o.getMemoryUsage(e)===null&&(o.isFull()&&o.computeMemoryUsageCallback(e)>0?o.remove(e):o.updateMemoryUsage(e)))}).catch(m)}getAttributions(e=[]){return this.invokeAllPlugins(t=>t!==this&&t.getAttributions&&t.getAttributions(e)),e}invokeOnePlugin(e){const t=[...this.plugins,this];for(let s=0;sNumber.EPSILON){n=!0;break}}if(n){this.matrixWorld.copy(D);const o=this.children;for(let r=0,a=o.length;r{Object.getPrototypeOf(o).raycast.call(o,e,s)}),q.sort(Ce)):t.invokeOnePlugin(r=>r.raycastTile&&r.raycastTile(i,n,e,s))||e.intersectObject(n,!0,s)}function nt(i,e,t){Pe(i,e,t,q);const s=q[0]||null;return q.length=0,s}function Re(i,e,t,s=null){const{group:n,activeTiles:o}=i;i.ensureChildrenArePreprocessed(e),s===null&&(s=we,j.copy(n.matrixWorld).invert(),s.copy(t.ray).applyMatrix4(j));const r=[],a=e.children;for(let d=0,f=a.length;dc)break;const _=Re(i,h,t,s);if(_){const v=_.distance*_.distance;vnew y),this.planes=new Array(6).fill().map(()=>new Oe)}clampPoint(e,t){return t.copy(e).applyMatrix4(this.inverseTransform).clamp(this.box.min,this.box.max).applyMatrix4(this.transform)}distanceToPoint(e){return this.clampPoint(e,S).distanceTo(e)}containsPoint(e){return S.copy(e).applyMatrix4(this.inverseTransform),this.box.containsPoint(S)}intersectsRay(e){return N.copy(e).applyMatrix4(this.inverseTransform),N.intersectsBox(this.box)}intersectRay(e,t){return N.copy(e).applyMatrix4(this.inverseTransform),N.intersectBox(this.box,t)?(t.applyMatrix4(this.transform),t):null}update(){const{points:e,inverseTransform:t,transform:s,box:n}=this;t.copy(s).invert();const{min:o,max:r}=n;let a=0;for(let l=-1;l<=1;l+=2)for(let c=-1;c<=1;c+=2)for(let d=-1;d<=1;d+=2)e[a].set(l<0?o.x:r.x,c<0?o.y:r.y,d<0?o.z:r.z).applyMatrix4(s),a++;this.updatePlanes()}updatePlanes(){V.copy(this.box.min).applyMatrix4(this.transform),O.copy(this.box.max).applyMatrix4(this.transform),S.set(0,0,1).transformDirection(this.transform),this.planes[0].setFromNormalAndCoplanarPoint(S,V),this.planes[1].setFromNormalAndCoplanarPoint(S,O).negate(),S.set(0,1,0).transformDirection(this.transform),this.planes[2].setFromNormalAndCoplanarPoint(S,V),this.planes[3].setFromNormalAndCoplanarPoint(S,O).negate(),S.set(1,0,0).transformDirection(this.transform),this.planes[4].setFromNormalAndCoplanarPoint(S,V),this.planes[5].setFromNormalAndCoplanarPoint(S,O).negate()}intersectsFrustum(e){const{points:t}=this,{planes:s}=e;for(let n=0;n<6;n++){const o=s[n];let r=-1/0;for(let a=0;a<8;a++){const l=t[a],c=o.distanceToPoint(l);r=ro?n:o}intersectsFrustum(e){const t=this.obb||this.regionObb,s=this.sphere;return s&&!e.intersectsSphere(s)||t&&!t.intersectsFrustum(e)?!1:!!(s||t)}getOBB(e,t){const s=this.obb||this.regionObb;s?(e.copy(s.box),t.copy(s.transform)):(this.getAABB(e),t.identity())}getAABB(e){if(this.sphere)this.sphere.getBoundingBox(e);else{const t=this.obb||this.regionObb;e.copy(t.box).applyMatrix4(t.transform)}}getSphere(e){if(this.sphere)e.copy(this.sphere);else if(this.region)this.region.getBoundingSphere(e);else{const t=this.obb||this.regionObb;t.box.getBoundingSphere(e),e.applyMatrix4(t.transform)}}setObbData(e,t){const s=new ae;P.set(e[3],e[4],e[5]),R.set(e[6],e[7],e[8]),M.set(e[9],e[10],e[11]);const n=P.length(),o=R.length(),r=M.length();P.normalize(),R.normalize(),M.normalize(),n===0&&P.crossVectors(R,M),o===0&&R.crossVectors(P,M),r===0&&M.crossVectors(P,R),s.transform.set(P.x,R.x,M.x,e[0],P.y,R.y,M.y,e[1],P.z,R.z,M.z,e[2],0,0,0,1).premultiply(t),s.box.min.set(-n,-o,-r),s.box.max.set(n,o,r),s.update(),this.obb=s}setSphereData(e,t,s,n,o){const r=new ze;r.center.set(e,t,s),r.radius=n,r.applyMatrix4(o),this.sphere=r}setRegionData(e,t,s,n,o,r,a){const l=new He(...e.radius,s,o,t,n,r,a),c=new ae;l.getBoundingBox(c.box,c.transform),c.update(),this.region=l,this.regionObb=c}}const ot=new qe;function rt(i,e,t,s){const n=ot.set(i.normal.x,i.normal.y,i.normal.z,e.normal.x,e.normal.y,e.normal.z,t.normal.x,t.normal.y,t.normal.z);return s.set(-i.constant,-e.constant,-t.constant),s.applyMatrix3(n.invert()),s}class at extends We{constructor(){super(),this.points=Array(8).fill().map(()=>new y)}setFromProjectionMatrix(e,t){super.setFromProjectionMatrix(e,t),this.calculateFrustumPoints()}calculateFrustumPoints(){const{planes:e,points:t}=this;[[e[0],e[3],e[4]],[e[1],e[3],e[4]],[e[0],e[2],e[4]],[e[1],e[2],e[4]],[e[0],e[3],e[5]],[e[1],e[3],e[5]],[e[0],e[2],e[5]],[e[1],e[2],e[5]]].forEach((n,o)=>{rt(n[0],n[1],n[2],t[o])})}}function lt(i){const{TextureUtils:e}=je;if(!e)return 0;const t=new Set;let s=0;return i.traverse(n=>{if(n.geometry&&!t.has(n.geometry)&&(s+=Ye(n.geometry),t.add(n.geometry)),n.material){const o=n.material;for(const r in o){const a=o[r];if(a&&a.isTexture&&!t.has(a)){const{format:l,type:c,image:d}=a,{width:f,height:p}=d,m=e.getByteLength(f,p,l,c);s+=a.generateMipmaps?m*4/3:m,t.add(a)}}}}),s}const he=new w,de=new Ge,ue=parseInt(me)<165,ke=Symbol("INITIAL_FRUSTUM_CULLED"),z=new w,H=new w,A=new y,Y=new _e,ct=new y(1,0,0),ht=new y(0,1,0);function fe(i,e){i.traverse(t=>{t.frustumCulled=t[ke]&&e})}class dt extends et{get autoDisableRendererCulling(){return this._autoDisableRendererCulling}set autoDisableRendererCulling(e){this._autoDisableRendererCulling!==e&&(super._autoDisableRendererCulling=e,this.forEachLoadedModel(t=>{fe(t,!e)}))}constructor(...e){super(...e),this.group=new tt(this),this.ellipsoid=Le.clone(),this.cameras=[],this.cameraMap=new Map,this.cameraInfo=[],this.activeTiles=new Set,this.visibleTiles=new Set,this.optimizeRaycast=!0,this._eventDispatcher=new Je,this._upRotationMatrix=new w,this.lruCache.computeMemoryUsageCallback=s=>s.cached.bytesUsed??null,this._autoDisableRendererCulling=!0,this._loadingTiles=!1;const t=new Qe;if(t.setURLModifier(s=>this.preprocessURL?this.preprocessURL(s):s),this.manager=t,ue){const s=this;this._overridenRaycast=function(n,o){s.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,n,o)}}}addEventListener(...e){this._eventDispatcher.addEventListener(...e)}hasEventListener(...e){this._eventDispatcher.hasEventListener(...e)}removeEventListener(...e){this._eventDispatcher.removeEventListener(...e)}dispatchEvent(...e){this._eventDispatcher.dispatchEvent(...e)}getBounds(...e){return console.warn("TilesRenderer: getBounds has been renamed to getBoundingBox."),this.getBoundingBox(...e)}getOrientedBounds(...e){return console.warn("TilesRenderer: getOrientedBounds has been renamed to getOrientedBoundingBox."),this.getOrientedBoundingBox(...e)}getBoundingBox(e){if(!this.root)return!1;const t=this.root.cached.boundingVolume;return t?(t.getAABB(e),!0):!1}getOrientedBoundingBox(e,t){if(!this.root)return!1;const s=this.root.cached.boundingVolume;return s?(s.getOBB(e,t),!0):!1}getBoundingSphere(e){if(!this.root)return!1;const t=this.root.cached.boundingVolume;return t?(t.getSphere(e),!0):!1}forEachLoadedModel(e){this.traverse(t=>{const s=t.cached.scene;s&&e(s,t)})}raycast(e,t){if(this.root)if(e.firstHitOnly){const s=Re(this,this.root,e);s&&t.push(s)}else Me(this,this.root,e,t)}hasCamera(e){return this.cameraMap.has(e)}setCamera(e){const t=this.cameras,s=this.cameraMap;return s.has(e)?!1:(s.set(e,new _e),t.push(e),this.dispatchEvent({type:"add-camera",camera:e}),!0)}setResolution(e,t,s){const n=this.cameraMap;if(!n.has(e))return!1;const o=t.isVector2?t.x:t,r=t.isVector2?t.y:s,a=n.get(e);return(a.width!==o||a.height!==r)&&(a.set(o,r),this.dispatchEvent({type:"camera-resolution-change"})),!0}setResolutionFromRenderer(e,t){return t.getSize(Y).multiplyScalar(t.getPixelRatio()),this.setResolution(e,Y.x,Y.y)}deleteCamera(e){const t=this.cameras,s=this.cameraMap;if(s.has(e)){const n=t.indexOf(e);return t.splice(n,1),s.delete(e),this.dispatchEvent({type:"delete-camera",camera:e}),!0}return!1}preprocessTileSet(e,t,s){super.preprocessTileSet(e,t,s),queueMicrotask(()=>{this.dispatchEvent({type:"load-tile-set",tileSet:e,url:t})})}loadRootTileSet(...e){return super.loadRootTileSet(...e).then(()=>{switch((this.rootTileSet.asset&&this.rootTileSet.asset.gltfUpAxis||"y").toLowerCase()){case"x":this._upRotationMatrix.makeRotationAxis(ht,-Math.PI/2);break;case"y":this._upRotationMatrix.makeRotationAxis(ct,Math.PI/2);break}this.dispatchEvent({type:"load-content"})}).catch(()=>{})}update(){let e=null;if(this.invokeAllPlugins(r=>{if(r.doTilesNeedUpdate){const a=r.doTilesNeedUpdate();e=e===null?a:e||a}}),e===!1){this.dispatchEvent({type:"update-before"}),this.dispatchEvent({type:"update-after"});return}this.dispatchEvent({type:"update-before"});const t=this.group,s=this.cameras,n=this.cameraMap,o=this.cameraInfo;if(s.length===0){console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.");return}for(;o.length>s.length;)o.pop();for(;o.length1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(let r=0,a=o.length;rF.scene);break}case"gltf":case"glb":{const u=new De(c);u.workingPath=a,u.fetchOptions=l,f=u.parse(e);break}default:console.warn(`TilesRenderer: Content type "${h}" not supported.`),f=Promise.resolve(null);break}const _=this.stats;this._loadingTiles===!1&&_.parsing+_.downloading>0&&(this.dispatchEvent({type:"tiles-load-start"}),this._loadingTiles=!0);const v=await f;let g,U;if(v.isObject3D?(g=v,U=null):(g=v.scene,U=v),await this.invokeAllPlugins(u=>u.processTileModel&&u.processTileModel(g,t)),o._loadIndex!==d)return;g.updateMatrix(),(h==="glb"||h==="gltf")&&g.matrix.multiply(m),g.matrix.premultiply(p),g.matrix.decompose(g.position,g.quaternion,g.scale),g.traverse(u=>{u[ke]=u.frustumCulled}),fe(g,!this.autoDisableRendererCulling),ue&&g.traverse(u=>{u.raycast=this._overridenRaycast});const G=[],I=[],L=[];g.traverse(u=>{if(u.geometry&&I.push(u.geometry),u.material){const F=u.material;G.push(u.material);for(const x in F){const T=F[x];T&&T.isTexture&&L.push(T)}}}),o.materials=G,o.geometry=I,o.textures=L,o.scene=g,o.metadata=U,o.bytesUsed=lt(g),this.dispatchEvent({type:"load-model",scene:g,tile:t}),this._loadingTiles===!0&&_.parsing+_.downloading===1&&(this.dispatchEvent({type:"tiles-load-end"}),this._loadingTiles=!1)}disposeTile(e){super.disposeTile(e);const t=e.cached;if(t.scene){const s=t.materials,n=t.geometry,o=t.textures,r=t.scene.parent;t.scene.traverse(a=>{a.userData.meshFeatures&&a.userData.meshFeatures.dispose(),a.userData.structuralMetadata&&a.userData.structuralMetadata.dispose()});for(let a=0,l=n.length;a{const t=Symbol(i);Object.defineProperty(dt.prototype,i,{get(){return this[t]||null},set(s){console.warn(`TilesRenderer: "${i}" has been deprecated in favor of the "${e}" event.`),this[t]&&this.removeEventListener(e,this[t]),this[t]=s,this.addEventListener(e,s)}})});export{ie as P,dt as T,ye as t}; diff --git a/example/bundle/assets/UpdateOnChangePlugin-C5cEQ6o6.js b/example/bundle/assets/UpdateOnChangePlugin-C5cEQ6o6.js new file mode 100644 index 000000000..ff09e6cfa --- /dev/null +++ b/example/bundle/assets/UpdateOnChangePlugin-C5cEQ6o6.js @@ -0,0 +1 @@ +import{p as r}from"./three.module-CA-qMkP1.js";const a=new r;class o{constructor(){this.tiles=null,this.needsUpdate=!1,this.cameraMatrices=new Map}init(e){this.tiles=e,this._needsUpdateCallback=()=>{this.needsUpdate=!0},this._onCameraAdd=({camera:t})=>{this.needsUpdate=!0,this.cameraMatrices.set(t,new r)},this._onCameraDelete=({camera:t})=>{this.needsUpdate=!0,this.cameraMatrices.delete(t)},e.addEventListener("camera-resolution-change",this._needsUpdateCallback),e.addEventListener("load-content",this._needsUpdateCallback),e.addEventListener("add-camera",this._onCameraAdd),e.addEventListener("delete-camera",this._onCameraDelete)}doTilesNeedUpdate(){const e=this.tiles;let t=!1;this.cameraMatrices.forEach((s,n)=>{a.copy(e.group.matrixWorld).premultiply(n.matrixWorldInverse).premultiply(n.projectionMatrixInverse),t=t||!a.equals(s),s.copy(a)});const d=this.needsUpdate;return this.needsUpdate=!1,d||t}dispose(){const e=this.tiles;e.removeEventListener("camera-resolution-change",this._needsUpdateCallback),e.removeEventListener("content-load",this._needsUpdateCallback),e.removeEventListener("camera-add",this._onCameraAdd),e.removeEventListener("camera-delete",this._onCameraDelete)}}export{o as U}; diff --git a/example/bundle/assets/b3dmExample-QSIbi-N4.js b/example/bundle/assets/b3dmExample-QSIbi-N4.js new file mode 100644 index 000000000..7b3278422 --- /dev/null +++ b/example/bundle/assets/b3dmExample-QSIbi-N4.js @@ -0,0 +1,20 @@ +import{S as M,W as D,P as L,a as T,D as P,A as R,G as F,b as _,C as A,U as E,B as H,c as I,R as W,V as j}from"./three.module-CA-qMkP1.js";import{O as G}from"./OrbitControls-BpFvfpv4.js";import{B as z}from"./B3DMLoader-QE4NIaTt.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";let s,m,c,t,f,r,b,a,d,u;$();C();function O(i){const e={...i};return e.uniforms={highlightedBatchId:{value:-1},highlightColor:{value:new A(16761095).convertSRGBToLinear()},...E.clone(i.uniforms)},e.extensions={derivatives:!0},e.lights=!0,e.vertexShader=` + attribute float _batchid; + varying float batchid; + `+e.vertexShader.replace(/#include /,` + #include + batchid = _batchid; + `),e.fragmentShader=` + varying float batchid; + uniform float highlightedBatchId; + uniform vec3 highlightColor; + `+e.fragmentShader.replace(/vec4 diffuseColor = vec4\( diffuse, opacity \);/,` + vec4 diffuseColor = + abs( batchid - highlightedBatchId ) < 0.5 ? + vec4( highlightColor, opacity ) : + vec4( diffuse, opacity ); + `),e}function $(){u=document.getElementById("info"),c=new M,t=new D({antialias:!0}),t.setPixelRatio(window.devicePixelRatio),t.setSize(window.innerWidth,window.innerHeight),t.setClearColor(1383455),t.shadowMap.enabled=!0,t.shadowMap.type=L,document.body.appendChild(t.domElement),s=new T(60,window.innerWidth/window.innerHeight,1,4e3),s.position.set(400,400,400),m=new G(s,t.domElement),m.screenSpacePanning=!1,m.minDistance=1,m.maxDistance=2e3,r=new P(16777215,1.25),r.position.set(1,2,3).multiplyScalar(40),r.castShadow=!0,r.shadow.bias=-.01,r.shadow.mapSize.setScalar(2048);const i=r.shadow.camera;i.left=-200,i.bottom=-200,i.right=200,i.top=200,i.updateProjectionMatrix(),c.add(r);const e=new R(16777215,.05);c.add(e),f=new F,c.add(f),new z().loadAsync("https://raw.githubusercontent.com/CesiumGS/cesium/main/Apps/SampleData/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tile.b3dm").then(h=>{console.log(h),d=h.scene,f.add(d);const n=new H;n.setFromObject(d),n.getCenter(f.position).multiplyScalar(-1),d.traverse(o=>{o.isMesh&&(o.material=new _(O(I.standard)))})}),b=new W,a=new j,y(),window.addEventListener("resize",y,!1),t.domElement.addEventListener("mousemove",U,!1)}function U(i){const e=this.getBoundingClientRect();a.x=i.clientX-e.x,a.y=i.clientY-e.y,a.x=a.x/e.width*2-1,a.y=-(a.y/e.height)*2+1,b.setFromCamera(a,s);const h=b.intersectObject(c,!0);let n=-1;if(h.length){const{face:o,object:p}=h[0],v=p.geometry.getAttribute("_batchid");if(v){let l=p;for(;!l.batchTable;)l=l.parent;const B=l.batchTable;n=v.getX(o.a);const w=B.getDataFromId(n);u.innerText=`_batchid : ${n} +Area : ${w.height.toFixed(3)} +Height : ${w.height.toFixed(3)} +`;const g=w["3DTILES_batch_table_hierarchy"];for(const x in g)for(const S in g[x])u.innerText+=`${S} : ${g[x][S]} +`}}else u.innerText="";d&&d.traverse(o=>{o.isMesh&&(o.material.uniforms.highlightedBatchId.value=n)})}function y(){s.aspect=window.innerWidth/window.innerHeight,t.setPixelRatio(window.devicePixelRatio),t.setSize(window.innerWidth,window.innerHeight),s.updateProjectionMatrix()}function C(){requestAnimationFrame(C),V()}function V(){t.render(c,s)} diff --git a/example/bundle/assets/basic-CW0oSi2l.js b/example/bundle/assets/basic-CW0oSi2l.js new file mode 100644 index 000000000..f71b3eb34 --- /dev/null +++ b/example/bundle/assets/basic-CW0oSi2l.js @@ -0,0 +1,217 @@ +import{n as j,b as k,U as I,aw as E,ax as F,ay as z,az as B,C as A}from"./three.module-CA-qMkP1.js";import{r as c,e as O,u as w,a as b,_ as U,c as P,j as n,C as N,T as G,b as L,E as V,d as $,G as H,f as K}from"./CameraControls-Budxqpvb.js";import{T as W}from"./TilesFadePlugin-ChL3fYSz.js";import"./EnvironmentControls-7w_Q0bky.js";import"./GlobeControls-B_ZEgOcW.js";import"./Ellipsoid-_mEueZip.js";import"./TilesRenderer-5XUDbyI2.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";function X(m,t,i,e){const s=class extends k{constructor(v={}){const f=Object.entries(m);super({uniforms:f.reduce((l,[u,x])=>{const d=I.clone({[u]:{value:x}});return{...l,...d}},{}),vertexShader:t,fragmentShader:i}),this.key="",f.forEach(([l])=>Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:u=>this.uniforms[l].value=u})),Object.assign(this,v)}};return s.key=j.generateUUID(),s}const Y=X({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");class q extends B{constructor(t=6,i=!1){super(),this.uniforms={chromaticAberration:{value:.05},transmission:{value:0},_transmission:{value:1},transmissionMap:{value:null},roughness:{value:0},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:1/0},attenuationColor:{value:new A("white")},anisotropicBlur:{value:.1},time:{value:0},distortion:{value:0},distortionScale:{value:.5},temporalDistortion:{value:0},buffer:{value:null}},this.onBeforeCompile=e=>{e.uniforms={...e.uniforms,...this.uniforms},this.anisotropy>0&&(e.defines.USE_ANISOTROPY=""),i?e.defines.USE_SAMPLER="":e.defines.USE_TRANSMISSION="",e.fragmentShader=` + uniform float chromaticAberration; + uniform float anisotropicBlur; + uniform float time; + uniform float distortion; + uniform float distortionScale; + uniform float temporalDistortion; + uniform sampler2D buffer; + + vec3 random3(vec3 c) { + float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); + vec3 r; + r.z = fract(512.0*j); + j *= .125; + r.x = fract(512.0*j); + j *= .125; + r.y = fract(512.0*j); + return r-0.5; + } + + uint hash( uint x ) { + x += ( x << 10u ); + x ^= ( x >> 6u ); + x += ( x << 3u ); + x ^= ( x >> 11u ); + x += ( x << 15u ); + return x; + } + + // Compound versions of the hashing algorithm I whipped together. + uint hash( uvec2 v ) { return hash( v.x ^ hash(v.y) ); } + uint hash( uvec3 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ); } + uint hash( uvec4 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ^ hash(v.w) ); } + + // Construct a float with half-open range [0:1] using low 23 bits. + // All zeroes yields 0.0, all ones yields the next smallest representable value below 1.0. + float floatConstruct( uint m ) { + const uint ieeeMantissa = 0x007FFFFFu; // binary32 mantissa bitmask + const uint ieeeOne = 0x3F800000u; // 1.0 in IEEE binary32 + m &= ieeeMantissa; // Keep only mantissa bits (fractional part) + m |= ieeeOne; // Add fractional part to 1.0 + float f = uintBitsToFloat( m ); // Range [1:2] + return f - 1.0; // Range [0:1] + } + + // Pseudo-random value in half-open range [0:1]. + float randomBase( float x ) { return floatConstruct(hash(floatBitsToUint(x))); } + float randomBase( vec2 v ) { return floatConstruct(hash(floatBitsToUint(v))); } + float randomBase( vec3 v ) { return floatConstruct(hash(floatBitsToUint(v))); } + float randomBase( vec4 v ) { return floatConstruct(hash(floatBitsToUint(v))); } + float rand(float seed) { + float result = randomBase(vec3(gl_FragCoord.xy, seed)); + return result; + } + + const float F3 = 0.3333333; + const float G3 = 0.1666667; + + float snoise(vec3 p) { + vec3 s = floor(p + dot(p, vec3(F3))); + vec3 x = p - s + dot(s, vec3(G3)); + vec3 e = step(vec3(0.0), x - x.yzx); + vec3 i1 = e*(1.0 - e.zxy); + vec3 i2 = 1.0 - e.zxy*(1.0 - e); + vec3 x1 = x - i1 + G3; + vec3 x2 = x - i2 + 2.0*G3; + vec3 x3 = x - 1.0 + 3.0*G3; + vec4 w, d; + w.x = dot(x, x); + w.y = dot(x1, x1); + w.z = dot(x2, x2); + w.w = dot(x3, x3); + w = max(0.6 - w, 0.0); + d.x = dot(random3(s), x); + d.y = dot(random3(s + i1), x1); + d.z = dot(random3(s + i2), x2); + d.w = dot(random3(s + 1.0), x3); + w *= w; + w *= w; + d *= w; + return dot(d, vec4(52.0)); + } + + float snoiseFractal(vec3 m) { + return 0.5333333* snoise(m) + +0.2666667* snoise(2.0*m) + +0.1333333* snoise(4.0*m) + +0.0666667* snoise(8.0*m); + } +`+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include ",` + #ifdef USE_TRANSMISSION + // Transmission code is based on glTF-Sampler-Viewer + // https://github.com/KhronosGroup/glTF-Sample-Viewer + uniform float _transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + // Direction of refracted light. + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + // Compute rotation-independant scaling of the model matrix. + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + // The thickness is specified in local space. + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and + // an IOR of 1.5 results in the default amount of microfacet refraction. + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + #ifdef USE_SAMPLER + #ifdef texture2DLodEXT + return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod); + #else + return texture2D(transmissionSamplerMap, fragCoord.xy, framebufferLod); + #endif + #else + return texture2D(buffer, fragCoord.xy); + #endif + } + vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + // Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all. + return radiance; + } else { + // Compute light attenuation using Beer's law. + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law + return transmittance * radiance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + // Sample framebuffer to get pixel the refracted ray hits. + vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); + // Get the specular component. + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); + } + #endif +`),e.fragmentShader=e.fragmentShader.replace("#include ",` + // Improve the refraction to use the world pos + material.transmission = _transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vUv ).g; + #endif + + vec3 pos = vWorldPosition; + float runningSeed = 0.0; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec3 transmission = vec3(0.0); + float transmissionR, transmissionB, transmissionG; + float randomCoords = rand(runningSeed++); + float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropicBlur); + vec3 distortionNormal = vec3(0.0); + vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion; + if (distortion > 0.0) { + distortionNormal = distortion * vec3(snoiseFractal(vec3((pos * distortionScale + temporalOffset))), snoiseFractal(vec3(pos.zxy * distortionScale - temporalOffset)), snoiseFractal(vec3(pos.yxz * distortionScale + temporalOffset))); + } + for (float i = 0.0; i < ${t}.0; i ++) { + vec3 sampleNorm = normalize(n + roughnessFactor * roughnessFactor * 2.0 * normalize(vec3(rand(runningSeed++) - 0.5, rand(runningSeed++) - 0.5, rand(runningSeed++) - 0.5)) * pow(rand(runningSeed++), 0.33) + distortionNormal); + transmissionR = getIBLVolumeRefraction( + sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness + thickness_smear * (i + randomCoords) / float(${t}), + material.attenuationColor, material.attenuationDistance + ).r; + transmissionG = getIBLVolumeRefraction( + sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + chromaticAberration * (i + randomCoords) / float(${t})) , material.thickness + thickness_smear * (i + randomCoords) / float(${t}), + material.attenuationColor, material.attenuationDistance + ).g; + transmissionB = getIBLVolumeRefraction( + sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + 2.0 * chromaticAberration * (i + randomCoords) / float(${t})), material.thickness + thickness_smear * (i + randomCoords) / float(${t}), + material.attenuationColor, material.attenuationDistance + ).b; + transmission.r += transmissionR; + transmission.g += transmissionG; + transmission.b += transmissionB; + } + transmission /= ${t}.0; + totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); +`)},Object.keys(this.uniforms).forEach(e=>Object.defineProperty(this,e,{get:()=>this.uniforms[e].value,set:s=>this.uniforms[e].value=s}))}}const J=c.forwardRef(({buffer:m,transmissionSampler:t=!1,backside:i=!1,side:e=E,transmission:s=1,thickness:p=0,backsideThickness:v=0,backsideEnvMapIntensity:f=1,samples:l=10,resolution:u,backsideResolution:x,background:d,anisotropy:T,anisotropicBlur:g,...D},R)=>{O({MeshTransmissionMaterial:q});const r=c.useRef(null),[_]=c.useState(()=>new Y),M=w(x||u),h=w(u);let S,C,y,a;return b(o=>{r.current.time=o.clock.getElapsedTime(),r.current.buffer===h.texture&&!t&&(a=r.current.__r3f.parent,a&&(y=o.gl.toneMapping,S=o.scene.background,C=r.current.envMapIntensity,o.gl.toneMapping=F,d&&(o.scene.background=d),a.material=_,i&&(o.gl.setRenderTarget(M),o.gl.render(o.scene,o.camera),a.material=r.current,a.material.buffer=M.texture,a.material.thickness=v,a.material.side=z,a.material.envMapIntensity=f),o.gl.setRenderTarget(h),o.gl.render(o.scene,o.camera),a.material=r.current,a.material.thickness=p,a.material.side=e,a.material.buffer=h.texture,a.material.envMapIntensity=C,o.scene.background=S,o.gl.setRenderTarget(null),o.gl.toneMapping=y))}),c.useImperativeHandle(R,()=>r.current,[]),c.createElement("meshTransmissionMaterial",U({args:[l,t],ref:r},D,{buffer:m||h.texture,_transmission:s,anisotropicBlur:g??T,transmission:t?s:0,thickness:p,side:e}))}),Q="https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize_tileset.json";function Z(m){const t=c.useRef();return b(()=>{const i=t.current;i.rotation.x=Math.sin(window.performance.now()*5e-4)*2,i.rotation.y=Math.cos(window.performance.now()*.0015)}),n.jsxs("mesh",{...m,ref:t,children:[n.jsx("icosahedronGeometry",{}),n.jsx(J,{thickness:1.5,chromaticAberration:.25,color:8445674})]})}function ee(){return n.jsxs(N,{camera:{position:[12,7.5,12]},style:{width:"100%",height:"100%",position:"absolute",margin:0,left:0,top:0},children:[n.jsx("group",{"rotation-x":Math.PI/2,children:n.jsxs(G,{url:Q,children:[n.jsx(L,{plugin:W,fadeDuration:500}),n.jsx(Z,{position:[0,-4,-4],scale:2})]})}),n.jsx(V,{enableDamping:!0,maxDistance:50}),n.jsx($,{preset:"sunset",background:!0,backgroundBlurriness:.9,environmentIntensity:1}),n.jsx(H,{alignment:"bottom-right",children:n.jsx(K,{})})]})}P(document.getElementById("root")).render(n.jsx(c.StrictMode,{children:n.jsx(ee,{})})); diff --git a/example/bundle/assets/cmptExample-DISwzeib.js b/example/bundle/assets/cmptExample-DISwzeib.js new file mode 100644 index 000000000..3e9140f2c --- /dev/null +++ b/example/bundle/assets/cmptExample-DISwzeib.js @@ -0,0 +1 @@ +import{S as m,W as c,P as l,a as p,D as f,A as h}from"./three.module-CA-qMkP1.js";import{O as u}from"./OrbitControls-BpFvfpv4.js";import{C as g}from"./CMPTLoader-C0bkMPP6.js";import"./LoaderBase-CVSPpjX2.js";import"./readMagicBytes-Da5ueiou.js";import"./B3DMLoader-QE4NIaTt.js";import"./GLTFLoader-JNhhxs0g.js";import"./PNTSLoader-CZfdYf2b.js";import"./I3DMLoader-Bb2sAfDf.js";import"./Ellipsoid-_mEueZip.js";let n,o,a,e,i;P();d();function P(){a=new m,e=new c({antialias:!0}),e.setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1383455),e.shadowMap.enabled=!0,e.shadowMap.type=l,document.body.appendChild(e.domElement),n=new p(60,window.innerWidth/window.innerHeight,1,4e3),n.position.set(400,400,400),o=new u(n,e.domElement),o.screenSpacePanning=!1,o.minDistance=1,o.maxDistance=2e3,i=new f(16777215,1.25),i.position.set(1,2,3).multiplyScalar(40),i.castShadow=!0,i.shadow.bias=-.01,i.shadow.mapSize.setScalar(2048);const t=i.shadow.camera;t.left=-200,t.bottom=-200,t.right=200,t.top=200,t.updateProjectionMatrix(),a.add(i);const s=new h(16777215,.05);a.add(s),new g().loadAsync("...").then(w=>{console.log(w)}),r(),window.addEventListener("resize",r,!1)}function r(){n.aspect=window.innerWidth/window.innerHeight,e.setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),n.updateProjectionMatrix()}function d(){requestAnimationFrame(d),S()}function S(){e.render(a,n)} diff --git a/example/bundle/assets/customMaterial-BJQ88dKh.js b/example/bundle/assets/customMaterial-BJQ88dKh.js new file mode 100644 index 000000000..125a901fb --- /dev/null +++ b/example/bundle/assets/customMaterial-BJQ88dKh.js @@ -0,0 +1,70 @@ +import{S as k,W as F,P as L,a as R,O as z,D as E,A as T,G as W,M as I,b as v,B as V,d as G}from"./three.module-CA-qMkP1.js";import{O as H}from"./OrbitControls-BpFvfpv4.js";import{g as A}from"./lil-gui.module.min-Bc0DeA9g.js";import{S as D}from"./stats.module--VATS4Kh.js";import{T as N}from"./TilesRenderer-5XUDbyI2.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./Ellipsoid-_mEueZip.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";let n,c,p,o,t,a,m,h,f,d,s,w;const g=0,x=1,y=2,S=3,l={material:g,orthographic:!1,rebuild:M},O={vertexShader:` + varying vec3 wPosition; + void main() { + + #include + #include + wPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz; + + } + `,fragmentShader:` + varying vec3 wPosition; + void main() { + + float minVal = - 30.0; + float maxVal = 30.0; + + float val = ( wPosition.y - minVal ) / ( maxVal - minVal ); + + vec4 color1 = vec4( 0.149, 0.196, 0.219, 1.0 ) * 0.5; + vec4 color2 = vec4( 1.0 ); + + gl_FragColor = mix( color1, color2, val ); + + } + `},_={extensions:{derivatives:!0},vertexShader:` + varying vec3 wPosition; + varying vec3 vViewPosition; + void main() { + + #include + #include + wPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz; + vViewPosition = - mvPosition.xyz; + + } + `,fragmentShader:` + varying vec3 wPosition; + varying vec3 vViewPosition; + void main() { + + // lighting + vec3 fdx = vec3( dFdx( wPosition.x ), dFdx( wPosition.y ), dFdx( wPosition.z ) ); + vec3 fdy = vec3( dFdy( wPosition.x ), dFdy( wPosition.y ), dFdy( wPosition.z ) ); + vec3 worldNormal = normalize( cross( fdx, fdy ) ); + + float lighting = + 0.4 + + clamp( dot( worldNormal, vec3( 1.0, 1.0, 1.0 ) ), 0.0, 1.0 ) * 0.5 + + clamp( dot( worldNormal, vec3( - 1.0, 1.0, - 1.0 ) ), 0.0, 1.0 ) * 0.3; + + // thickness scale + float upwardness = dot( worldNormal, vec3( 0.0, 1.0, 0.0 ) ); + float yInv = clamp( 1.0 - abs( upwardness ), 0.0, 1.0 ); + float thicknessScale = pow( yInv, 0.4 ); + thicknessScale *= 0.25 + 0.5 * ( vViewPosition.z + 1.0 ) / 2.0; + + // thickness + float thickness = 0.01 * thicknessScale; + float thickness2 = thickness / 2.0; + float m = mod( wPosition.y, 3.0 ); + + // soften edge + float center = thickness2; + float dist = clamp( abs( m - thickness2 ) / thickness2, 0.0, 1.0 ); + + vec4 topoColor = vec4( 0.149, 0.196, 0.219, 1.0 ) * 0.5; + gl_FragColor = mix( topoColor * lighting, vec4( lighting ), dist ); + + } + `};$();b();function P(i){const r=parseFloat(l.material);i.traverse(e=>{if(e.isMesh)switch(e.material.dispose(),r){case g:e.material=e.originalMaterial,e.material.side=2,e.receiveShadow=!1,e.castShadow=!1;break;case x:e.material=new v(O),e.material.side=2,e.receiveShadow=!1,e.castShadow=!1;break;case y:e.material=new v(_),e.material.side=2,e.material.flatShading=!0,e.receiveShadow=!1,e.castShadow=!1;break;case S:e.material=new I,e.material.side=2,e.receiveShadow=!0,e.castShadow=!0}})}function j({scene:i}){i.traverse(r=>{r.isMesh&&(r.originalMaterial=r.material)}),P(i)}function B({scene:i}){i.traverse(r=>{r.isMesh&&r.material.dispose()})}function M(){t&&(t.group.parent.remove(t.group),t.dispose());const i=window.location.hash.replace(/^#/,"")||"../data/tileset.json";t=new N(i),t.errorTarget=2,t.addEventListener("load-model",j),t.addEventListener("dispose-model",B),m.add(t.group)}function $(){p=new k,o=new F({antialias:!0}),o.setPixelRatio(window.devicePixelRatio),o.setSize(window.innerWidth,window.innerHeight),o.setClearColor(1383455),o.shadowMap.enabled=!0,o.shadowMap.type=L,document.body.appendChild(o.domElement),n=new R(60,window.innerWidth/window.innerHeight,1,4e3),n.position.set(400,400,400),a=new z,c=new H(n,o.domElement),c.screenSpacePanning=!1,c.minDistance=1,c.maxDistance=2e3,d=new E(16777215,1.25),d.position.set(1,2,3).multiplyScalar(40),d.castShadow=!0,d.shadow.bias=-.01,d.shadow.mapSize.setScalar(2048);const i=d.shadow.camera;i.left=-200,i.bottom=-200,i.right=200,i.top=200,i.updateProjectionMatrix(),p.add(d);const r=new T(16777215,.05);p.add(r),h=new V,f=new G,m=new W,p.add(m),M(),u(),window.addEventListener("resize",u,!1);const e=new A;e.width=300,e.add(l,"orthographic"),e.add(l,"material",{DEFAULT:g,GRADIENT:x,TOPOGRAPHIC_LINES:y,LIGHTING:S}).onChange(()=>{t.forEachLoadedModel(P)}),e.add(l,"rebuild"),e.open(),w=new D,w.showPanel(0),document.body.appendChild(w.dom),s=document.createElement("div"),s.style.position="absolute",s.style.top=0,s.style.left=0,s.style.color="white",s.style.width="100%",s.style.textAlign="center",s.style.padding="5px",s.style.pointerEvents="none",s.style.lineHeight="1.5em",document.body.appendChild(s)}function u(){n.aspect=window.innerWidth/window.innerHeight,o.setPixelRatio(window.devicePixelRatio),o.setSize(window.innerWidth,window.innerHeight),n.updateProjectionMatrix(),C()}function C(){a.position.copy(n.position),a.rotation.copy(n.rotation);const i=n.position.distanceTo(c.target)/2,r=window.innerWidth/window.innerHeight;a.left=-r*i,a.right=r*i,a.bottom=-i,a.top=i,a.near=n.near,a.far=n.far,a.updateProjectionMatrix()}function b(){requestAnimationFrame(b),l.orthographic?(t.deleteCamera(n),t.setCamera(a),t.setResolutionFromRenderer(a,o)):(t.deleteCamera(a),t.setCamera(n),t.setResolutionFromRenderer(n,o)),m.rotation.set(0,0,0),l.up==="-Z"&&(m.rotation.x=Math.PI/2),m.updateMatrixWorld(!0),t.getBoundingBox(h)?(h.getCenter(t.group.position),t.group.position.multiplyScalar(-1)):t.getBoundingSphere(f)&&(t.group.position.copy(f.center),t.group.position.multiplyScalar(-1)),window.tiles=t,n.updateMatrixWorld(),a.updateMatrixWorld(),t.update(),q(),w.update()}function q(){C(),s.innerText=`Geometries: ${o.info.memory.geometries} Textures: ${o.info.memory.textures} Programs: ${o.info.programs.length} `,o.render(p,l.orthographic?a:n)} diff --git a/example/bundle/assets/ellipsoid-C7KvFdMD.js b/example/bundle/assets/ellipsoid-C7KvFdMD.js new file mode 100644 index 000000000..cedae9131 --- /dev/null +++ b/example/bundle/assets/ellipsoid-C7KvFdMD.js @@ -0,0 +1 @@ +import{S as C,W as M,a as E,G as x,e as S,d as v,f as B,B as I,D as L,A as W,g as G,h as z}from"./three.module-CA-qMkP1.js";import{O as F}from"./OrbitControls-BpFvfpv4.js";import{g as O}from"./lil-gui.module.min-Bc0DeA9g.js";import{E as y,a as A,S as D}from"./EllipsoidRegionHelper-CaOebIdf.js";import"./EllipsoidRegion-CSZafkN2.js";import"./Ellipsoid-_mEueZip.js";let l,w,p,o,r,P,c,u,e,g,f,a;const t=[];let m;const s={displaySphereHelper:!1,displayBoxHelper:!1,displayPoints:!1};q();b();function q(){p=new C,o=new M({antialias:!0}),o.setPixelRatio(window.devicePixelRatio),o.setSize(window.innerWidth,window.innerHeight),o.setClearColor(1383455),o.shadowMap.enabled=!0,document.body.appendChild(o.domElement),l=new E(60,window.innerWidth/window.innerHeight,.1,100),l.position.set(3,1.5,1),r=new x,r.rotation.x=-Math.PI/2,p.add(r),m=new x,r.add(m),e=new y,e.material=new S({polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),e.ellipsoidRegion.radius.z=.95,e.ellipsoidRegion.heightStart=-.05,e.ellipsoidRegion.heightEnd=.05,e.ellipsoidRegion.latStart=0,e.ellipsoidRegion.latEnd=Math.PI/4,e.ellipsoidRegion.lonStart=0,e.ellipsoidRegion.lonEnd=Math.PI/4,g=new y,g.material=new S({opacity:.1,transparent:!0,depthWrite:!1}),f=new A(e.ellipsoidRegion),f.material.color.set(1383455).convertSRGBToLinear(),c=new D(new v),a=new x,u=new B(new I),a.add(u),r.add(e,g,f,c,a),n(),w=new F(l,o.domElement),w.screenSpacePanning=!1,w.minDistance=1,w.maxDistance=2e3,P=new L(16777215,1.25),P.position.set(1,2,3).multiplyScalar(40),p.add(P);const h=new W(16777215,.15);p.add(h);const i=new O;i.add(s,"displayBoxHelper"),i.add(s,"displaySphereHelper"),i.add(s,"displayPoints");const R=i.addFolder("radius");R.add(e.ellipsoidRegion.radius,"x",.1,2).onChange(n),R.add(e.ellipsoidRegion.radius,"y",.1,2).onChange(n),R.add(e.ellipsoidRegion.radius,"z",.1,2).onChange(n);const d=i.addFolder("region");d.add(e.ellipsoidRegion,"latStart",-Math.PI/2,Math.PI/2).onChange(n),d.add(e.ellipsoidRegion,"latEnd",-Math.PI/2,Math.PI/2).onChange(n),d.add(e.ellipsoidRegion,"lonStart",0,2*Math.PI).onChange(n),d.add(e.ellipsoidRegion,"lonEnd",0,2*Math.PI).onChange(n),d.add(e.ellipsoidRegion,"heightStart",-.25,.25).onChange(n),d.add(e.ellipsoidRegion,"heightEnd",-.25,.25).onChange(n),H(),window.addEventListener("resize",H,!1)}function n(){g.ellipsoidRegion.radius.copy(e.ellipsoidRegion.radius),e.update(),g.update(),f.update(),e.ellipsoidRegion.getBoundingSphere(c.sphere),e.ellipsoidRegion.getBoundingBox(u.box,a.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale);const h=e.ellipsoidRegion._getPoints();t.forEach(i=>i.visible=!1);for(let i=0;i{a.deleteCamera(u),e.deleteCamera(u),a.setCamera(l),e.setCamera(l),d.setCamera(l)}),d=new x(m,r.camera,s.domElement),d.minZoomDistance=2,d.cameraRadius=1,c=new D,c.rotation.set(Math.PI/2,0,0),m.add(c),f(),w(),window.addEventListener("resize",w,!1);const o=new F,n=o.addFolder("camera");n.add(t,"orthographic").onChange(l=>{r.fixedPoint.copy(d.pivotPoint),r.toggle()}),n.add(t,"transitionDuration",0,1.5);const i=o.addFolder("fade");i.add(t,"useFade"),i.add(t,"fadeRootTiles"),i.add(t,"errorTarget",0,1e3),i.add(t,"fadeDuration",0,5),i.add(t,"renderScale",.1,1,.05).onChange(l=>s.setPixelRatio(l*window.devicePixelRatio));const _=i.add(t,"fadingGroundTiles").listen().disable();_.domElement.style.opacity=1,o.add(t,"reinstantiateTiles"),o.open()}function f(){e&&(e.dispose(),e.group.removeFromParent(),a.dispose(),a.group.removeFromParent()),e=new g("https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize_tileset.json"),e.fetchOptions.mode="cors",e.lruCache.minSize=900,e.lruCache.maxSize=1300,e.errorTarget=12,e.registerPlugin(new p),e.setCamera(r.camera),a=new g("https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_sky/0528_0260184_to_s64o256_sky_tileset.json"),a.fetchOptions.mode="cors",a.lruCache=e.lruCache,a.registerPlugin(new p),a.setCamera(r.camera),c.add(e.group,a.group)}function w(){const{perspectiveCamera:o,orthographicCamera:n}=r,i=window.innerWidth/window.innerHeight;n.bottom=-40,n.top=40,n.left=-40*i,n.right=40*i,n.updateProjectionMatrix(),o.aspect=i,o.updateProjectionMatrix(),s.setSize(window.innerWidth,window.innerHeight)}function h(){requestAnimationFrame(h),d.enabled=!r.animating,d.update(),r.duration=1e3*t.transitionDuration,r.update();const o=r.camera;o.updateMatrixWorld();const n=e.getPluginByName("FADE_TILES_PLUGIN");n.fadeRootTiles=t.fadeRootTiles,n.fadeDuration=t.useFade?t.fadeDuration*1e3:0,e.errorTarget=t.errorTarget,e.setCamera(o),e.setResolutionFromRenderer(o,s),e.update();const i=a.getPluginByName("FADE_TILES_PLUGIN");i.fadeRootTiles=t.fadeRootTiles,i.fadeDuration=t.useFade?t.fadeDuration*1e3:0,a.setCamera(o),a.setResolutionFromRenderer(o,s),a.update(),s.render(m,o),t.fadingGroundTiles=n.fadingTiles+" tiles"} diff --git a/example/bundle/assets/globe-hh_3Lr0c.js b/example/bundle/assets/globe-hh_3Lr0c.js new file mode 100644 index 000000000..35a39c6e5 --- /dev/null +++ b/example/bundle/assets/globe-hh_3Lr0c.js @@ -0,0 +1 @@ +import{k as m,n as a}from"./three.module-CA-qMkP1.js";import{c as g,j as t,r as p,C as u,T as d,b as e,g as x,h,d as j,G as f,f as P,a as T}from"./CameraControls-Budxqpvb.js";import{u as v,G,T as y}from"./leva.esm-DJZUUddB.js";import{T as C}from"./TilesFadePlugin-ChL3fYSz.js";import{T as M}from"./TileCompressionPlugin-a_ThVUk-.js";import{U as b}from"./UpdateOnChangePlugin-C5cEQ6o6.js";import{D as k}from"./DRACOLoader-Dj1M3u4C.js";import{G as w}from"./GoogleCloudAuthPlugin-B6MTG2Cr.js";import"./EnvironmentControls-7w_Q0bky.js";import"./GlobeControls-B_ZEgOcW.js";import"./Ellipsoid-_mEueZip.js";import"./TilesRenderer-5XUDbyI2.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";import"./GLTFMeshFeaturesExtension-CLQL6scj.js";const D=new k().setDecoderPath("https://www.gstatic.com/draco/v1/decoders/"),n=new m,l=new m;function E(){const r=p.useRef();return T(({camera:s})=>{const o=r.current;n.setFromMatrixPosition(s.matrixWorld),o.position.set(0,0,0),o.updateMatrixWorld(),l.setFromMatrixPosition(o.matrixWorld);const c=n.distanceTo(l),i=Math.max(.05*c,25);o.scale.setScalar(i),o.position.z=i*.5}),t.jsxs("mesh",{ref:r,"rotation-x":-Math.PI/2,raycast:()=>{},children:[t.jsx("coneGeometry",{args:[.3]}),t.jsx("meshStandardMaterial",{color:15483002,emissive:15483002,emissiveIntensity:.25})]})}function I(){const r={apiToken:{value:localStorage.getItem("google-token")||"put-your-api-key-here",onChange:o=>localStorage.setItem("google-token",o),transient:!1}},{apiToken:s}=v(r);return t.jsxs(u,{camera:{position:[0,4*1e7,1e8]},style:{width:"100%",height:"100%",position:"absolute",margin:0,left:0,top:0},color:"red",children:[t.jsx("color",{attach:"background",args:[1118481]}),t.jsx("group",{"rotation-x":-Math.PI/2,children:t.jsxs(d,{children:[t.jsx(e,{plugin:w,args:{apiToken:s}}),t.jsx(e,{plugin:G,dracoLoader:D}),t.jsx(e,{plugin:M}),t.jsx(e,{plugin:b}),t.jsx(e,{plugin:C}),t.jsx(x,{enableDamping:!0}),t.jsx(y,{}),t.jsx(h,{lat:34.2013*a.DEG2RAD,lon:-118.1714*a.DEG2RAD,height:350,children:t.jsx(E,{})}),";"]},s)}),t.jsx(j,{preset:"sunset",backgroundBlurriness:.9,environmentIntensity:1}),t.jsx(f,{alignment:"bottom-right",children:t.jsx(P,{})})]})}g(document.getElementById("root")).render(t.jsx(p.StrictMode,{children:t.jsx(I,{})})); diff --git a/example/bundle/assets/gltf-B-zxkh7M.js b/example/bundle/assets/gltf-B-zxkh7M.js new file mode 100644 index 000000000..e0cd861ad --- /dev/null +++ b/example/bundle/assets/gltf-B-zxkh7M.js @@ -0,0 +1 @@ +import{S as k,W as M,P as L,a as b,D as C,A as F,L as P}from"./three.module-CA-qMkP1.js";import{O as S}from"./OrbitControls-BpFvfpv4.js";import{D as x}from"./DRACOLoader-Dj1M3u4C.js";import{G}from"./GLTFLoader-JNhhxs0g.js";import{G as g}from"./GLTFExtensionLoader-Bl-gplNT.js";import"./LoaderBase-CVSPpjX2.js";let s,t,r,e,i;R();h();function R(){r=new k,e=new M({antialias:!0}),e.setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1383455),e.shadowMap.enabled=!0,e.shadowMap.type=L,document.body.appendChild(e.domElement),s=new b(60,window.innerWidth/window.innerHeight,1,4e3),s.position.set(3,10,20),t=new S(s,e.domElement),t.screenSpacePanning=!1,t.minDistance=1,t.maxDistance=2e3,i=new C(16777215,1.25),i.position.set(1,2,3).multiplyScalar(40),i.castShadow=!0,i.shadow.bias=-.01,i.shadow.mapSize.setScalar(2048);const d=i.shadow.camera;d.left=-200,d.bottom=-200,d.right=200,d.top=200,d.updateProjectionMatrix(),r.add(i);const p=new F(16777215,.05);r.add(p);let c=0;const f=["https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb","https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/CesiumMilkTruck/glTF-Embedded/CesiumMilkTruck.gltf","https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/CesiumMilkTruck/glTF/CesiumMilkTruck.gltf"];for(const o of f){const n=new g;n.workingPath=n.workingPathForURL(o),n.loadAsync(o).then(a=>{a.scene.position.set(c+=5,0,0),t.target.set(c/2,0,0),t.update(),console.log("default loader:",{gltf:a,url:o}),r.add(a.scene)})}const T=["https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/CesiumMilkTruck/glTF-Draco/CesiumMilkTruck.gltf","https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Box/glTF-Binary/Box.glb"],l=new P,m=new G(l),w=new x(l);w.setDecoderPath("https://unpkg.com/three@0.153.0/examples/jsm/libs/draco/gltf/"),m.setDRACOLoader(w),l.addHandler(/\.gltf$/,m),l.addHandler(/\.glb$/,m);for(const o of T){const n=new g(l);n.workingPath=n.workingPathForURL(o),n.loadAsync(o).then(a=>{a.scene.position.set(c+=5,0,0),t.target.set(c/2,0,0),t.update(),console.log("custom loader:",{gltf:a,url:o}),r.add(a.scene)})}u(),window.addEventListener("resize",u,!1)}function u(){s.aspect=window.innerWidth/window.innerHeight,e.setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),s.updateProjectionMatrix()}function h(){requestAnimationFrame(h),D()}function D(){e.render(r,s)} diff --git a/example/bundle/assets/googleMapsAerial-ihuPlBcZ.js b/example/bundle/assets/googleMapsAerial-ihuPlBcZ.js new file mode 100644 index 000000000..8fed3ea00 --- /dev/null +++ b/example/bundle/assets/googleMapsAerial-ihuPlBcZ.js @@ -0,0 +1,2 @@ +import{i as Be,j as Qe,E as $e,k as u,l as k,T as Y,Q as Ae,m as Me,V as f,n as U,S as Je,W as et,a as tt,R as nt}from"./three.module-CA-qMkP1.js";import{G as ot}from"./GLTFLoader-JNhhxs0g.js";import{D as at}from"./DRACOLoader-Dj1M3u4C.js";import{g as it}from"./lil-gui.module.min-Bc0DeA9g.js";import{T as st}from"./TileCompressionPlugin-a_ThVUk-.js";import{T as rt}from"./TilesFadePlugin-ChL3fYSz.js";import{G as lt}from"./GoogleTilesRenderer-BOTt9IiB.js";import{G as ct}from"./GoogleCloudAuthPlugin-B6MTG2Cr.js";import{W as mt}from"./I3DMLoader-Bb2sAfDf.js";import{t as pt}from"./Ellipsoid-_mEueZip.js";import"./TilesRenderer-5XUDbyI2.js";import"./B3DMLoader-QE4NIaTt.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";const De={type:"change"},ae={type:"start"},Le={type:"end"},B=new Be,Re=new Qe,ut=Math.cos(70*U.DEG2RAD);class dt extends $e{constructor(m,O){super();const e=this;this.panPlane=new u(0,1,0),this.object=m,this.domElement=O,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new u,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:k.ROTATE,MIDDLE:k.DOLLY,RIGHT:k.PAN},this.touches={ONE:Y.ROTATE,TWO:Y.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",ne),this._domElementKeyEvents=t},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",ne),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(De),e.update(),i=o.NONE},this.update=function(){const t=new u,n=new Ae().setFromUnitVectors(e.panPlane,new u(0,1,0)),l=n.clone().invert(),c=new u,p=new Ae,X=new u,T=2*Math.PI;return function(){const Oe=e.object.position;t.copy(Oe).sub(e.target),t.applyQuaternion(n),r.setFromVector3(t),e.autoRotate&&i===o.NONE&&H(Ce()),e.enableDamping?(r.theta+=b.theta*e.dampingFactor,r.phi+=b.phi*e.dampingFactor):(r.theta+=b.theta,r.phi+=b.phi);let y=e.minAzimuthAngle,E=e.maxAzimuthAngle;isFinite(y)&&isFinite(E)&&(y<-Math.PI?y+=T:y>Math.PI&&(y-=T),E<-Math.PI?E+=T:E>Math.PI&&(E-=T),y<=E?r.theta=Math.max(y,Math.min(E,r.theta)):r.theta=r.theta>(y+E)/2?Math.max(y,r.theta):Math.min(E,r.theta)),r.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,r.phi)),r.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(x,e.dampingFactor):e.target.add(x),e.zoomToCursor&&W||e.object.isOrthographicCamera?r.radius=ee(r.radius):r.radius=ee(r.radius*A),t.setFromSpherical(r),t.applyQuaternion(l),Oe.copy(e.target).add(t),e.object.lookAt(e.target),e.enableDamping===!0?(b.theta*=1-e.dampingFactor,b.phi*=1-e.dampingFactor,x.multiplyScalar(1-e.dampingFactor)):(b.set(0,0,0),x.set(0,0,0));let V=!1;if(e.zoomToCursor&&W){let z=null;if(e.object.isPerspectiveCamera){const F=t.length();z=ee(F*A);const q=F-z;e.object.position.addScaledVector(se,q),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const F=new u(w.x,w.y,0);F.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/A)),e.object.updateProjectionMatrix(),V=!0;const q=new u(w.x,w.y,0);q.unproject(e.object),e.object.position.sub(q).add(F),e.object.updateMatrixWorld(),z=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;z!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(z).add(e.object.position):(B.origin.copy(e.object.position),B.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.panPlane.dot(B.direction))ie||8*(1-p.dot(e.object.quaternion))>ie||X.distanceToSquared(e.target)>0?(e.dispatchEvent(De),c.copy(e.object.position),p.copy(e.object.quaternion),X.copy(e.target),V=!1,!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",we),e.domElement.removeEventListener("pointerdown",Ee),e.domElement.removeEventListener("pointercancel",_),e.domElement.removeEventListener("wheel",Pe),e.domElement.removeEventListener("pointermove",te),e.domElement.removeEventListener("pointerup",_),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",ne),e._domElementKeyEvents=null)};const o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=o.NONE;const ie=1e-6,r=new Me,b=new Me;let A=1;const x=new u,M=new f,D=new f,S=new f,L=new f,R=new f,j=new f,N=new f,C=new f,K=new f,se=new u,w=new f;let W=!1;const a=[],Z={};function Ce(){return 2*Math.PI/60/60*e.autoRotateSpeed}function v(){return Math.pow(.95,e.zoomSpeed)}function H(t){b.theta-=t}function G(t){b.phi-=t}const re=function(){const t=new u;return function(l,c){t.setFromMatrixColumn(c,0),t.multiplyScalar(-l),x.add(t)}}(),le=function(){const t=new u;return function(l,c){e.screenSpacePanning===!0?t.setFromMatrixColumn(c,1):(t.setFromMatrixColumn(c,0),t.crossVectors(e.panPlane,t)),t.multiplyScalar(l),x.add(t)}}(),I=function(){const t=new u;return function(l,c){const p=e.domElement;if(e.object.isPerspectiveCamera){const X=e.object.position;t.copy(X).sub(e.target);let T=t.length();T*=Math.tan(e.object.fov/2*Math.PI/180),re(2*l*T/p.clientHeight,e.object.matrix),le(2*c*T/p.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(re(l*(e.object.right-e.object.left)/e.object.zoom/p.clientWidth,e.object.matrix),le(c*(e.object.top-e.object.bottom)/e.object.zoom/p.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function J(t){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?A/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function ce(t){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?A*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function me(t){if(!e.zoomToCursor)return;W=!0;const n=t.clientX-e.domElement.clientLeft,l=t.clientY-e.domElement.clientTop,c=e.domElement.clientWidth,p=e.domElement.clientHeight;w.x=n/c*2-1,w.y=-(l/p)*2+1,se.set(w.x,w.y,1).unproject(m).sub(m.position).normalize()}function ee(t){return Math.max(e.minDistance,Math.min(e.maxDistance,t))}function pe(t){M.set(t.clientX,t.clientY)}function Ie(t){me(t),N.set(t.clientX,t.clientY)}function ue(t){L.set(t.clientX,t.clientY)}function ke(t){D.set(t.clientX,t.clientY),S.subVectors(D,M).multiplyScalar(e.rotateSpeed);const n=e.domElement;H(2*Math.PI*S.x/n.clientHeight),G(2*Math.PI*S.y/n.clientHeight),M.copy(D),e.update()}function Ye(t){C.set(t.clientX,t.clientY),K.subVectors(C,N),K.y>0?J(v()):K.y<0&&ce(v()),N.copy(C),e.update()}function Ke(t){R.set(t.clientX,t.clientY),j.subVectors(R,L).multiplyScalar(e.panSpeed),I(j.x,j.y),L.copy(R),e.update()}function He(t){me(t),t.deltaY<0?ce(v()):t.deltaY>0&&J(v()),e.update()}function _e(t){let n=!1;switch(t.code){case e.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?G(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):I(0,e.keyPanSpeed),n=!0;break;case e.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?G(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):I(0,-e.keyPanSpeed),n=!0;break;case e.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?H(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):I(e.keyPanSpeed,0),n=!0;break;case e.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?H(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):I(-e.keyPanSpeed,0),n=!0;break}n&&(t.preventDefault(),e.update())}function de(){if(a.length===1)M.set(a[0].pageX,a[0].pageY);else{const t=.5*(a[0].pageX+a[1].pageX),n=.5*(a[0].pageY+a[1].pageY);M.set(t,n)}}function he(){if(a.length===1)L.set(a[0].pageX,a[0].pageY);else{const t=.5*(a[0].pageX+a[1].pageX),n=.5*(a[0].pageY+a[1].pageY);L.set(t,n)}}function fe(){const t=a[0].pageX-a[1].pageX,n=a[0].pageY-a[1].pageY,l=Math.sqrt(t*t+n*n);N.set(0,l)}function ze(){e.enableZoom&&fe(),e.enablePan&&he()}function Fe(){e.enableZoom&&fe(),e.enableRotate&&de()}function ge(t){if(a.length==1)D.set(t.pageX,t.pageY);else{const l=oe(t),c=.5*(t.pageX+l.x),p=.5*(t.pageY+l.y);D.set(c,p)}S.subVectors(D,M).multiplyScalar(e.rotateSpeed);const n=e.domElement;H(2*Math.PI*S.x/n.clientHeight),G(2*Math.PI*S.y/n.clientHeight),M.copy(D)}function be(t){if(a.length===1)R.set(t.pageX,t.pageY);else{const n=oe(t),l=.5*(t.pageX+n.x),c=.5*(t.pageY+n.y);R.set(l,c)}j.subVectors(R,L).multiplyScalar(e.panSpeed),I(j.x,j.y),L.copy(R)}function ye(t){const n=oe(t),l=t.pageX-n.x,c=t.pageY-n.y,p=Math.sqrt(l*l+c*c);C.set(0,p),K.set(0,Math.pow(C.y/N.y,e.zoomSpeed)),J(K.y),N.copy(C)}function Ue(t){e.enableZoom&&ye(t),e.enablePan&&be(t)}function We(t){e.enableZoom&&ye(t),e.enableRotate&&ge(t)}function Ee(t){e.enabled!==!1&&(a.length===0&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",te),e.domElement.addEventListener("pointerup",_)),Ve(t),t.pointerType==="touch"?Ge(t):Ze(t))}function te(t){e.enabled!==!1&&(t.pointerType==="touch"?Xe(t):ve(t))}function _(t){qe(t),a.length===0&&(e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",te),e.domElement.removeEventListener("pointerup",_)),e.dispatchEvent(Le),i=o.NONE}function Ze(t){let n;switch(t.button){case 0:n=e.mouseButtons.LEFT;break;case 1:n=e.mouseButtons.MIDDLE;break;case 2:n=e.mouseButtons.RIGHT;break;default:n=-1}switch(n){case k.DOLLY:if(e.enableZoom===!1)return;Ie(t),i=o.DOLLY;break;case k.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enablePan===!1)return;ue(t),i=o.PAN}else{if(e.enableRotate===!1)return;pe(t),i=o.ROTATE}break;case k.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enableRotate===!1)return;pe(t),i=o.ROTATE}else{if(e.enablePan===!1)return;ue(t),i=o.PAN}break;default:i=o.NONE}i!==o.NONE&&e.dispatchEvent(ae)}function ve(t){switch(i){case o.ROTATE:if(e.enableRotate===!1)return;ke(t);break;case o.DOLLY:if(e.enableZoom===!1)return;Ye(t);break;case o.PAN:if(e.enablePan===!1)return;Ke(t);break}}function Pe(t){e.enabled===!1||e.enableZoom===!1||i!==o.NONE||(t.preventDefault(),e.dispatchEvent(ae),He(t),e.dispatchEvent(Le))}function ne(t){e.enabled===!1||e.enablePan===!1||_e(t)}function Ge(t){switch(Te(t),a.length){case 1:switch(e.touches.ONE){case Y.ROTATE:if(e.enableRotate===!1)return;de(),i=o.TOUCH_ROTATE;break;case Y.PAN:if(e.enablePan===!1)return;he(),i=o.TOUCH_PAN;break;default:i=o.NONE}break;case 2:switch(e.touches.TWO){case Y.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ze(),i=o.TOUCH_DOLLY_PAN;break;case Y.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Fe(),i=o.TOUCH_DOLLY_ROTATE;break;default:i=o.NONE}break;default:i=o.NONE}i!==o.NONE&&e.dispatchEvent(ae)}function Xe(t){switch(Te(t),i){case o.TOUCH_ROTATE:if(e.enableRotate===!1)return;ge(t),e.update();break;case o.TOUCH_PAN:if(e.enablePan===!1)return;be(t),e.update();break;case o.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ue(t),e.update();break;case o.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;We(t),e.update();break;default:i=o.NONE}}function we(t){e.enabled!==!1&&t.preventDefault()}function Ve(t){a.push(t)}function qe(t){delete Z[t.pointerId];for(let n=0;nparseFloat(o));if(m.length!==2||m.findIndex(o=>Number.isNaN(o))!==-1)return;const[O,e]=m;s.setLatLonToYUp(O*U.DEG2RAD,e*U.DEG2RAD)}function Ne(){requestAnimationFrame(Ne),s&&(g.update(),s.setResolutionFromRenderer(d,P),s.setCamera(d),d.updateMatrixWorld(),s.update(),bt())}function bt(){if(P.render(Q,d),s){const h=s.group.matrixWorld.clone().invert(),m=d.position.clone().applyMatrix4(h),O={};mt.getPositionToCartographic(m,O),document.getElementById("credits").innerText=pt(O.lat,O.lon)+` +`+s.getAttributions()[0].value}} diff --git a/example/bundle/assets/googleMapsExample-DNvBq6rL.js b/example/bundle/assets/googleMapsExample-DNvBq6rL.js new file mode 100644 index 000000000..4d0623bed --- /dev/null +++ b/example/bundle/assets/googleMapsExample-DNvBq6rL.js @@ -0,0 +1,2 @@ +import{W as F,S as G,a as T,O as b,n}from"./three.module-CA-qMkP1.js";import{G as M,e as S}from"./GLTFLoader-JNhhxs0g.js";import{D as W}from"./DRACOLoader-Dj1M3u4C.js";import{g as L}from"./lil-gui.module.min-Bc0DeA9g.js";import{S as z}from"./stats.module--VATS4Kh.js";import{C as $}from"./CameraTransitionManager-BQ4iVDfk.js";import{T as H}from"./TileCompressionPlugin-a_ThVUk-.js";import{U as I}from"./UpdateOnChangePlugin-C5cEQ6o6.js";import{T as O}from"./TilesFadePlugin-ChL3fYSz.js";import{G as K}from"./GlobeControls-B_ZEgOcW.js";import{C as E,t as k}from"./Ellipsoid-_mEueZip.js";import{G as U}from"./GoogleCloudAuthPlugin-B6MTG2Cr.js";import{W as h}from"./I3DMLoader-Bb2sAfDf.js";import{G as j}from"./GoogleTilesRenderer-BOTt9IiB.js";import"./EnvironmentControls-7w_Q0bky.js";import"./TilesRenderer-5XUDbyI2.js";import"./B3DMLoader-QE4NIaTt.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";let p,u,m,t,r,w,C;const B=localStorage.getItem("googleApiKey")??"put-your-api-key-here",d={orthographic:!1,enableCacheDisplay:!1,enableRendererStats:!1,apiKey:B,reload:A};q();v();function A(){t&&(u.remove(t.group),t.dispose(),t=null),localStorage.setItem("googleApiKey",d.apiKey),t=new j,t.registerPlugin(new U({apiToken:d.apiKey,autoRefreshToken:!0})),t.registerPlugin(new H),t.registerPlugin(new I),t.registerPlugin(new O),t.group.rotation.x=-Math.PI/2;const o=new W;o.setDecoderPath("https://unpkg.com/three@0.153.0/examples/jsm/libs/draco/gltf/");const e=new M(t.manager);e.setDRACOLoader(o),t.manager.addHandler(/\.gltf$/,e),u.add(t.group),t.setResolutionFromRenderer(r.camera,m),t.setCamera(r.camera),p.setTilesRenderer(t)}function q(){m=new F({antialias:!0}),m.setClearColor(1383455),document.body.appendChild(m.domElement),u=new G,r=new $(new T(60,window.innerWidth/window.innerHeight,1,16e7),new b(-1,1,1,-1,1,16e7)),r.perspectiveCamera.position.set(48e5,257e4,1472e4),r.perspectiveCamera.lookAt(0,0,0),r.addEventListener("camera-changed",({camera:i,prevCamera:s})=>{t.deleteCamera(s),t.setCamera(i),p.setCamera(i)}),r.orthographicPositionalZoom=!1,p=new K(u,r.camera,m.domElement,null),p.enableDamping=!0,A(),P(),window.addEventListener("resize",P,!1),window.addEventListener("hashchange",y);const o=new L;o.width=300,o.add(d,"orthographic").onChange(i=>{p.getPivotPoint(r.fixedPoint),p.updateCameraClipPlanes(r.perspectiveCamera),p.updateCameraClipPlanes(r.orthographicCamera),r.toggle()});const e=o.addFolder("Google Tiles");e.add(d,"apiKey"),e.add(d,"reload");const a=o.addFolder("Example Options");a.add(d,"enableCacheDisplay"),a.add(d,"enableRendererStats"),w=document.createElement("div"),document.getElementById("info").appendChild(w),C=new z,C.showPanel(0),document.body.appendChild(C.dom),y(),setInterval(_,100)}function P(){const{perspectiveCamera:o,orthographicCamera:e}=r,a=window.innerWidth/window.innerHeight;o.aspect=a,o.updateProjectionMatrix(),e.left=-e.top*a,e.right=-e.left,e.updateProjectionMatrix(),m.setSize(window.innerWidth,window.innerHeight),m.setPixelRatio(window.devicePixelRatio)}function _(){if(!t)return;const o=r.camera,e={},a={},i=t.group.matrixWorld.clone().invert(),s=o.position.clone().applyMatrix4(i),g=o.matrixWorld.clone().premultiply(i);h.getPositionToCartographic(s,e),h.getAzElRollFromRotationMatrix(e.lat,e.lon,g,a,E),a.azimuth*=n.RAD2DEG,a.elevation*=n.RAD2DEG,e.lat*=n.RAD2DEG,e.lon*=n.RAD2DEG;const l=new URLSearchParams;l.set("lat",e.lat.toFixed(4)),l.set("lon",e.lon.toFixed(4)),l.set("height",e.height.toFixed(2)),l.set("az",a.azimuth.toFixed(2)),l.set("el",a.elevation.toFixed(2)),window.history.replaceState(void 0,void 0,`#${l}`)}function y(){const o=window.location.hash.replace(/^#/,""),e=new URLSearchParams(o);if(!e.has("lat")&&!e.has("lon"))return;t.group.updateMatrixWorld();const a=r.camera,i=parseFloat(e.get("lat")),s=parseFloat(e.get("lon")),g=parseFloat(e.get("height"))||1e3;if(e.has("az")&&e.has("el")){const l=parseFloat(e.get("az")),c=parseFloat(e.get("el"));h.getRotationMatrixFromAzElRoll(i*n.DEG2RAD,s*n.DEG2RAD,l*n.DEG2RAD,c*n.DEG2RAD,0,a.matrixWorld,E),a.matrixWorld.premultiply(t.group.matrixWorld),a.matrixWorld.decompose(a.position,a.quaternion,a.scale),h.getCartographicToPosition(i*n.DEG2RAD,s*n.DEG2RAD,g,a.position),a.position.applyMatrix4(t.group.matrixWorld)}else h.getCartographicToPosition(i*n.DEG2RAD,s*n.DEG2RAD,g,a.position),a.position.applyMatrix4(t.group.matrixWorld),a.lookAt(0,0,0)}function v(){if(requestAnimationFrame(v),!t)return;p.enabled=!r.animating,p.update(),r.update();const o=r.camera;t.setResolutionFromRenderer(o,m),t.setCamera(o),o.updateMatrixWorld(),t.update(),m.render(u,o),C.update(),V()}function V(){var l;const o=t.lruCache.itemList.length/t.lruCache.maxSize;let e="";if(d.enableCacheDisplay){e+=`Downloading: ${t.stats.downloading} Parsing: ${t.stats.parsing} Visible: ${t.visibleTiles.size}
`;const c=new Set;t.traverse(x=>{const R=x.cached.scene;R&&R.traverse(D=>{D.geometry&&c.add(D.geometry)})});let f=0;c.forEach(x=>{f+=S(x)}),e+=`Cache: ${(100*o).toFixed(2)}% ~${(f/1e3/1e3).toFixed(2)}mb
`}if(d.enableRendererStats){const c=m.info.memory,f=m.info.programs.length;e+=`Geometries: ${c.geometries} Textures: ${c.textures} Programs: ${f}`}w.innerHTML!==e&&(w.innerHTML=e);const a=t.group.matrixWorld.clone().invert(),i=r.camera.position.clone().applyMatrix4(a),s={};h.getPositionToCartographic(i,s);const g=((l=t.getAttributions()[0])==null?void 0:l.value)||"";document.getElementById("credits").innerText=k(s.lat,s.lon)+` +`+g} diff --git a/example/bundle/assets/i3dmExample-CB4Gl4D7.js b/example/bundle/assets/i3dmExample-CB4Gl4D7.js new file mode 100644 index 000000000..86fea6fc4 --- /dev/null +++ b/example/bundle/assets/i3dmExample-CB4Gl4D7.js @@ -0,0 +1 @@ +import{S,W as P,P as b,a as M,D as W,A as C,k as m,Q as v,p as L}from"./three.module-CA-qMkP1.js";import{O as y}from"./OrbitControls-BpFvfpv4.js";import{I as R}from"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./Ellipsoid-_mEueZip.js";let n,a,s,e,i;z();f();function z(){s=new S,e=new P({antialias:!0}),e.setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1383455),e.shadowMap.enabled=!0,e.shadowMap.type=b,document.body.appendChild(e.domElement),n=new M(60,window.innerWidth/window.innerHeight,1,4e3),n.position.set(100,100,100),a=new y(n,e.domElement),a.screenSpacePanning=!1,a.minDistance=1,a.maxDistance=2e3,i=new W(16777215,1.25),i.position.set(1,2,3).multiplyScalar(40),i.castShadow=!0,i.shadow.bias=-.01,i.shadow.mapSize.setScalar(2048);const o=i.shadow.camera;o.left=-200,o.bottom=-200,o.right=200,o.top=200,o.updateProjectionMatrix(),s.add(i);const h=new C(16777215,.05);s.add(h),new R().loadAsync("https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/main/1.0/TilesetWithTreeBillboards/tree.i3dm").then(d=>{let t=null;if(d.scene.traverse(r=>{!t&&r.isInstancedMesh&&(t=r)}),t){d.scene.updateMatrixWorld(!0);const r=new m,u=new v,g=new m,w=new L,c=new m;for(let l=0,x=t.count;l>Math.log2(t),k=g[l];if(!this.getBit(I._tileAvailability,s)){B.push(void 0);continue}const n=this.deriveChildTile(I,k,s,a);k.children.push(n),B.push(n)}g=B,B=[]}return g}deriveChildTile(A,I,g,B){const e=new PA(I,B);e.boundingVolume=this.getTileBoundingVolume(e),e.geometricError=this.getGeometricError(e);for(let t=0;A&&t=A.lengthBits)throw new Error("Bit index out of bounds.");if(A.constant!==void 0)return A.constant;const g=I>>3,B=I%8;return(new Uint8Array(A.bitstream)[g]>>B&1)===1}getTileBoundingVolume(A){const I={};if(this.rootTile.boundingVolume.region){const g=[...this.rootTile.boundingVolume.region],B=g[0],e=g[2],t=g[1],C=g[3],o=(e-B)/Math.pow(2,A.__level),a=(C-t)/Math.pow(2,A.__level);g[0]=B+o*A.__x,g[2]=B+o*(A.__x+1),g[1]=t+a*A.__y,g[3]=t+a*(A.__y+1);for(let s=0;s<4;s++){const l=g[s];l<-Math.PI?g[s]+=2*Math.PI:l>Math.PI&&(g[s]-=2*Math.PI)}if(fA(A)){const s=g[4],k=(g[5]-s)/Math.pow(2,A.__level);g[4]=s+k*A.__z,g[5]=s+k*(A.__z+1)}I.region=g}if(this.rootTile.boundingVolume.box){const g=[...this.rootTile.boundingVolume.box],B=2**A.__level-1,e=Math.pow(2,-A.__level),t=fA(A)?3:2;for(let C=0;C{const B=this._getIdleWorker();B!==-1?(this._initWorker(B),this.workerStatus|=1<A.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const yg=0,OA=2,Fg=1,vA=2,Gg=0,pg=1,Sg=10,Rg=0,II=9,gI=15,BI=16,eI=22,iI=37,tI=43,CI=76,QI=83,EI=97,oI=100,sI=103,aI=109,nI=165,rI=166;class mg{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class AA{constructor(A,I,g,B){this._dataView=new DataView(A.buffer,A.byteOffset+I,g),this._littleEndian=B,this._offset=0}_nextUint8(){const A=this._dataView.getUint8(this._offset);return this._offset+=1,A}_nextUint16(){const A=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,A}_nextUint32(){const A=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,A}_nextUint64(){const A=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,A}_nextInt32(){const A=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,A}_skip(A){return this._offset+=A,this}_scan(A,I=0){const g=this._offset;let B=0;for(;this._dataView.getUint8(this._offset)!==I&&BA.arrayBuffer()).then(A=>WebAssembly.instantiate(A,UA)).then(this._init):WebAssembly.instantiate(Buffer.from(WA,"base64"),UA).then(this._init),uA)}_init(A){b=A.instance,UA.env.emscripten_notify_memory_growth(0)}decode(A,I=0){if(!b)throw new Error("ZSTDDecoder: Await .init() before decoding.");const g=A.byteLength,B=b.exports.malloc(g);xA.set(A,B),I=I||Number(b.exports.ZSTD_findDecompressedSize(B,g));const e=b.exports.malloc(I),t=b.exports.ZSTD_decompress(e,I,B,g),C=xA.slice(e,e+t);return b.exports.free(B),b.exports.free(e),C}}const WA="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",LA=new WeakMap;let NA=0,kA;class H extends yI{constructor(A){super(A),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new fg,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(A){return this.transcoderPath=A,this}setWorkerLimit(A){return this.workerPool.setWorkerLimit(A),this}async detectSupportAsync(A){return this.workerConfig={astcSupported:await A.hasFeatureAsync("texture-compression-astc"),etc1Supported:await A.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await A.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await A.hasFeatureAsync("texture-compression-bc"),bptcSupported:await A.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await A.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(A){return A.isWebGPURenderer===!0?this.workerConfig={astcSupported:A.hasFeature("texture-compression-astc"),etc1Supported:A.hasFeature("texture-compression-etc1"),etc2Supported:A.hasFeature("texture-compression-etc2"),dxtSupported:A.hasFeature("texture-compression-bc"),bptcSupported:A.hasFeature("texture-compression-bptc"),pvrtcSupported:A.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:A.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:A.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:A.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:A.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:A.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:A.extensions.has("WEBGL_compressed_texture_pvrtc")||A.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const A=new yA(this.manager);A.setPath(this.transcoderPath),A.setWithCredentials(this.withCredentials);const I=A.loadAsync("basis_transcoder.js"),g=new yA(this.manager);g.setPath(this.transcoderPath),g.setResponseType("arraybuffer"),g.setWithCredentials(this.withCredentials);const B=g.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([I,B]).then(([e,t])=>{const C=H.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(H.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(H.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(H.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",C.substring(C.indexOf("{")+1,C.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{const a=new Worker(this.workerSourceURL),s=this.transcoderBinary.slice(0);return a.postMessage({type:"init",config:this.workerConfig,transcoderBinary:s},[s]),a})}),NA>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),NA++}return this.transcoderPending}load(A,I,g,B){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const e=new yA(this.manager);e.setResponseType("arraybuffer"),e.setWithCredentials(this.withCredentials),e.load(A,t=>{if(LA.has(t))return LA.get(t).promise.then(I).catch(B);this._createTexture(t).then(C=>I?I(C):null).catch(B)},g,B)}_createTextureFrom(A,I){const{faces:g,width:B,height:e,format:t,type:C,error:o,dfdFlags:a}=A;if(C==="error")return Promise.reject(o);let s;if(I.faceCount===6)s=new FI(g,t,x);else{const l=g[0].mipmaps;s=I.layerCount>1?new GI(l,B,e,I.layerCount,t,x):new AI(l,B,e,t,x)}return s.minFilter=g[0].mipmaps.length===1?TA:pI,s.magFilter=TA,s.generateMipmaps=!1,s.needsUpdate=!0,s.colorSpace=hI(I),s.premultiplyAlpha=!!(a&Fg),s}async _createTexture(A,I={}){const g=ug(new Uint8Array(A));if(g.vkFormat!==Rg)return Ng(g);const B=I,e=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:A,taskConfig:B},[A])).then(t=>this._createTextureFrom(t.data,g));return LA.set(A,{promise:e}),e}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),NA--,this}}H.BasisFormat={ETC1S:0,UASTC_4x4:1};H.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16};H.EngineFormat={RGBAFormat:X,RGBA_ASTC_4x4_Format:SI,RGBA_BPTC_Format:RI,RGBA_ETC2_EAC_Format:mI,RGBA_PVRTC_4BPPV1_Format:uI,RGBA_S3TC_DXT5_Format:UI,RGB_ETC1_Format:LI,RGB_ETC2_Format:NI,RGB_PVRTC_4BPPV1_Format:kI,RGBA_S3TC_DXT1_Format:MI};H.BasisWorker=function(){let i,A,I;const g=_EngineFormat,B=_TranscoderFormat,e=_BasisFormat;self.addEventListener("message",function(h){const r=h.data;switch(r.type){case"init":i=r.config,t(r.transcoderBinary);break;case"transcode":A.then(()=>{try{const{faces:c,buffers:d,width:D,height:G,hasAlpha:T,format:M,dfdFlags:u}=C(r.buffer);self.postMessage({type:"transcode",id:r.id,faces:c,width:D,height:G,hasAlpha:T,format:M,dfdFlags:u},d)}catch(c){console.error(c),self.postMessage({type:"error",id:r.id,error:c.message})}});break}});function t(h){A=new Promise(r=>{I={wasmBinary:h,onRuntimeInitialized:r},BASIS(I)}).then(()=>{I.initializeBasis(),I.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function C(h){const r=new I.KTX2File(new Uint8Array(h));function c(){r.close(),r.delete()}if(!r.isValid())throw c(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");const d=r.isUASTC()?e.UASTC_4x4:e.ETC1S,D=r.getWidth(),G=r.getHeight(),T=r.getLayers()||1,M=r.getLevels(),u=r.getFaces(),QA=r.getHasAlpha(),EA=r.getDFDFlags(),{transcoderFormat:Z,engineFormat:j}=l(d,D,G,QA);if(!D||!G||!M)throw c(),new Error("THREE.KTX2Loader: Invalid texture");if(!r.startTranscoding())throw c(),new Error("THREE.KTX2Loader: .startTranscoding failed");const z=[],oA=[];for(let v=0;v1?(S=W.origWidth,U=W.origHeight):(S=W.width,U=W.height);const HA=new Uint8Array(r.getImageTranscodedSizeInBytes(O,Y,0,Z));if(!r.transcodeImage(HA,O,Y,v,Z,0,-1,-1))throw c(),new Error("THREE.KTX2Loader: .transcodeImage failed.");aA.push(HA)}const $=n(aA);sA.push({data:$,width:S,height:U}),oA.push($.buffer)}z.push({mipmaps:sA,width:D,height:G,format:j})}return c(),{faces:z,buffers:oA,width:D,height:G,hasAlpha:QA,format:j,dfdFlags:EA}}const o=[{if:"astcSupported",basisFormat:[e.UASTC_4x4],transcoderFormat:[B.ASTC_4x4,B.ASTC_4x4],engineFormat:[g.RGBA_ASTC_4x4_Format,g.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[e.ETC1S,e.UASTC_4x4],transcoderFormat:[B.BC7_M5,B.BC7_M5],engineFormat:[g.RGBA_BPTC_Format,g.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[e.ETC1S,e.UASTC_4x4],transcoderFormat:[B.BC1,B.BC3],engineFormat:[g.RGBA_S3TC_DXT1_Format,g.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[e.ETC1S,e.UASTC_4x4],transcoderFormat:[B.ETC1,B.ETC2],engineFormat:[g.RGB_ETC2_Format,g.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[e.ETC1S,e.UASTC_4x4],transcoderFormat:[B.ETC1],engineFormat:[g.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[e.ETC1S,e.UASTC_4x4],transcoderFormat:[B.PVRTC1_4_RGB,B.PVRTC1_4_RGBA],engineFormat:[g.RGB_PVRTC_4BPPV1_Format,g.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=o.sort(function(h,r){return h.priorityETC1S-r.priorityETC1S}),s=o.sort(function(h,r){return h.priorityUASTC-r.priorityUASTC});function l(h,r,c,d){let D,G;const T=h===e.ETC1S?a:s;for(let M=0;M{const t=new Ug;await t.init(),e(t)})),I=await kA);const g=[];for(let e=0;e>e),C=Math.max(1,i.pixelHeight>>e),o=i.pixelDepth?Math.max(1,i.pixelDepth>>e):0,a=i.levels[e];let s;if(i.supercompressionScheme===yg)s=a.levelData;else if(i.supercompressionScheme===OA)s=I.decode(a.levelData,a.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let l;_A[A]===cA?l=new Float32Array(s.buffer,s.byteOffset,s.byteLength/Float32Array.BYTES_PER_ELEMENT):_A[A]===dA?l=new Uint16Array(s.buffer,s.byteOffset,s.byteLength/Uint16Array.BYTES_PER_ELEMENT):l=s,g.push({data:l,width:t,height:C,depth:o})}let B;if(Lg.has(MA[A]))B=i.pixelDepth===0?new _I(g[0].data,i.pixelWidth,i.pixelHeight):new xI(g[0].data,i.pixelWidth,i.pixelHeight,i.pixelDepth);else{if(i.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");B=new AI(g,i.pixelWidth,i.pixelHeight)}return B.mipmaps=g,B.type=_A[A],B.format=MA[A],B.colorSpace=hI(i),B.needsUpdate=!0,Promise.resolve(B)}function hI(i){const A=i.dataFormatDescriptor[0];return A.colorPrimaries===pg?A.transferFunction===vA?qI:JI:A.colorPrimaries===Sg?A.transferFunction===vA?HI:TI:A.colorPrimaries===Gg?YA:(console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${A.colorPrimaries}"`),YA)}const kg=1,cI=2,dI=window.location.hash.replace(/^#/,"");let y,BA,q,f,Q,eA,K,N,nA,w,iA,rA,R,F,tA,lA,qA,P,J,p,CA,V,_,L,wA;const E={enableUpdate:!0,raycast:DA,optimizeRaycast:!0,enableCacheDisplay:!1,enableRendererStats:!1,orthographic:!1,errorTarget:6,errorThreshold:60,maxDepth:15,displayActiveTiles:!1,resolutionScale:1,up:dI?"+Z":"+Y",displayBoxBounds:!1,displaySphereBounds:!1,displayRegionBounds:!1,colorMode:0,showThirdPerson:!1,showSecondView:!1,reload:lI};Mg();fI();function lI(){const i=dI||"../data/tileset.json";Q&&(_.remove(Q.group),Q.dispose()),Q=new ng(i),Q.registerPlugin(new Cg),Q.registerPlugin(new Dg);const A=new og;A.setDecoderPath("https://unpkg.com/three@0.153.0/examples/jsm/libs/draco/gltf/");const I=new H;I.setTranscoderPath("https://unpkg.com/three@0.153.0/examples/jsm/libs/basis/"),I.detectSupport(f);const g=new Eg(Q.manager);g.setDRACOLoader(A),g.setKTX2Loader(I),g.register(()=>new dg),Q.fetchOptions.mode="cors",Q.manager.addHandler(/\.gltf$/,g),_.add(Q.group),Q.customColorCallback=(B,e)=>{const C=B.__depth%2===0?16711680:16777215;e.traverse(o=>{o.isMesh&&o.material.color.set(C)})}}function Mg(){q=new YI,f=new FA({antialias:!0}),f.setPixelRatio(window.devicePixelRatio),f.setSize(window.innerWidth,window.innerHeight),f.setClearColor(1383455),document.body.appendChild(f.domElement),f.domElement.tabIndex=1,y=new GA(60,window.innerWidth/window.innerHeight,1,1e4),y.position.set(400,400,400),eA=new pA(y),q.add(eA),F=new bI,tA=new pA(F),q.add(tA),R=new GA(60,window.innerWidth/window.innerHeight,1,4e3),R.position.set(400,400,-400),R.lookAt(0,0,0),w=new FA({antialias:!0}),w.setPixelRatio(window.devicePixelRatio),w.setSize(window.innerWidth,window.innerHeight),w.setClearColor(1383455),document.body.appendChild(w.domElement),w.domElement.style.position="absolute",w.domElement.style.right="0",w.domElement.style.top="0",w.domElement.style.outline="#0f1416 solid 2px",w.domElement.tabIndex=1,rA=new RA(R,w.domElement),rA.screenSpacePanning=!1,rA.minDistance=1,rA.maxDistance=5e3,iA=new pA(R),q.add(iA),K=new GA(60,window.innerWidth/window.innerHeight,1,4e3),K.position.set(50,40,40),K.lookAt(0,0,0),N=new FA({antialias:!0}),N.setPixelRatio(window.devicePixelRatio),N.setSize(window.innerWidth,window.innerHeight),N.setClearColor(988182),document.body.appendChild(N.domElement),N.domElement.style.position="fixed",N.domElement.style.left="5px",N.domElement.style.bottom="5px",N.domElement.tabIndex=1,nA=new RA(K,N.domElement),nA.screenSpacePanning=!1,nA.minDistance=1,nA.maxDistance=5e3,BA=new RA(y,f.domElement),BA.screenSpacePanning=!1,BA.minDistance=1,BA.maxDistance=5e3;const i=new KI(16777215);i.position.set(1,2,3),q.add(i);const A=new PI(16777215,.2);q.add(A),lA=new WI,qA=new XI,V=new SA,q.add(V),_=new SA,V.add(_),P=new ZI,J=new JA,p=new SA;const I=new OI({color:15277667}),g=new KA(new vI(.25,.25,6),I);g.rotation.x=Math.PI/2,g.position.z+=3,p.add(g);const B=new KA(new VI(1.5,.2,16,100),I);p.add(B),q.add(p),p.visible=!1,lI(),hA(),window.addEventListener("resize",hA,!1),f.domElement.addEventListener("pointermove",ZA,!1),f.domElement.addEventListener("pointerdown",zA,!1),f.domElement.addEventListener("pointerup",$A,!1),f.domElement.addEventListener("pointerleave",XA,!1),w.domElement.addEventListener("pointermove",ZA,!1),w.domElement.addEventListener("pointerdown",zA,!1),w.domElement.addEventListener("pointerup",$A,!1),w.domElement.addEventListener("pointerleave",XA,!1);const e=new sg;e.width=300;const t=e.addFolder("Tiles Options");t.add(E,"displayActiveTiles"),t.add(E,"errorTarget").min(0).max(50),t.add(E,"errorThreshold").min(0).max(1e3),t.add(E,"maxDepth").min(1).max(100),t.add(E,"up",["+Y","+Z","-Z"]),t.open();const C=e.addFolder("Debug Options");C.add(E,"displayBoxBounds"),C.add(E,"displaySphereBounds"),C.add(E,"displayRegionBounds"),C.add(E,"colorMode",{NONE:DA,SCREEN_ERROR:jI,GEOMETRIC_ERROR:zI,DISTANCE:$I,DEPTH:Ag,RELATIVE_DEPTH:Ig,IS_LEAF:gg,RANDOM_COLOR:Bg,RANDOM_NODE_COLOR:eg,CUSTOM_COLOR:ig,LOAD_ORDER:tg}),C.open();const o=e.addFolder("Example Options");o.add(E,"resolutionScale").min(.01).max(2).step(.01).onChange(hA),o.add(E,"orthographic"),o.add(E,"showThirdPerson"),o.add(E,"showSecondView").onChange(hA),o.add(E,"enableUpdate").onChange(a=>{Q.parseQueue.autoUpdate=a,Q.downloadQueue.autoUpdate=a,a&&(Q.parseQueue.scheduleJobRun(),Q.downloadQueue.scheduleJobRun())}),o.add(E,"raycast",{NONE:DA,ALL_HITS:kg,FIRST_HIT_ONLY:cI}),o.add(E,"optimizeRaycast"),o.add(E,"enableCacheDisplay"),o.add(E,"enableRendererStats"),o.open(),e.add(E,"reload"),e.open(),L=document.createElement("div"),L.style.position="absolute",L.style.top=0,L.style.left=0,L.style.color="white",L.style.width="100%",L.style.textAlign="center",L.style.padding="5px",L.style.pointerEvents="none",L.style.lineHeight="1.5em",document.body.appendChild(L),wA=new ag,wA.showPanel(0),document.body.appendChild(wA.dom)}function hA(){K.aspect=window.innerWidth/window.innerHeight,K.updateProjectionMatrix(),N.setSize(Math.floor(window.innerWidth/3),Math.floor(window.innerHeight/3)),E.showSecondView?(y.aspect=.5*window.innerWidth/window.innerHeight,f.setSize(.5*window.innerWidth,window.innerHeight),R.aspect=.5*window.innerWidth/window.innerHeight,w.setSize(.5*window.innerWidth,window.innerHeight),w.domElement.style.display="block"):(y.aspect=window.innerWidth/window.innerHeight,f.setSize(window.innerWidth,window.innerHeight),w.domElement.style.display="none"),y.updateProjectionMatrix(),f.setPixelRatio(window.devicePixelRatio*E.resolutionScale),R.updateProjectionMatrix(),w.setPixelRatio(window.devicePixelRatio),DI()}function XA(i){CA=null}function ZA(i){const A=this.getBoundingClientRect();J.x=i.clientX-A.x,J.y=i.clientY-A.y,J.x=J.x/A.width*2-1,J.y=-(J.y/A.height)*2+1,CA=this}const wI=new JA,jA=new JA;function zA(i){const A=this.getBoundingClientRect();wI.set(i.clientX-A.x,i.clientY-A.y)}function $A(i){const A=this.getBoundingClientRect();if(jA.set(i.clientX-A.x,i.clientY-A.y),wI.distanceTo(jA)>2)return;CA===w.domElement?P.setFromCamera(J,R):P.setFromCamera(J,E.orthographic?F:y),P.firstHitOnly=!0;const I=P.intersectObject(Q.group,!0);if(I.length){const g=I[0].object,B=Q.getPluginByName("DEBUG_TILES_PLUGIN").getTileInformationFromActiveObject(g);let e="";for(const t in B){let C=B[t];typeof C=="number"&&(C=Math.floor(C*1e5)/1e5);let o=t;for(;o.length<20;)o+=" ";e+=`${o} : ${C} +`}console.log(e)}}function DI(){F.position.copy(y.position),F.rotation.copy(y.rotation);const i=y.position.distanceTo(BA.target)/2;let A=window.innerWidth/window.innerHeight;E.showSecondView&&(A*=.5),F.left=-A*i,F.right=A*i,F.bottom=-i,F.top=i,F.near=y.near,F.far=y.far,F.updateProjectionMatrix()}function fI(){requestAnimationFrame(fI),Q.errorTarget=E.errorTarget,Q.errorThreshold=E.errorThreshold,Q.optimizeRaycast=E.optimizeRaycast,Q.displayActiveTiles=E.displayActiveTiles,Q.maxDepth=E.maxDepth;const i=Q.getPluginByName("DEBUG_TILES_PLUGIN");if(i.displayBoxBounds=E.displayBoxBounds,i.displaySphereBounds=E.displaySphereBounds,i.displayRegionBounds=E.displayRegionBounds,i.colorMode=parseFloat(E.colorMode),E.orthographic?(Q.deleteCamera(y),Q.setCamera(F),Q.setResolutionFromRenderer(F,f)):(Q.deleteCamera(F),Q.setCamera(y),Q.setResolutionFromRenderer(y,f)),E.showSecondView?(Q.setCamera(R),Q.setResolutionFromRenderer(R,w)):Q.deleteCamera(R),Q.root&&Q.root.boundingVolume.region&&(Q.getOrientedBoundingBox(lA,_.matrix),_.matrix.decompose(_.position,_.quaternion,_.scale),_.position.set(0,0,0),_.quaternion.invert(),_.scale.set(1,1,1)),V.rotation.set(0,0,0),E.up==="-Z"?V.rotation.x=Math.PI/2:E.up==="+Z"&&(V.rotation.x=-Math.PI/2),V.updateMatrixWorld(!1),Q.getBoundingBox(lA)?(lA.getCenter(Q.group.position),Q.group.position.multiplyScalar(-1)):Q.getBoundingSphere(qA)&&(Q.group.position.copy(qA.center),Q.group.position.multiplyScalar(-1)),parseFloat(E.raycast)!==DA&&CA!==null){CA===f.domElement?P.setFromCamera(J,E.orthographic?F:y):P.setFromCamera(J,R),P.firstHitOnly=parseFloat(E.raycast)===cI;const A=P.intersectObject(Q.group,!0);if(A.length){const I=A[0],g=I.point;if(p.position.copy(g),I.face){const B=I.face.normal;B.transformDirection(I.object.matrixWorld),p.lookAt(g.x+B.x,g.y+B.y,g.z+B.z)}p.visible=!0}else p.visible=!1}else p.visible=!1;window.tiles=Q,E.enableUpdate&&(R.updateMatrixWorld(),y.updateMatrixWorld(),F.updateMatrixWorld(),Q.update()),_g(),wA.update()}function _g(){if(DI(),eA.visible=!1,tA.visible=!1,iA.visible=!1,E.orthographic){const I=F.position.distanceTo(p.position);p.scale.setScalar(I/150)}else{const I=y.position.distanceTo(p.position);p.scale.setScalar(I*y.fov/6e3)}if(f.render(q,E.orthographic?F:y),E.showSecondView){const I=R.position.distanceTo(p.position);p.scale.setScalar(I*R.fov/6e3),w.render(q,R)}if(N.domElement.style.visibility=E.showThirdPerson?"visible":"hidden",E.showThirdPerson){eA.update(),eA.visible=!E.orthographic,tA.update(),tA.visible=E.orthographic,E.showSecondView&&(iA.update(),iA.visible=!0);const I=K.position.distanceTo(p.position);p.scale.setScalar(I*K.fov/6e3),N.render(q,K)}const i=Q.lruCache.itemList.length/Q.lruCache.maxSize;let A=`Downloading: ${Q.stats.downloading} Parsing: ${Q.stats.parsing} Visible: ${Q.visibleTiles.size}`;if(E.enableCacheDisplay){const I=new Set;Q.traverse(B=>{const e=B.cached.scene;e&&e.traverse(t=>{t.geometry&&I.add(t.geometry)})});let g=0;I.forEach(B=>{g+=Qg(B)}),A+=`
Cache: ${(100*i).toFixed(2)}% ~${(g/1e3/1e3).toFixed(2)}mb`}if(E.enableRendererStats){const I=f.info.memory,g=f.info.programs.length;A+=`
Geometries: ${I.geometries} Textures: ${I.textures} Programs: ${g}`}L.innerHTML!==A&&(L.innerHTML=A)} diff --git a/example/bundle/assets/ion-CHjD-vAy.js b/example/bundle/assets/ion-CHjD-vAy.js new file mode 100644 index 000000000..935444335 --- /dev/null +++ b/example/bundle/assets/ion-CHjD-vAy.js @@ -0,0 +1 @@ +import{d as g,k as d}from"./three.module-CA-qMkP1.js";import{c as x,j as e,r as b,C as k,T as f,b as s,E as P,d as C,G as v,f as j}from"./CameraControls-Budxqpvb.js";import{u as y,G as E,T}from"./leva.esm-DJZUUddB.js";import{O as L}from"./Ellipsoid-_mEueZip.js";import{U as M}from"./UpdateOnChangePlugin-C5cEQ6o6.js";import{D as I}from"./DRACOLoader-Dj1M3u4C.js";import{C as w}from"./CesiumIonAuthPlugin-IKQrMOf_.js";import"./EnvironmentControls-7w_Q0bky.js";import"./GlobeControls-B_ZEgOcW.js";import"./TilesRenderer-5XUDbyI2.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";import"./GLTFMeshFeaturesExtension-CLQL6scj.js";import"./GoogleCloudAuthPlugin-B6MTG2Cr.js";const l=new g,m=new d;class z{constructor(t){t={up:"+z",recenter:!0,lat:null,lon:null,height:0,...t},this.tiles=null,this.up=t.up.toLowerCase().replace(/\s+/,""),this.lat=t.lat,this.lon=t.lon,this.height=t.height,this.recenter=t.recenter,this._callback=null}init(t){this.tiles=t,this._callback=()=>{const{up:i,lat:a,lon:r,height:n,recenter:u}=this;if(a!==null&&r!==null)this.transformLatLonHeightToOrigin(a,r,n);else{const{ellipsoid:p}=t,h=Math.min(...p.radius);if(t.getBoundingSphere(l),l.center.length()>h*.5){const o={};p.getPositionToCartographic(l.center,o),this.transformLatLonHeightToOrigin(o.lat,o.lon,o.height)}else{const o=t.group;switch(o.rotation.set(0,0,0),i){case"x":case"+x":o.rotation.z=Math.PI/2;break;case"-x":o.rotation.z=-Math.PI/2;break;case"y":case"+y":break;case"-y":o.rotation.z=Math.PI;break;case"z":case"+z":o.rotation.x=-Math.PI/2;break;case"-z":o.rotation.x=Math.PI/2;break}t.group.position.copy(l.center).applyEuler(o.rotation).multiplyScalar(-1)}}u||t.group.position.setScalar(0),t.removeEventListener("load-tile-set",this._callback)},t.addEventListener("load-tile-set",this._callback)}transformLatLonHeightToOrigin(t,i,a=0){const{group:r,ellipsoid:n}=this.tiles;n.getRotationMatrixFromAzElRoll(t,i,0,0,0,r.matrix,L),n.getCartographicToPosition(t,i,a,m),r.matrix.setPosition(m).invert().decompose(r.position,r.quaternion,r.scale),r.updateMatrixWorld()}dispose(){const{group:t}=this.tiles;t.position.setScalar(0),t.quaternion.identity(),t.scale.set(1,1,1),this.tiles.addEventListener("load-tile-set",this._callback)}}const R=new I().setDecoderPath("https://www.gstatic.com/draco/v1/decoders/");function S(){const c={apiToken:{value:localStorage.getItem("ion-token")||"put-your-api-key-here",onChange:a=>localStorage.setItem("ion-token",a),transient:!1},assetId:{value:"40866",options:{"Aerometrex - San Francisco":"1415196","Aerometrex - Denver":"354307","New York City 3D Buildings":"75343","Melbourne Photogrammetry":"69380","Cesium HQ":"40866","Melbourne Point Cloud":"43978","Montreal Point Cloud":"28945"}}},{apiToken:t,assetId:i}=y(c);return e.jsxs(k,{frameloop:"demand",camera:{position:[300,300,300],near:1,far:1e5},style:{width:"100%",height:"100%",position:"absolute",margin:0,left:0,top:0},children:[e.jsxs(f,{children:[e.jsx(s,{plugin:w,args:{apiToken:t,assetId:i}}),e.jsx(s,{plugin:E,dracoLoader:R}),e.jsx(s,{plugin:z}),e.jsx(s,{plugin:M}),e.jsx(T,{})]},i+t),e.jsx(P,{enableDamping:!0,maxDistance:5e3}),e.jsx(C,{preset:"sunset",background:!0,backgroundBlurriness:.9,environmentIntensity:1}),e.jsx(v,{alignment:"bottom-right",children:e.jsx(j,{})})]})}x(document.getElementById("root")).render(e.jsx(b.StrictMode,{children:e.jsx(S,{})})); diff --git a/example/bundle/assets/ionExample-DauMJ5Em.js b/example/bundle/assets/ionExample-DauMJ5Em.js new file mode 100644 index 000000000..6aa56141e --- /dev/null +++ b/example/bundle/assets/ionExample-DauMJ5Em.js @@ -0,0 +1 @@ +import{S as f,$ as h,ad as A,W as x,a as T,d as y,k as l,Q as C}from"./three.module-CA-qMkP1.js";import{G as I}from"./GLTFLoader-JNhhxs0g.js";import{D as R}from"./DRACOLoader-Dj1M3u4C.js";import{g as k}from"./lil-gui.module.min-Bc0DeA9g.js";import{E as z}from"./EnvironmentControls-7w_Q0bky.js";import{T as E}from"./TilesRenderer-5XUDbyI2.js";import{C as P}from"./CesiumIonAuthPlugin-IKQrMOf_.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./Ellipsoid-_mEueZip.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";import"./GoogleCloudAuthPlugin-B6MTG2Cr.js";let i,c,a,r,e;const v=localStorage.getItem("ionApiKey")??"put-your-api-key-here",s={ionAssetId:"40866",ionAccessToken:v,reload:u};S();w();function D(o,t){const n=new C,d=new l().crossVectors(o,t);return n.x=d.x,n.y=d.y,n.z=d.z,n.w=1+o.clone().dot(t),n.normalize(),n}function L(){e.fetchOptions.mode="cors";const o=new R;o.setDecoderPath("https://unpkg.com/three@0.153.0/examples/jsm/libs/draco/gltf/");const t=new I(e.manager);t.setDRACOLoader(o),e.manager.addHandler(/\.gltf$/,t),a.add(e.group)}function u(){e&&(a.remove(e.group),e.dispose(),e=null),localStorage.setItem("ionApiKey",s.ionAccessToken),e=new E,e.registerPlugin(new P({apiToken:s.ionAccessToken,assetId:s.ionAssetId})),e.addEventListener("load-tile-set",()=>{const o=new y;e.getBoundingSphere(o);const t=o.center.clone(),n=t.length(),d=t.normalize(),g=new l(0,1,0),p=D(d,g);e.group.quaternion.x=p.x,e.group.quaternion.y=p.y,e.group.quaternion.z=p.z,e.group.quaternion.w=p.w,e.group.position.y=-n}),L()}function S(){a=new f;const o=new h(new Uint8Array(64*64*4).fill(255),64,64);o.mapping=A,o.needsUpdate=!0,a.environment=o,r=new x({antialias:!0}),r.setClearColor(1383455),document.body.appendChild(r.domElement),r.domElement.tabIndex=1,i=new T(60,window.innerWidth/window.innerHeight,1,1e5),i.position.set(100,100,-100),i.lookAt(0,0,0),c=new z(a,i,r.domElement),c.adjustHeight=!1,c.minDistance=1,c.maxAltitude=Math.PI,u(),m(),window.addEventListener("resize",m,!1);const t=new k;t.width=300;const n=t.addFolder("Ion");n.add(s,"ionAssetId"),n.add(s,"ionAccessToken"),n.add(s,"reload"),n.open()}function m(){i.aspect=window.innerWidth/window.innerHeight,i.updateProjectionMatrix(),r.setSize(window.innerWidth,window.innerHeight),r.setPixelRatio(window.devicePixelRatio)}function w(){requestAnimationFrame(w),e&&(c.update(),e.setCamera(i),e.setResolutionFromRenderer(i,r),i.updateMatrixWorld(),e.update(),r.render(a,i))} diff --git a/example/bundle/assets/ionLunar-DehhByKz.js b/example/bundle/assets/ionLunar-DehhByKz.js new file mode 100644 index 000000000..13f9c120a --- /dev/null +++ b/example/bundle/assets/ionLunar-DehhByKz.js @@ -0,0 +1 @@ +import{W as d,S as l,a as u}from"./three.module-CA-qMkP1.js";import{T as w}from"./TilesFadePlugin-ChL3fYSz.js";import{g}from"./lil-gui.module.min-Bc0DeA9g.js";import{T as c}from"./TileCompressionPlugin-a_ThVUk-.js";import{U as f}from"./UpdateOnChangePlugin-C5cEQ6o6.js";import{G as P}from"./GlobeControls-B_ZEgOcW.js";import{T as h}from"./TilesRenderer-5XUDbyI2.js";import{L as y}from"./I3DMLoader-Bb2sAfDf.js";import{C as T}from"./CesiumIonAuthPlugin-IKQrMOf_.js";import"./EnvironmentControls-7w_Q0bky.js";import"./Ellipsoid-_mEueZip.js";import"./B3DMLoader-QE4NIaTt.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";import"./GoogleCloudAuthPlugin-B6MTG2Cr.js";let n,o,i,r,e;const C=localStorage.getItem("ionApiKey")??"put-your-api-key-here",a={apiKey:C,reload:p};R();m();function p(){e&&(o.remove(e.group),e.dispose(),e=null),localStorage.setItem("ionApiKey",a.apiKey),e=new h,e.ellipsoid.copy(y),e.registerPlugin(new T({apiToken:a.apiKey,assetId:"2684829",autoRefreshToken:!0})),e.registerPlugin(new c),e.registerPlugin(new f),e.registerPlugin(new w),e.group.rotation.x=-Math.PI/2,e.errorTarget=20,o.add(e.group),e.setCamera(i),n.setTilesRenderer(e)}function R(){r=new d({antialias:!0}),r.setClearColor(1383455),document.body.appendChild(r.domElement),o=new l,i=new u(60,window.innerWidth/window.innerHeight,1,16e7),i.position.set(2620409,0,-6249816),i.lookAt(0,0,0),n=new P(o,i,r.domElement,null),n.enableDamping=!0,p(),s(),window.addEventListener("resize",s,!1);const t=new g;t.width=300,t.add(a,"apiKey"),t.add(a,"reload")}function s(){const t=window.innerWidth/window.innerHeight;i.aspect=t,i.updateProjectionMatrix(),r.setSize(window.innerWidth,window.innerHeight),r.setPixelRatio(window.devicePixelRatio)}function m(){requestAnimationFrame(m),e&&(n.update(),e.setResolutionFromRenderer(i,r),i.updateMatrixWorld(),e.update(),r.render(o,i))} diff --git a/example/bundle/assets/landformSiteOverlay-DsYDTFG-.js b/example/bundle/assets/landformSiteOverlay-DsYDTFG-.js new file mode 100644 index 000000000..19e247987 --- /dev/null +++ b/example/bundle/assets/landformSiteOverlay-DsYDTFG-.js @@ -0,0 +1,29 @@ +import{k as v,p as N,Q as P,C as k,ae as J,af as S,S as U,W as j,a as q,G as I,a1 as Y,aa as B}from"./three.module-CA-qMkP1.js";import{g as D}from"./lil-gui.module.min-Bc0DeA9g.js";import{P as Q,T as V}from"./TilesRenderer-5XUDbyI2.js";import{E as K}from"./EnvironmentControls-7w_Q0bky.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./Ellipsoid-_mEueZip.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";const M=new v,w=new P,y=new v;function E(a,e){if(a.sceneMatrix)return;const{translation:t,rotation:r,scale:s}=a;if(M.set(t.x,t.y,t.z),w.set(r.x,r.y,r.z,r.w),y.set(s.x,s.y,s.z),a.matrix=new N().compose(M,w,y),a.sceneMatrix=new N().copy(a.matrix),a.parent_id!==""){const i=e.find(o=>o.id===a.parent_id);E(i,e),a.sceneMatrix.premultiply(i.sceneMatrix)}}class W{constructor(){this.fetchOptions={}}loadAsync(e){return fetch(e,this.fetchOptions).then(t=>t.json()).then(t=>this.parse(t))}parse(e){return e.frames.forEach(t=>E(t,e.frames)),e}}const z=a=>class extends a{constructor(...e){super(...e),this.textures=[],this.overlayColor=new k(8716287),this.displayAsOverlay=!1}onBeforeCompile(e){const t=this.textures,r=this;e.uniforms.textures={get value(){return r.textures}},e.uniforms.overlayColor={get value(){return r.overlayColor}},e.defines={DISPLAY_AS_OVERLAY:Number(this.displayAsOverlay)},t.length!==0&&(e.fragmentShader=e.fragmentShader.replace(/void main/,s=>` + uniform sampler2D textures[ ${t.length} ]; + uniform vec3 overlayColor; + ${s} + + `).replace(/#include /,s=>` + + ${s} + + vec4 col; + #pragma unroll_loop_start + for ( int i = 0; i < ${t.length}; i ++ ) { + + col = texture( textures[ i ], vMapUv ); + + #if DISPLAY_AS_OVERLAY + + diffuseColor = mix( diffuseColor, vec4( overlayColor, 1.0 ), col.r * 0.5 ); + + #else + + diffuseColor = mix( diffuseColor, col, col.a ); + + #endif + + } + #pragma unroll_loop_end + + `))}customProgramCacheKey(){return String(this.displayAsOverlay)+String(this.textures.length)+this.onBeforeCompile.toString()}};function G(){let a=!1,e=!1,t=-1;return typeof navigator<"u"&&(a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,e=navigator.userAgent.indexOf("Firefox")>-1,t=e?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),!(typeof createImageBitmap>"u"||a||e&&t<98)}class ${constructor(e,t){this.cache={},this.fetchOptions={},this.loadTextureCallback=e,this.queue=t}getTextureLoader(){const e=this.fetchOptions;let t;return G()?t=new J:t=new S,e.credentials==="include"&&e.mode==="cors"&&t.setCrossOrigin("use-credentials"),"credentials"in e&&t.setWithCredentials(e.credentials==="include"),e.headers&&t.setRequestHeader(e.headers),t}loadTexture(e){const t=this.cache;if(e in t)return t[e].promise;const r=new AbortController,s=this.queue.add(e,()=>this.loadTextureCallback(e)).then(i=>{if(r.signal.aborted)throw new Error("TextureCache: Texture load aborted.");return t[e].texture=i,i});return this.cache[e]={texture:null,abortController:r,promise:s},s}getTexture(e){const t=this.cache;return e in t?t[e].texture:null}deleteTexture(e){const t=this.cache;if(e in t){const r=t[e];r.refs--,r.refs===0&&(r.texture?r.texture.dispose():r.abortController&&(r.abortController.abort(),this.queue.remove(e)),delete this.cache[e])}}dispose(){const e=this.cache;for(const t in e){const r=e[t];r.texture?(r.texture.dispose(),r.texture.image instanceof ImageBitmap&&r.texture.image.close()):r.abortController&&r.abortController.abort()}}}class H{constructor(e={}){e={textureUpdateCallback:()=>{throw new Error('TextureOverlayPlugin: "textureUpdateCallback" required.')},waitForLoadCompletion:!0,...e},this.name="TEXTURE_OVERLAY_PLUGIN",this.caches=null,this.queue=null,this.tiles=null,this.textureUpdateCallback=e.textureUpdateCallback,this.waitForLoadCompletion=e.waitForLoadCompletion}init(e){this.tiles=e,this.caches={},this.queue=new Q,this.queue.priorityCallback=(t,r)=>e.downloadQueue.priorityCallback(t,r),this._disposeModelCallback=({tile:t})=>{const r=this.caches;for(const s in r)r[s].deleteTexture(this.getTileKey(t))},this._assignTexturesCallback=({tile:t,scene:r})=>{queueMicrotask(()=>this.textureUpdateCallback(r,t,this))},e.addEventListener("dispose-model",this._disposeModelCallback),e.addEventListener("load-model",this._assignTexturesCallback),e.addEventListener("layer-textures-change",this._assignTexturesCallback)}processTileModel(e,t){const r=this.caches,s=[];for(const i in r){const n=r[i].loadTexture(this.getTileKey(t)).catch(()=>{});s.push(n)}return Promise.all(s)}dispose(){const{caches:e,tiles:t}=this;Object.keys(e).forEach(r=>{this.unregisterLayer(r)}),t.removeEventListener("dispose-model",this._disposeModelCallback),t.removeEventListener("load-model",this._assignTexturesCallback),t.removeEventListener("layer-textures-change",this._assignTexturesCallback)}getTileKey(e){return new URL(e.content.uri,e.__basePath+"/").toString()}getTexturesForTile(e,t={}){const r=this.getTileKey(e),s=this.caches;for(const i in t)i in s||delete t[i];for(const i in s)t[i]=s[i].getTexture(r);return t}hasLayer(e){return e in this.caches}registerLayer(e,t){if(e in this.caches)throw new Error(`TextureOverlayPlugin: Texture overlay named ${e} already exists.`);const r=this.tiles,s=new $(t,this.queue);if(s.fetchOptions=r.fetchOptions,this.caches[e]=s,this.waitForLoadCompletion){const i=[];r.forEachLoadedModel((o,n)=>{const c=s.loadTexture(this.getTileKey(n)).then(()=>({scene:o,tile:n}));i.push(c)}),Promise.allSettled(i).then(o=>{e in this.caches&&o.forEach(n=>{n.status==="fulfilled"&&this.textureUpdateCallback(n.value.scene,n.value.tile,this)})})}else r.forEachLoadedModel((i,o)=>{s.loadTexture(this.getTileKey(o)).then(()=>this.textureUpdateCallback(i,o,this)).catch(()=>{})})}unregisterLayer(e){const t=this.tiles,r=this.caches;if(e in r){const s=r[e];delete r[e],t.forEachLoadedModel((i,o)=>{s.getTexture(this.getTileKey(o))&&this.textureUpdateCallback(i,o,this)}),s.dispose()}}}const X=["NLF_0477_0709296508M723RAS_N0261004NCAM00701_0A0085J02/NLF_0477_0709296508M723RAS_N0261004NCAM00701_0A0085J02_scene.json","NLF_0477_0709296508M723RAS_N0261004NCAM00708_0A00LLJ02/NLF_0477_0709296508M723RAS_N0261004NCAM00708_0A00LLJ02_scene.json","NLF_0477_0709297328M366RAS_N0261004NCAM03477_0A0195J02/NLF_0477_0709297328M366RAS_N0261004NCAM03477_0A0195J02_scene.json","NLF_0477_0709297503M102RAS_N0261004NCAM03477_0A0195J02/NLF_0477_0709297503M102RAS_N0261004NCAM03477_0A0195J02_scene.json","NLF_0477_0709297668M065RAS_N0261004NCAM03477_0A0195J02/NLF_0477_0709297668M065RAS_N0261004NCAM03477_0A0195J02_scene.json","NLF_0477_0709297838M897RAS_N0261004NCAM02477_0A0195J02/NLF_0477_0709297838M897RAS_N0261004NCAM02477_0A0195J02_scene.json","NLF_0477_0709298005M099RAS_N0261004NCAM02477_0A0195J02/NLF_0477_0709298005M099RAS_N0261004NCAM02477_0A0195J02_scene.json","NLF_0477_0709298187M680RAS_N0261004NCAM13477_0A0195J02/NLF_0477_0709298187M680RAS_N0261004NCAM13477_0A0195J02_scene.json","NLF_0477_0709298299M678RAS_N0261004NCAM13477_0A0195J02/NLF_0477_0709298299M678RAS_N0261004NCAM13477_0A0195J02_scene.json","NLF_0477_0709298393M010RAS_N0261004NCAM13477_0A0195J02/NLF_0477_0709298393M010RAS_N0261004NCAM13477_0A0195J02_scene.json"].map(a=>"https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/m20-drive-1004/tilesets/"+a),x=[];let d,f,A,u;const g={errorTarget:12,slopeDisplay:"NONE"};Z();R();function Z(){A=new U,u=new j({antialias:!0}),u.setPixelRatio(window.devicePixelRatio),u.setSize(window.innerWidth,window.innerHeight),u.setClearColor(14208704),document.body.appendChild(u.domElement),u.domElement.tabIndex=1,d=new q(60,window.innerWidth/window.innerHeight,.025,4e3),d.position.set(-20,10,20),d.lookAt(0,0,0),f=new K(A,d,u.domElement),f.adjustHeight=!1,f.minDistance=1,f.maxAltitude=Math.PI;const a=new I;a.rotation.set(Math.PI/2,0,0),A.add(a);let e=null,t=null,r=null;const s=async o=>{const n=o.replace("/tilesets/","/textures/SMG/").replace(/\.[0-9a-z]+$/i,".png");return new S().loadAsync(n).then(c=>(c.colorSpace=Y,c.flipY=!1,c))};X.forEach(async o=>{const n=await new W().loadAsync(o),c=o.split(/[\\/]/g);c.pop();const C=z(B);n.tilesets.forEach(p=>{const b=[...c,`${p.id}_tileset.json`].join("/"),l=new V(b),O=(m,L,_)=>{m.traverse(h=>{h.material&&(h.material.textures=Object.values(_.getTexturesForTile(L)),h.material.displayAsOverlay=g.slopeDisplay==="OVERLAY",h.material.needsUpdate=!0)})},F=new H({textureUpdateCallback:O});l.registerPlugin(F),l.addEventListener("load-model",({tile:m,scene:L})=>{L.traverse(_=>{if(_.material){const h=new C;h.copy(_.material),_.material=h}})}),r=r||l.lruCache,t=t||l.parseQueue,e=e||l.downloadQueue,l.lruCache=r,l.downloadQueue=e,l.parseQueue=t,l.setCamera(d),n.frames.find(m=>m.id===p.frame_id).sceneMatrix.decompose(l.group.position,l.group.quaternion,l.group.scale),a.add(l.group),x.push(l)})}),T(),window.addEventListener("resize",T,!1);const i=new D;i.add(g,"errorTarget",0,100),i.add(g,"slopeDisplay",["NONE","OVERLAY","SOLID"]).onChange(o=>{o!=="NONE"?x.forEach(n=>{const c=n.getPluginByName("TEXTURE_OVERLAY_PLUGIN");c.hasLayer("slopeLayer")||c.registerLayer("slopeLayer",s),n.forEachLoadedModel(C=>{C.traverse(p=>{p.material&&(p.material.displayAsOverlay=o==="OVERLAY",p.material.needsUpdate=!0)})})}):x.forEach(n=>{n.getPluginByName("TEXTURE_OVERLAY_PLUGIN").unregisterLayer("slopeLayer")})}),i.open()}function T(){d.aspect=window.innerWidth/window.innerHeight,d.updateProjectionMatrix(),u.setSize(window.innerWidth,window.innerHeight),u.setPixelRatio(window.devicePixelRatio)}function R(){requestAnimationFrame(R),f.update(),d.updateMatrixWorld(),x.forEach(a=>{a.errorTarget=g.errorTarget,a.setResolutionFromRenderer(d,u),a.update()}),u.render(A,d)} diff --git a/example/bundle/assets/leva.esm-DJZUUddB.js b/example/bundle/assets/leva.esm-DJZUUddB.js new file mode 100644 index 000000000..c154611d9 --- /dev/null +++ b/example/bundle/assets/leva.esm-DJZUUddB.js @@ -0,0 +1,64 @@ +import{R as g,i as fi,k as ba,r as d,c as va,j as F,l as ya,m as di,n as pi,o as wa,p as xa}from"./CameraControls-Budxqpvb.js";import{G as Ea}from"./GLTFLoader-JNhhxs0g.js";import{a as $a}from"./GLTFExtensionLoader-Bl-gplNT.js";import{a as Sa,G as Ca}from"./GLTFMeshFeaturesExtension-CLQL6scj.js";function Oa(e,t,n){return Math.max(t,Math.min(e,n))}const ee={toVector(e,t){return e===void 0&&(e=t),Array.isArray(e)?e:[e,e]},add(e,t){return[e[0]+t[0],e[1]+t[1]]},sub(e,t){return[e[0]-t[0],e[1]-t[1]]},addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function Ur(e,t,n){return t===0||Math.abs(t)===1/0?Math.pow(e,n*5):e*t*n/(t+n*e)}function Kr(e,t,n,r=.15){return r===0?Oa(e,t,n):en?+Ur(e-n,n-t,r)+n:e}function Ra(e,[t,n],[r,o]){const[[i,s],[a,c]]=e;return[Kr(t,i,s,r),Kr(n,a,c,o)]}function _a(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ta(e){var t=_a(e,"string");return typeof t=="symbol"?t:String(t)}function ae(e,t,n){return t=Ta(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function q(e){for(var t=1;t{var n,r;return t.target===e.currentTarget||((n=e.currentTarget)===null||n===void 0||(r=n.contains)===null||r===void 0?void 0:r.call(n,t.target))})}function La(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function mi(e){return mn(e)?La(e)[0]:e}function Na(e){return Ma(e).map(t=>t.identifier)}function jn(e){const t=mi(e);return mn(e)?t.identifier:t.pointerId}function qr(e){const t=mi(e);return[t.clientX,t.clientY]}function Fa(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:n,altKey:r,metaKey:o,ctrlKey:i}=e;Object.assign(t,{shiftKey:n,altKey:r,metaKey:o,ctrlKey:i})}return t}function en(e,...t){return typeof e=="function"?e(...t):e}function za(){}function Ba(...e){return e.length===0?za:e.length===1?e[0]:function(){let t;for(const n of e)t=n.apply(this,arguments)||t;return t}}function Xr(e,t){return Object.assign({},t,e||{})}const Wa=32;class Ha{constructor(t,n,r){this.ctrl=t,this.args=n,this.key=r,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(t){this.ctrl.state[this.key]=t}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:t,shared:n,ingKey:r,args:o}=this;n[r]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=o,t.axis=void 0,t.memo=void 0,t.elapsedTime=t.timeDelta=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const n=this.state,r=this.config;n._active||(this.reset(),this.computeInitial(),n._active=!0,n.target=t.target,n.currentTarget=t.currentTarget,n.lastOffset=r.from?en(r.from,n):n.offset,n.offset=n.lastOffset,n.startTime=n.timeStamp=t.timeStamp)}computeValues(t){const n=this.state;n._values=t,n.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:n,config:r,shared:o}=this;n.args=this.args;let i=0;if(t&&(n.event=t,r.preventDefault&&t.cancelable&&n.event.preventDefault(),n.type=t.type,o.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,o.locked=!!document.pointerLockElement,Object.assign(o,Fa(t)),o.down=o.pressed=o.buttons%2===1||o.touches>0,i=t.timeStamp-n.timeStamp,n.timeStamp=t.timeStamp,n.elapsedTime=n.timeStamp-n.startTime),n._active){const E=n._delta.map(Math.abs);ee.addTo(n._distance,E)}this.axisIntent&&this.axisIntent(t);const[s,a]=n._movement,[c,l]=r.threshold,{_step:u,values:f}=n;if(r.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(s)>=c&&f[0]),u[1]===!1&&(u[1]=Math.abs(a)>=l&&f[1])):(u[0]===!1&&(u[0]=Math.abs(s)>=c&&Math.sign(s)*c),u[1]===!1&&(u[1]=Math.abs(a)>=l&&Math.sign(a)*l)),n.intentional=u[0]!==!1||u[1]!==!1,!n.intentional)return;const p=[0,0];if(r.hasCustomTransform){const[E,S]=f;p[0]=u[0]!==!1?E-u[0]:0,p[1]=u[1]!==!1?S-u[1]:0}else p[0]=u[0]!==!1?s-u[0]:0,p[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!n._blocked&&this.restrictToAxis(p);const h=n.offset,m=n._active&&!n._blocked||n.active;m&&(n.first=n._active&&!n.active,n.last=!n._active&&n.active,n.active=o[this.ingKey]=n._active,t&&(n.first&&("bounds"in r&&(n._bounds=en(r.bounds,n)),this.setup&&this.setup()),n.movement=p,this.computeOffset()));const[b,y]=n.offset,[[v,w],[x,$]]=n._bounds;n.overflow=[bw?1:0,y$?1:0],n._movementBound[0]=n.overflow[0]?n._movementBound[0]===!1?n._movement[0]:n._movementBound[0]:!1,n._movementBound[1]=n.overflow[1]?n._movementBound[1]===!1?n._movement[1]:n._movementBound[1]:!1;const C=n._active?r.rubberband||[0,0]:[0,0];if(n.offset=Ra(n._bounds,n.offset,C),n.delta=ee.sub(n.offset,h),this.computeMovement(),m&&(!n.last||i>Wa)){n.delta=ee.sub(n.offset,h);const E=n.delta.map(Math.abs);ee.addTo(n.distance,E),n.direction=n.delta.map(Math.sign),n._direction=n._delta.map(Math.sign),!n.first&&i>0&&(n.velocity=[E[0]/i,E[1]/i],n.timeDelta=i)}}emit(){const t=this.state,n=this.shared,r=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!r.triggerAllEvents)return;const o=this.handler(q(q(q({},n),t),{},{[this.aliasKey]:t.values}));o!==void 0&&(t.memo=o)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Va([e,t],n){const r=Math.abs(e),o=Math.abs(t);if(r>o&&r>n)return"x";if(o>r&&o>n)return"y"}class Ua extends Ha{constructor(...t){super(...t),ae(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=ee.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=ee.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const n=this.state,r=this.config;if(!n.axis&&t){const o=typeof r.axisThreshold=="object"?r.axisThreshold[gi(t)]:r.axisThreshold;n.axis=Va(n._movement,o)}n._blocked=(r.lockDirection||!!r.axis)&&!n.axis||!!r.axis&&r.axis!==n.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0;break}}}const Ka=e=>e,Jr=.15,bi={enabled(e=!0){return e},eventOptions(e,t,n){return q(q({},n.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[Jr,Jr];case!1:return[0,0];default:return ee.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return ee.toVector(e)},transform(e,t,n){const r=e||n.shared.transform;return this.hasCustomTransform=!!r,r||Ka},threshold(e){return ee.toVector(e,0)}},Ga=0,Dt=q(q({},bi),{},{axis(e,t,{axis:n}){if(this.lockDirection=n==="lock",!this.lockDirection)return n},axisThreshold(e=Ga){return e},bounds(e={}){if(typeof e=="function")return i=>Dt.bounds(e(i));if("current"in e)return()=>e.current;if(typeof HTMLElement=="function"&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:n=1/0,top:r=-1/0,bottom:o=1/0}=e;return[[t,n],[r,o]]}}),Zr={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};class Ya extends Ua{constructor(...t){super(...t),ae(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const n=t._bounds.getBoundingClientRect(),r=t.currentTarget.getBoundingClientRect(),o={left:n.left-r.left+t.offset[0],right:n.right-r.right+t.offset[0],top:n.top-r.top+t.offset[1],bottom:n.bottom-r.bottom+t.offset[1]};t._bounds=Dt.bounds(o)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._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(t){const n=this.config,r=this.state;if(t.buttons!=null&&(Array.isArray(n.pointerButtons)?!n.pointerButtons.includes(t.buttons):n.pointerButtons!==-1&&n.pointerButtons!==t.buttons))return;const o=this.ctrl.setEventIds(t);n.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(o&&o.size>1&&r._pointerActive)&&(this.start(t),this.setupPointer(t),r._pointerId=jn(t),r._pointerActive=!0,this.computeValues(qr(t)),this.computeInitial(),n.preventScrollAxis&&gi(t)!=="mouse"?(r._active=!1,this.setupScrollPrevention(t)):n.delay>0?(this.setupDelayTrigger(t),n.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const n=this.state;n._active=!0,n._preventScroll=!0,n._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const n=this.state,r=this.config;if(!n._pointerActive)return;const o=jn(t);if(n._pointerId!==void 0&&o!==n._pointerId)return;const i=qr(t);if(document.pointerLockElement===t.target?n._delta=[t.movementX,t.movementY]:(n._delta=ee.sub(i,n._values),this.computeValues(i)),ee.addTo(n._movement,n._delta),this.compute(t),n._delayed&&n.intentional){this.timeoutStore.remove("dragDelay"),n.active=!1,this.startPointerDrag(t);return}if(r.preventScrollAxis&&!n._preventScroll)if(n.axis)if(n.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){n._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(t);return}else return;this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch{}const n=this.state,r=this.config;if(!n._active||!n._pointerActive)return;const o=jn(t);if(n._pointerId!==void 0&&o!==n._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[i,s]=n._distance;if(n.tap=i<=r.tapsThreshold&&s<=r.tapsThreshold,n.tap&&r.filterTaps)n._force=!0;else{const[a,c]=n._delta,[l,u]=n._movement,[f,p]=r.swipe.velocity,[h,m]=r.swipe.distance,b=r.swipe.duration;if(n.elapsedTimef&&Math.abs(l)>h&&(n.swipe[0]=Math.sign(a)),v>p&&Math.abs(u)>m&&(n.swipe[1]=Math.sign(c))}}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const n=this.config,r=n.device;n.pointerLock&&t.currentTarget.requestPointerLock(),n.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){this.state._preventScroll=!1,qa(t);const n=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",n),this.eventStore.add(this.sharedConfig.window,"touch","cancel",n),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(t)},this.config.delay)}keyDown(t){const n=Zr[t.key];if(n){const r=this.state,o=t.shiftKey?10:t.altKey?.1:1;this.start(t),r._delta=n(this.config.keyboardDisplacement,o),r._keyboardActive=!0,ee.addTo(r._movement,r._delta),this.compute(t),this.emit()}}keyUp(t){t.key in Zr&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const n=this.config.device;t(n,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(n,"change",this.pointerMove.bind(this)),t(n,"end",this.pointerUp.bind(this)),t(n,"cancel",this.pointerUp.bind(this)),t("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this))),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function qa(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const It=typeof window<"u"&&window.document&&window.document.createElement;function vi(){return It&&"ontouchstart"in window}function Xa(){return vi()||It&&window.navigator.maxTouchPoints>1}function Ja(){return It&&"onpointerdown"in window}function Za(){return It&&"exitPointerLock"in window.document}function Qa(){try{return"constructor"in GestureEvent}catch{return!1}}const de={isBrowser:It,gesture:Qa(),touch:vi(),touchscreen:Xa(),pointer:Ja(),pointerLock:Za()},ec=250,tc=180,nc=.5,rc=50,oc=250,ic=10,Qr={mouse:0,touch:0,pen:8},sc=q(q({},Dt),{},{device(e,t,{pointer:{touch:n=!1,lock:r=!1,mouse:o=!1}={}}){return this.pointerLock=r&&de.pointerLock,de.touch&&n?"touch":this.pointerLock?"mouse":de.pointer&&!o?"pointer":de.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:n}){if(this.preventScrollDelay=typeof n=="number"?n:n||n===void 0&&e?ec:void 0,!(!de.touchscreen||n===!1))return e||(n!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:n=!0,buttons:r=1,keys:o=!0}={}}){return this.pointerButtons=r,this.keys=o,!this.pointerLock&&this.device==="pointer"&&n},threshold(e,t,{filterTaps:n=!1,tapsThreshold:r=3,axis:o=void 0}){const i=ee.toVector(e,n?r:o?1:0);return this.filterTaps=n,this.tapsThreshold=r,i},swipe({velocity:e=nc,distance:t=rc,duration:n=oc}={}){return{velocity:this.transform(ee.toVector(e)),distance:this.transform(ee.toVector(t)),duration:n}},delay(e=0){switch(e){case!0:return tc;case!1:return 0;default:return e}},axisThreshold(e){return e?q(q({},Qr),e):Qr},keyboardDisplacement(e=ic){return e}});q(q({},bi),{},{device(e,t,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!de.touch&&de.gesture)return"gesture";if(de.touch&&r)return"touch";if(de.touchscreen){if(de.pointer)return"pointer";if(de.touch)return"touch"}},bounds(e,t,{scaleBounds:n={},angleBounds:r={}}){const o=s=>{const a=Xr(en(n,s),{min:-1/0,max:1/0});return[a.min,a.max]},i=s=>{const a=Xr(en(r,s),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof n!="function"&&typeof r!="function"?[o(),i()]:s=>[o(s),i(s)]},threshold(e,t,n){return this.lockDirection=n.axis==="lock",ee.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});q(q({},Dt),{},{mouseOnly:(e=!0)=>e});q(q({},Dt),{},{mouseOnly:(e=!0)=>e});const yi=new Map,Gn=new Map;function ac(e){yi.set(e.key,e.engine),Gn.set(e.key,e.resolver)}const cc={key:"drag",engine:Ya,resolver:sc};function lc(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function uc(e,t){if(e==null)return{};var n=lc(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}const fc={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=de.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},dc=["target","eventOptions","window","enabled","transform"];function Zt(e={},t){const n={};for(const[r,o]of Object.entries(t))switch(typeof o){case"function":n[r]=o.call(n,e[r],r,e);break;case"object":n[r]=Zt(e[r],o);break;case"boolean":o&&(n[r]=e[r]);break}return n}function pc(e,t,n={}){const r=e,{target:o,eventOptions:i,window:s,enabled:a,transform:c}=r,l=uc(r,dc);if(n.shared=Zt({target:o,eventOptions:i,window:s,enabled:a,transform:c},fc),t){const u=Gn.get(t);n[t]=Zt(q({shared:n.shared},l),u)}else for(const u in l){const f=Gn.get(u);f&&(n[u]=Zt(q({shared:n.shared},l[u]),f))}return n}class wi{constructor(t,n){ae(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=n}add(t,n,r,o,i){const s=this._listeners,a=ja(n,r),c=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},l=q(q({},c),i);t.addEventListener(a,o,l);const u=()=>{t.removeEventListener(a,o,l),s.delete(u)};return s.add(u),u}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class hc{constructor(){ae(this,"_timeouts",new Map)}add(t,n,r=140,...o){this.remove(t),this._timeouts.set(t,window.setTimeout(n,r,...o))}remove(t){const n=this._timeouts.get(t);n&&window.clearTimeout(n)}clean(){this._timeouts.forEach(t=>void window.clearTimeout(t)),this._timeouts.clear()}}class gc{constructor(t){ae(this,"gestures",new Set),ae(this,"_targetEventStore",new wi(this)),ae(this,"gestureEventStores",{}),ae(this,"gestureTimeoutStores",{}),ae(this,"handlers",{}),ae(this,"config",{}),ae(this,"pointerIds",new Set),ae(this,"touchIds",new Set),ae(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),mc(this,t)}setEventIds(t){if(mn(t))return this.touchIds=new Set(Na(t)),this.touchIds;if("pointerId"in t)return t.type==="pointerup"||t.type==="pointercancel"?this.pointerIds.delete(t.pointerId):t.type==="pointerdown"&&this.pointerIds.add(t.pointerId),this.pointerIds}applyHandlers(t,n){this.handlers=t,this.nativeHandlers=n}applyConfig(t,n){this.config=pc(t,n,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const n=this.config.shared,r={};let o;if(!(n.target&&(o=n.target(),!o))){if(n.enabled){for(const s of this.gestures){const a=this.config[s],c=eo(r,a.eventOptions,!!o);if(a.enabled){const l=yi.get(s);new l(this,t,s).bind(c)}}const i=eo(r,n.eventOptions,!!o);for(const s in this.nativeHandlers)i(s,"",a=>this.nativeHandlers[s](q(q({},this.state.shared),{},{event:a,args:t})),void 0,!0)}for(const i in r)r[i]=Ba(...r[i]);if(!o)return r;for(const i in r){const{device:s,capture:a,passive:c}=Ia(i);this._targetEventStore.add(o,s,"",r[i],{capture:a,passive:c})}}}}function tt(e,t){e.gestures.add(t),e.gestureEventStores[t]=new wi(e,t),e.gestureTimeoutStores[t]=new hc}function mc(e,t){t.drag&&tt(e,"drag"),t.wheel&&tt(e,"wheel"),t.scroll&&tt(e,"scroll"),t.move&&tt(e,"move"),t.pinch&&tt(e,"pinch"),t.hover&&tt(e,"hover")}const eo=(e,t,n)=>(r,o,i,s={},a=!1)=>{var c,l;const u=(c=s.capture)!==null&&c!==void 0?c:t.capture,f=(l=s.passive)!==null&&l!==void 0?l:t.passive;let p=a?r:Aa(r,o,u);n&&f&&(p+="Passive"),e[p]=e[p]||[],e[p].push(i)};function bc(e,t={},n,r){const o=g.useMemo(()=>new gc(e),[]);if(o.applyHandlers(e,r),o.applyConfig(t,n),g.useEffect(o.effect.bind(o)),g.useEffect(()=>o.clean.bind(o),[]),t.target===void 0)return o.bind.bind(o)}function vc(e,t){return ac(cc),bc({drag:e},t||{},"drag")}const yc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=(s,a,c)=>{let l=s;if(a){const u=(c==null?void 0:c.equalityFn)||Object.is;let f=s(r.getState());l=p=>{const h=s(p);if(!u(f,h)){const m=f;a(f=h,m)}},c!=null&&c.fireImmediately&&a(f,f)}return o(l)},e(t,n,r)};function bn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r[s.gl]),r=d.useMemo(()=>document.createElement("div"),[]),o=d.useMemo(()=>va(r),[r]),i=d.useMemo(()=>{const s=new ResizeObserver(([{contentRect:a}])=>{r.style.top=`${a.top}px`,r.style.left=`${a.left}px`,r.style.width=`${a.width}px`,r.style.height=`${a.height}px`});return s.observe(n.domElement),s},[n,r]);d.useEffect(()=>(r.style.pointerEvents="none",r.style.position="absolute",document.body.appendChild(r),()=>{r.remove(),i.disconnect()}),[i,r]),o.render(F.jsx(d.StrictMode,{children:F.jsx("div",{...t,children:e})}))}function $m({children:e,style:t,...n}){const r=d.useContext(ya),[o,i]=d.useState([]);d.useEffect(()=>{if(!r)return;let l=!1;const u=()=>{l||(l=!0,queueMicrotask(()=>{i(r.getAttributions()),l=!1}))};return r.addEventListener("tile-visibility-change",u),r.addEventListener("load-tile-set",u),()=>{r.removeEventListener("tile-visibility-change",u),r.removeEventListener("load-tile-set",u)}},[r]);const s=[];o.forEach((l,u)=>{let f=null;l.type==="string"?f=F.jsx("div",{children:l.value},u):l.type==="html"?f=F.jsx("div",{dangerouslySetInnerHTML:{__html:l.value},style:{pointerEvents:"all"}},u):l.type==="image"&&(f=F.jsx("div",{children:F.jsx("img",{src:l.value})},u)),f&&s.push(f)});const a=d.useMemo(()=>"class_"+window.crypto.randomUUID(),[]),c=d.useMemo(()=>` + #${a} a { + color: white; + } + + #${a} img { + max-width: 125px; + display: block; + margin: 5px 0; + } + `,[a]);return F.jsxs(Cc,{id:a,style:{position:"absolute",bottom:0,left:0,padding:"10px",color:"rgba( 255, 255, 255, 0.75 )",fontSize:"10px",...t},...n,children:[F.jsx("style",{children:c}),e,s]})}class Sm{constructor(t){t={metadata:!0,rtc:!0,plugins:[],dracoLoader:null,ktxLoader:null,autoDispose:!0,...t},this.tiles=null,this.metadata=t.metadata,this.rtc=t.rtc,this.plugins=t.plugins,this.dracoLoader=t.dracoLoader,this.ktxLoader=t.ktxLoader,this._gltfRegex=/\.(gltf|glb)$/g,this._dracoRegex=/\.drc$/g,this._loader=null}init(t){const n=new Ea(t.manager);this.dracoLoader&&(n.setDRACOLoader(this.dracoLoader),t.manager.addHandler(this._dracoRegex,this.dracoLoader)),this.ktxLoader&&n.setKTX2Loader(this.ktxLoader),this.rtc&&n.register(()=>new $a),this.metadata&&(n.register(()=>new Sa),n.register(()=>new Ca)),this.plugins.forEach(r=>n.register(r)),t.manager.addHandler(this._gltfRegex,n),this.tiles=t,this._loader=n}dispose(){this.tiles.manager.removeHandler(this._gltfRegex),this.tiles.manager.removeHandler(this._dracoRegex),this.autoDispose&&(this.ktxLoader.dispose(),this.dracoLoader.dispose())}}function Oc(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Si(...e){return t=>e.forEach(n=>Oc(n,t))}function Ye(...e){return d.useCallback(Si(...e),e)}var Ci=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),i=o.find(Rc);if(i){const s=i.props.children,a=o.map(c=>c===i?d.Children.count(s)>1?d.Children.only(null):d.isValidElement(s)?s.props.children:null:c);return F.jsx(Yn,{...r,ref:t,children:d.isValidElement(s)?d.cloneElement(s,void 0,a):null})}return F.jsx(Yn,{...r,ref:t,children:n})});Ci.displayName="Slot";var Yn=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Tc(n);return d.cloneElement(n,{..._c(r,n.props),ref:t?Si(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Yn.displayName="SlotClone";var Oi=({children:e})=>F.jsx(F.Fragment,{children:e});function Rc(e){return d.isValidElement(e)&&e.type===Oi}function _c(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Tc(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Pc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ze=Pc.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Ci:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),F.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function kc(e,t){e&&di.flushSync(()=>e.dispatchEvent(t))}var Ue=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{},Ac="Portal",Ri=d.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=d.useState(!1);Ue(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?pi.createPortal(F.jsx(ze.div,{...r,ref:t}),s):null});Ri.displayName=Ac;var Dc=Ri,to=Object.prototype.hasOwnProperty;function Tt(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Tt(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(to.call(e,n)&&++r&&!to.call(t,n)||!(n in t)||!Tt(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var vn=function(t,n,r,o){this.name=t,this.fn=n,this.args=r,this.modifiers=o};vn.prototype._test=function(t){var n=this.fn;try{it(this.modifiers.slice(),n,this)(t)}catch{n=function(){return!1}}try{return it(this.modifiers.slice(),n,this)(t)}catch{return!1}};vn.prototype._check=function(t){try{it(this.modifiers.slice(),this.fn,this)(t)}catch{if(it(this.modifiers.slice(),function(r){return r},this)(!1))return}if(!it(this.modifiers.slice(),this.fn,this)(t))throw null};vn.prototype._testAsync=function(t){var n=this;return new Promise(function(r,o){Ti(n.modifiers.slice(),n.fn,n)(t).then(function(i){i?r(t):o(null)}).catch(function(i){return o(i)})})};function _i(e,t){return t===void 0&&(t="simple"),typeof e=="object"?e[t]:e}function it(e,t,n){if(e.length){var r=e.shift(),o=it(e,t,n);return r.perform(o,n)}else return _i(t)}function Ti(e,t,n){if(e.length){var r=e.shift(),o=Ti(e,t,n);return r.performAsync(o,n)}else return function(i){return Promise.resolve(_i(t,"async")(i))}}var Ic=function(t,n,r){this.name=t,this.perform=n,this.performAsync=r},wr=function(e){function t(n,r,o,i){for(var s=[],a=arguments.length-4;a-- >0;)s[a]=arguments[a+4];e.call(this,s),e.captureStackTrace&&e.captureStackTrace(this,t),this.rule=n,this.value=r,this.cause=o,this.target=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Error),Ee=function(t,n){t===void 0&&(t=[]),n===void 0&&(n=[]),this.chain=t,this.nextRuleModifiers=n};Ee.prototype._applyRule=function(t,n){var r=this;return function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return r.chain.push(new vn(n,t.apply(r,o),o,r.nextRuleModifiers)),r.nextRuleModifiers=[],r}};Ee.prototype._applyModifier=function(t,n){return this.nextRuleModifiers.push(new Ic(n,t.simple,t.async)),this};Ee.prototype._clone=function(){return new Ee(this.chain.slice(),this.nextRuleModifiers.slice())};Ee.prototype.test=function(t){return this.chain.every(function(n){return n._test(t)})};Ee.prototype.testAll=function(t){var n=[];return this.chain.forEach(function(r){try{r._check(t)}catch(o){n.push(new wr(r,t,o))}}),n};Ee.prototype.check=function(t){this.chain.forEach(function(n){try{n._check(t)}catch(r){throw new wr(n,t,r)}})};Ee.prototype.testAsync=function(t){var n=this;return new Promise(function(r,o){Pi(t,n.chain.slice(),r,o)})};function Pi(e,t,n,r){if(t.length){var o=t.shift();o._testAsync(e).then(function(){Pi(e,t,n,r)},function(i){r(new wr(o,e,i))})}else n(e)}var no=function(e,t){return t&&typeof e=="string"&&e.trim().length===0?!0:e==null};function jc(e,t){return t===void 0&&(t=!1),{simple:function(n){return no(n,t)||e.check(n)===void 0},async:function(n){return no(n,t)||e.testAsync(n)}}}function ce(){return typeof Proxy<"u"?ki(new Ee):qn(new Ee)}var Pt={};ce.extend=function(e){Object.assign(Pt,e)};ce.clearCustomRules=function(){Pt={}};function ki(e){return new Proxy(e,{get:function(n,r){if(r in n)return n[r];var o=ki(e._clone());if(r in tn)return o._applyModifier(tn[r],r);if(r in Pt)return o._applyRule(Pt[r],r);if(r in Xn)return o._applyRule(Xn[r],r)}})}function qn(e){var t=function(o,i){return Object.keys(o).forEach(function(s){i[s]=function(){for(var a=[],c=arguments.length;c--;)a[c]=arguments[c];var l=qn(i._clone()),u=l._applyRule(o[s],s).apply(void 0,a);return u}}),i},n=t(Xn,e),r=t(Pt,n);return Object.keys(tn).forEach(function(o){Object.defineProperty(r,o,{get:function(){var i=qn(r._clone());return i._applyModifier(tn[o],o)}})}),r}var tn={not:{simple:function(e){return function(t){return!e(t)}},async:function(e){return function(t){return Promise.resolve(e(t)).then(function(n){return!n}).catch(function(){return!0})}}},some:{simple:function(e){return function(t){return Ut(t).some(function(n){try{return e(n)}catch{return!1}})}},async:function(e){return function(t){return Promise.all(Ut(t).map(function(n){try{return e(n).catch(function(){return!1})}catch{return!1}})).then(function(n){return n.some(Boolean)})}}},every:{simple:function(e){return function(t){return t!==!1&&Ut(t).every(e)}},async:function(e){return function(t){return Promise.all(Ut(t).map(e)).then(function(n){return n.every(Boolean)})}}},strict:{simple:function(e,t){return function(n){return ro(t)&&n&&typeof n=="object"?Object.keys(t.args[0]).length===Object.keys(n).length&&e(n):e(n)}},async:function(e,t){return function(n){return Promise.resolve(e(n)).then(function(r){return ro(t)&&n&&typeof n=="object"?Object.keys(t.args[0]).length===Object.keys(n).length&&r:r}).catch(function(){return!1})}}}};function ro(e){return e&&e.name==="schema"&&e.args.length>0&&typeof e.args[0]=="object"}function Ut(e){return typeof e=="string"?e.split(""):e}var Xn={equal:function(e){return function(t){return t==e}},exact:function(e){return function(t){return t===e}},number:function(e){return e===void 0&&(e=!0),function(t){return typeof t=="number"&&(e||isFinite(t))}},integer:function(){return function(e){var t=Number.isInteger||Mc;return t(e)}},numeric:function(){return function(e){return!isNaN(parseFloat(e))&&isFinite(e)}},string:function(){return nt("string")},boolean:function(){return nt("boolean")},undefined:function(){return nt("undefined")},null:function(){return nt("null")},array:function(){return nt("array")},object:function(){return nt("object")},instanceOf:function(e){return function(t){return t instanceof e}},pattern:function(e){return function(t){return e.test(t)}},lowercase:function(){return function(e){return typeof e=="boolean"||e===e.toLowerCase()&&e.trim()!==""}},uppercase:function(){return function(e){return e===e.toUpperCase()&&e.trim()!==""}},vowel:function(){return function(e){return/^[aeiou]+$/i.test(e)}},consonant:function(){return function(e){return/^(?=[^aeiou])([a-z]+)$/i.test(e)}},first:function(e){return function(t){return t[0]==e}},last:function(e){return function(t){return t[t.length-1]==e}},empty:function(){return function(e){return e.length===0}},length:function(e,t){return function(n){return n.length>=e&&n.length<=(t||e)}},minLength:function(e){return function(t){return t.length>=e}},maxLength:function(e){return function(t){return t.length<=e}},negative:function(){return function(e){return e<0}},positive:function(){return function(e){return e>=0}},between:function(e,t){return function(n){return n>=e&&n<=t}},range:function(e,t){return function(n){return n>=e&&n<=t}},lessThan:function(e){return function(t){return te}},greaterThanOrEqual:function(e){return function(t){return t>=e}},even:function(){return function(e){return e%2===0}},odd:function(){return function(e){return e%2!==0}},includes:function(e){return function(t){return~t.indexOf(e)}},schema:function(e){return Lc(e)},passesAnyOf:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return function(n){return e.some(function(r){return r.test(n)})}},optional:jc};function nt(e){return function(t){return Array.isArray(t)&&e==="array"||t===null&&e==="null"||typeof t===e}}function Mc(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e}function Lc(e){return{simple:function(t){var n=[];if(Object.keys(e).forEach(function(r){var o=e[r];try{o.check((t||{})[r])}catch(i){i.target=r,n.push(i)}}),n.length>0)throw n;return!0},async:function(t){var n=[],r=Object.keys(e).map(function(o){var i=e[o];return i.testAsync((t||{})[o]).catch(function(s){s.target=o,n.push(s)})});return Promise.all(r).then(function(){if(n.length>0)throw n;return!0})}}}var V="colors",ne="sizes",_="space",Nc={gap:_,gridGap:_,columnGap:_,gridColumnGap:_,rowGap:_,gridRowGap:_,inset:_,insetBlock:_,insetBlockEnd:_,insetBlockStart:_,insetInline:_,insetInlineEnd:_,insetInlineStart:_,margin:_,marginTop:_,marginRight:_,marginBottom:_,marginLeft:_,marginBlock:_,marginBlockEnd:_,marginBlockStart:_,marginInline:_,marginInlineEnd:_,marginInlineStart:_,padding:_,paddingTop:_,paddingRight:_,paddingBottom:_,paddingLeft:_,paddingBlock:_,paddingBlockEnd:_,paddingBlockStart:_,paddingInline:_,paddingInlineEnd:_,paddingInlineStart:_,top:_,right:_,bottom:_,left:_,scrollMargin:_,scrollMarginTop:_,scrollMarginRight:_,scrollMarginBottom:_,scrollMarginLeft:_,scrollMarginX:_,scrollMarginY:_,scrollMarginBlock:_,scrollMarginBlockEnd:_,scrollMarginBlockStart:_,scrollMarginInline:_,scrollMarginInlineEnd:_,scrollMarginInlineStart:_,scrollPadding:_,scrollPaddingTop:_,scrollPaddingRight:_,scrollPaddingBottom:_,scrollPaddingLeft:_,scrollPaddingX:_,scrollPaddingY:_,scrollPaddingBlock:_,scrollPaddingBlockEnd:_,scrollPaddingBlockStart:_,scrollPaddingInline:_,scrollPaddingInlineEnd:_,scrollPaddingInlineStart:_,fontSize:"fontSizes",background:V,backgroundColor:V,backgroundImage:V,borderImage:V,border:V,borderBlock:V,borderBlockEnd:V,borderBlockStart:V,borderBottom:V,borderBottomColor:V,borderColor:V,borderInline:V,borderInlineEnd:V,borderInlineStart:V,borderLeft:V,borderLeftColor:V,borderRight:V,borderRightColor:V,borderTop:V,borderTopColor:V,caretColor:V,color:V,columnRuleColor:V,fill:V,outline:V,outlineColor:V,stroke:V,textDecorationColor:V,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:ne,minBlockSize:ne,maxBlockSize:ne,inlineSize:ne,minInlineSize:ne,maxInlineSize:ne,width:ne,minWidth:ne,maxWidth:ne,height:ne,minHeight:ne,maxHeight:ne,flexBasis:ne,gridTemplateColumns:ne,gridTemplateRows:ne,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},Fc=(e,t)=>typeof t=="function"?{"()":Function.prototype.toString.call(t)}:t,ut=()=>{const e=Object.create(null);return(t,n,...r)=>{const o=(i=>JSON.stringify(i,Fc))(t);return o in e?e[o]:e[o]=n(t,...r)}},He=Symbol.for("sxs.internal"),xr=(e,t)=>Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)),oo=e=>{for(const t in e)return!0;return!1},{hasOwnProperty:zc}=Object.prototype,Jn=e=>e.includes("-")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),Bc=/\s+(?![^()]*\))/,rt=e=>t=>e(...typeof t=="string"?String(t).split(Bc):[t]),io={appearance:e=>({WebkitAppearance:e,appearance:e}),backfaceVisibility:e=>({WebkitBackfaceVisibility:e,backfaceVisibility:e}),backdropFilter:e=>({WebkitBackdropFilter:e,backdropFilter:e}),backgroundClip:e=>({WebkitBackgroundClip:e,backgroundClip:e}),boxDecorationBreak:e=>({WebkitBoxDecorationBreak:e,boxDecorationBreak:e}),clipPath:e=>({WebkitClipPath:e,clipPath:e}),content:e=>({content:e.includes('"')||e.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(e)?e:`"${e}"`}),hyphens:e=>({WebkitHyphens:e,hyphens:e}),maskImage:e=>({WebkitMaskImage:e,maskImage:e}),maskSize:e=>({WebkitMaskSize:e,maskSize:e}),tabSize:e=>({MozTabSize:e,tabSize:e}),textSizeAdjust:e=>({WebkitTextSizeAdjust:e,textSizeAdjust:e}),userSelect:e=>({WebkitUserSelect:e,userSelect:e}),marginBlock:rt((e,t)=>({marginBlockStart:e,marginBlockEnd:t||e})),marginInline:rt((e,t)=>({marginInlineStart:e,marginInlineEnd:t||e})),maxSize:rt((e,t)=>({maxBlockSize:e,maxInlineSize:t||e})),minSize:rt((e,t)=>({minBlockSize:e,minInlineSize:t||e})),paddingBlock:rt((e,t)=>({paddingBlockStart:e,paddingBlockEnd:t||e})),paddingInline:rt((e,t)=>({paddingInlineStart:e,paddingInlineEnd:t||e}))},Mn=/([\d.]+)([^]*)/,Wc=(e,t)=>e.length?e.reduce((n,r)=>(n.push(...t.map(o=>o.includes("&")?o.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(o)?`:is(${r})`:r):r+" "+o)),n),[]):t,Hc=(e,t)=>e in Vc&&typeof t=="string"?t.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,(n,r,o,i)=>r+(o==="stretch"?`-moz-available${i};${Jn(e)}:${r}-webkit-fill-available`:`-moz-fit-content${i};${Jn(e)}:${r}fit-content`)+i):String(t),Vc={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},Pe=e=>e?e+"-":"",Ai=(e,t,n)=>e.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,(r,o,i,s,a)=>s=="$"==!!i?r:(o||s=="--"?"calc(":"")+"var(--"+(s==="$"?Pe(t)+(a.includes("$")?"":Pe(n))+a.replace(/\$/g,"-"):a)+")"+(o||s=="--"?"*"+(o||"")+(i||"1")+")":"")),Uc=/\s*,\s*(?![^()]*\))/,Kc=Object.prototype.toString,ot=(e,t,n,r,o)=>{let i,s,a;const c=(l,u,f)=>{let p,h;const m=b=>{for(p in b){const w=p.charCodeAt(0)===64,x=w&&Array.isArray(b[p])?b[p]:[b[p]];for(h of x){const $=/[A-Z]/.test(v=p)?v:v.replace(/-[^]/g,E=>E[1].toUpperCase()),C=typeof h=="object"&&h&&h.toString===Kc&&(!r.utils[$]||!u.length);if($ in r.utils&&!C){const E=r.utils[$];if(E!==s){s=E,m(E(h)),s=null;continue}}else if($ in io){const E=io[$];if(E!==a){a=E,m(E(h)),a=null;continue}}if(w&&(y=p.slice(1)in r.media?"@media "+r.media[p.slice(1)]:p,p=y.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,(E,S,k,z,R,T)=>{const P=Mn.test(S),I=.0625*(P?-1:1),[j,L]=P?[z,S]:[S,z];return"("+(k[0]==="="?"":k[0]===">"===P?"max-":"min-")+j+":"+(k[0]!=="="&&k.length===1?L.replace(Mn,(B,W,M)=>Number(W)+I*(k===">"?1:-1)+M):L)+(R?") and ("+(R[0]===">"?"min-":"max-")+j+":"+(R.length===1?T.replace(Mn,(B,W,M)=>Number(W)+I*(R===">"?-1:1)+M):T):"")+")"})),C){const E=w?f.concat(p):[...f],S=w?[...u]:Wc(u,p.split(Uc));i!==void 0&&o(so(...i)),i=void 0,c(h,S,E)}else i===void 0&&(i=[[],u,f]),p=w||p.charCodeAt(0)!==36?p:`--${Pe(r.prefix)}${p.slice(1).replace(/\$/g,"-")}`,h=C?h:typeof h=="number"?h&&$ in Gc?String(h)+"px":String(h):Ai(Hc($,h??""),r.prefix,r.themeMap[$]),i[0].push(`${w?`${p} `:`${Jn(p)}:`}${h}`)}}var y,v};m(l),i!==void 0&&o(so(...i)),i=void 0};c(e,t,n)},so=(e,t,n)=>`${n.map(r=>`${r}{`).join("")}${t.length?`${t.join(",")}{`:""}${e.join(";")}${t.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,Gc={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},ao=e=>String.fromCharCode(e+(e>25?39:97)),Ve=e=>(t=>{let n,r="";for(n=Math.abs(t);n>52;n=n/52|0)r=ao(n%52)+r;return ao(n%52)+r})(((t,n)=>{let r=n.length;for(;r;)t=33*t^n.charCodeAt(--r);return t})(5381,JSON.stringify(e))>>>0),Ct=["themed","global","styled","onevar","resonevar","allvar","inline"],Yc=e=>{if(e.href&&!e.href.startsWith(location.origin))return!1;try{return!!e.cssRules}catch{return!1}},qc=e=>{let t;const n=()=>{const{cssRules:o}=t.sheet;return[].map.call(o,(i,s)=>{const{cssText:a}=i;let c="";if(a.startsWith("--sxs"))return"";if(o[s-1]&&(c=o[s-1].cssText).startsWith("--sxs")){if(!i.cssRules.length)return"";for(const l in t.rules)if(t.rules[l].group===i)return`--sxs{--sxs:${[...t.rules[l].cache].join(" ")}}${a}`;return i.cssRules.length?`${c}${a}`:""}return a}).join("")},r=()=>{if(t){const{rules:a,sheet:c}=t;if(!c.deleteRule){for(;Object(Object(c.cssRules)[0]).type===3;)c.cssRules.splice(0,1);c.cssRules=[]}for(const l in a)delete a[l]}const o=Object(e).styleSheets||[];for(const a of o)if(Yc(a)){for(let c=0,l=a.cssRules;l[c];++c){const u=Object(l[c]);if(u.type!==1)continue;const f=Object(l[c+1]);if(f.type!==4)continue;++c;const{cssText:p}=u;if(!p.startsWith("--sxs"))continue;const h=p.slice(14,-3).trim().split(/\s+/),m=Ct[h[0]];m&&(t||(t={sheet:a,reset:r,rules:{},toString:n}),t.rules[m]={group:f,index:c,cache:new Set(h)})}if(t)break}if(!t){const a=(c,l)=>({type:l,cssRules:[],insertRule(u,f){this.cssRules.splice(f,0,a(u,{import:3,undefined:1}[(u.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return c==="@media{}"?`@media{${[].map.call(this.cssRules,u=>u.cssText).join("")}}`:c}});t={sheet:e?(e.head||e).appendChild(document.createElement("style")).sheet:a("","text/css"),rules:{},reset:r,toString:n}}const{sheet:i,rules:s}=t;for(let a=Ct.length-1;a>=0;--a){const c=Ct[a];if(!s[c]){const l=Ct[a+1],u=s[l]?s[l].index:i.cssRules.length;i.insertRule("@media{}",u),i.insertRule(`--sxs{--sxs:${a}}`,u),s[c]={group:i.cssRules[u+1],index:u,cache:new Set([a])}}Xc(s[c])}};return r(),t},Xc=e=>{const t=e.group;let n=t.cssRules.length;e.apply=r=>{try{t.insertRule(r,n),++n}catch{}}},Et=Symbol(),Jc=ut(),co=(e,t)=>Jc(e,()=>(...n)=>{let r={type:null,composers:new Set};for(const o of n)if(o!=null)if(o[He]){r.type==null&&(r.type=o[He].type);for(const i of o[He].composers)r.composers.add(i)}else o.constructor!==Object||o.$$typeof?r.type==null&&(r.type=o):r.composers.add(Zc(o,e));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),Qc(e,r,t)}),Zc=({variants:e,compoundVariants:t,defaultVariants:n,...r},o)=>{const i=`${Pe(o.prefix)}c-${Ve(r)}`,s=[],a=[],c=Object.create(null),l=[];for(const p in n)c[p]=String(n[p]);if(typeof e=="object"&&e)for(const p in e){u=c,f=p,zc.call(u,f)||(c[p]="undefined");const h=e[p];for(const m in h){const b={[p]:String(m)};String(m)==="undefined"&&l.push(p);const y=h[m],v=[b,y,!oo(y)];s.push(v)}}var u,f;if(typeof t=="object"&&t)for(const p of t){let{css:h,...m}=p;h=typeof h=="object"&&h||{};for(const y in m)m[y]=String(m[y]);const b=[m,h,!oo(h)];a.push(b)}return[i,r,s,a,c,l]},Qc=(e,t,n)=>{const[r,o,i,s]=el(t.composers),a=typeof t.type=="function"||t.type.$$typeof?(f=>{function p(){for(let h=0;hp.rules[h]={apply:m=>p[Et].push([h,m])}),p})(n):null,c=(a||n).rules,l=`.${r}${o.length>1?`:where(.${o.slice(1).join(".")})`:""}`,u=f=>{f=typeof f=="object"&&f||tl;const{css:p,...h}=f,m={};for(const v in i)if(delete h[v],v in f){let w=f[v];typeof w=="object"&&w?m[v]={"@initial":i[v],...w}:(w=String(w),m[v]=w!=="undefined"||s.has(v)?w:i[v])}else m[v]=i[v];const b=new Set([...o]);for(const[v,w,x,$]of t.composers){n.rules.styled.cache.has(v)||(n.rules.styled.cache.add(v),ot(w,[`.${v}`],[],e,S=>{c.styled.apply(S)}));const C=lo(x,m,e.media),E=lo($,m,e.media,!0);for(const S of C)if(S!==void 0)for(const[k,z,R]of S){const T=`${v}-${Ve(z)}-${k}`;b.add(T);const P=(R?n.rules.resonevar:n.rules.onevar).cache,I=R?c.resonevar:c.onevar;P.has(T)||(P.add(T),ot(z,[`.${T}`],[],e,j=>{I.apply(j)}))}for(const S of E)if(S!==void 0)for(const[k,z]of S){const R=`${v}-${Ve(z)}-${k}`;b.add(R),n.rules.allvar.cache.has(R)||(n.rules.allvar.cache.add(R),ot(z,[`.${R}`],[],e,T=>{c.allvar.apply(T)}))}}if(typeof p=="object"&&p){const v=`${r}-i${Ve(p)}-css`;b.add(v),n.rules.inline.cache.has(v)||(n.rules.inline.cache.add(v),ot(p,[`.${v}`],[],e,w=>{c.inline.apply(w)}))}for(const v of String(f.className||"").trim().split(/\s+/))v&&b.add(v);const y=h.className=[...b].join(" ");return{type:t.type,className:y,selector:l,props:h,toString:()=>y,deferredInjector:a}};return xr(u,{className:r,selector:l,[He]:t,toString:()=>(n.rules.styled.cache.has(r)||u(),r)})},el=e=>{let t="";const n=[],r={},o=[];for(const[i,,,,s,a]of e){t===""&&(t=i),n.push(i),o.push(...a);for(const c in s){const l=s[c];(r[c]===void 0||l!=="undefined"||a.includes(l))&&(r[c]=l)}}return[t,n,r,new Set(o)]},lo=(e,t,n,r)=>{const o=[];e:for(let[i,s,a]of e){if(a)continue;let c,l=0,u=!1;for(c in i){const f=i[c];let p=t[c];if(p!==f){if(typeof p!="object"||!p)continue e;{let h,m,b=0;for(const y in p){if(f===String(p[y])){if(y!=="@initial"){const v=y.slice(1);(m=m||[]).push(v in n?n[v]:y.replace(/^@media ?/,"")),u=!0}l+=b,h=!0}++b}if(m&&m.length&&(s={["@media "+m.join(", ")]:s}),!h)continue e}}}(o[l]=o[l]||[]).push([r?"cv":`${c}-${i[c]}`,s,u])}return o},tl={},nl=ut(),rl=(e,t)=>nl(e,()=>(...n)=>{const r=()=>{for(let o of n){o=typeof o=="object"&&o||{};let i=Ve(o);if(!t.rules.global.cache.has(i)){if(t.rules.global.cache.add(i),"@import"in o){let s=[].indexOf.call(t.sheet.cssRules,t.rules.themed.group)-1;for(let a of[].concat(o["@import"]))a=a.includes('"')||a.includes("'")?a:`"${a}"`,t.sheet.insertRule(`@import ${a};`,s++);delete o["@import"]}ot(o,[],[],e,s=>{t.rules.global.apply(s)})}}return""};return xr(r,{toString:r})}),ol=ut(),il=(e,t)=>ol(e,()=>n=>{const r=`${Pe(e.prefix)}k-${Ve(n)}`,o=()=>{if(!t.rules.global.cache.has(r)){t.rules.global.cache.add(r);const i=[];ot(n,[],[],e,a=>i.push(a));const s=`@keyframes ${r}{${i.join("")}}`;t.rules.global.apply(s)}return r};return xr(o,{get name(){return o()},toString:o})}),sl=class{constructor(e,t,n,r){this.token=e==null?"":String(e),this.value=t==null?"":String(t),this.scale=n==null?"":String(n),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+Pe(this.prefix)+Pe(this.scale)+this.token}toString(){return this.computedValue}},al=ut(),cl=(e,t)=>al(e,()=>(n,r)=>{r=typeof n=="object"&&n||Object(r);const o=`.${n=(n=typeof n=="string"?n:"")||`${Pe(e.prefix)}t-${Ve(r)}`}`,i={},s=[];for(const c in r){i[c]={};for(const l in r[c]){const u=`--${Pe(e.prefix)}${c}-${l}`,f=Ai(String(r[c][l]),e.prefix,c);i[c][l]=new sl(l,f,c,e.prefix),s.push(`${u}:${f}`)}}const a=()=>{if(s.length&&!t.rules.themed.cache.has(n)){t.rules.themed.cache.add(n);const c=`${r===e.theme?":root,":""}.${n}{${s.join(";")}}`;t.rules.themed.apply(c)}return n};return{...i,get className(){return a()},selector:o,toString:a}}),ll=ut(),ul=ut(),fl=e=>{const t=(n=>{let r=!1;const o=ll(n,i=>{r=!0;const s="prefix"in(i=typeof i=="object"&&i||{})?String(i.prefix):"",a=typeof i.media=="object"&&i.media||{},c=typeof i.root=="object"?i.root||null:globalThis.document||null,l=typeof i.theme=="object"&&i.theme||{},u={prefix:s,media:a,theme:l,themeMap:typeof i.themeMap=="object"&&i.themeMap||{...Nc},utils:typeof i.utils=="object"&&i.utils||{}},f=qc(c),p={css:co(u,f),globalCss:rl(u,f),keyframes:il(u,f),createTheme:cl(u,f),reset(){f.reset(),p.theme.toString()},theme:{},sheet:f,config:u,prefix:s,getCssText:f.toString,toString:f.toString};return String(p.theme=p.createTheme(l)),p});return r||o.reset(),o})(e);return t.styled=(({config:n,sheet:r})=>ul(n,()=>{const o=co(n,r);return(...i)=>{const s=o(...i),a=s[He].type,c=g.forwardRef((l,u)=>{const f=l&&l.as||a,{props:p,deferredInjector:h}=s(l);return delete p.as,p.ref=u,h?g.createElement(g.Fragment,null,g.createElement(f,p),g.createElement(h,null)):g.createElement(f,p)});return c.className=s.className,c.displayName=`Styled.${a.displayName||a.name||a}`,c.selector=s.selector,c.toString=()=>s.selector,c[He]=s[He],c}}))(t),t};function Re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function dl(e,t=[]){let n=[];function r(i,s){const a=d.createContext(s),c=n.length;n=[...n,s];const l=f=>{var v;const{scope:p,children:h,...m}=f,b=((v=p==null?void 0:p[e])==null?void 0:v[c])||a,y=d.useMemo(()=>m,Object.values(m));return F.jsx(b.Provider,{value:y,children:h})};l.displayName=i+"Provider";function u(f,p){var b;const h=((b=p==null?void 0:p[e])==null?void 0:b[c])||a,m=d.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[l,u]}const o=()=>{const i=n.map(s=>d.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,pl(o,...t)]}function pl(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(i)[`__scope${l}`];return{...a,...f}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function ft(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function hl(e,t=globalThis==null?void 0:globalThis.document){const n=ft(e);d.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var gl="DismissableLayer",Zn="dismissableLayer.update",ml="dismissableLayer.pointerDownOutside",bl="dismissableLayer.focusOutside",uo,Di=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ii=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...c}=e,l=d.useContext(Di),[u,f]=d.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=d.useState({}),m=Ye(t,S=>f(S)),b=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),w=u?b.indexOf(u):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,$=w>=v,C=wl(S=>{const k=S.target,z=[...l.branches].some(R=>R.contains(k));!$||z||(o==null||o(S),s==null||s(S),S.defaultPrevented||a==null||a())},p),E=xl(S=>{const k=S.target;[...l.branches].some(R=>R.contains(k))||(i==null||i(S),s==null||s(S),S.defaultPrevented||a==null||a())},p);return hl(S=>{w===l.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&a&&(S.preventDefault(),a()))},p),d.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(uo=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),fo(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=uo)}},[u,p,n,l]),d.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),fo())},[u,l]),d.useEffect(()=>{const S=()=>h({});return document.addEventListener(Zn,S),()=>document.removeEventListener(Zn,S)},[]),F.jsx(ze.div,{...c,ref:m,style:{pointerEvents:x?$?"auto":"none":void 0,...e.style},onFocusCapture:Re(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Re(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Re(e.onPointerDownCapture,C.onPointerDownCapture)})});Ii.displayName=gl;var vl="DismissableLayerBranch",yl=d.forwardRef((e,t)=>{const n=d.useContext(Di),r=d.useRef(null),o=Ye(t,r);return d.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),F.jsx(ze.div,{...e,ref:o})});yl.displayName=vl;function wl(e,t=globalThis==null?void 0:globalThis.document){const n=ft(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){ji(ml,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function xl(e,t=globalThis==null?void 0:globalThis.document){const n=ft(e),r=d.useRef(!1);return d.useEffect(()=>{const o=i=>{i.target&&!r.current&&ji(bl,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function fo(){const e=new CustomEvent(Zn);document.dispatchEvent(e)}function ji(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?kc(o,i):o.dispatchEvent(i)}var El=wa.useId||(()=>{}),$l=0;function Sl(e){const[t,n]=d.useState(El());return Ue(()=>{n(r=>r??String($l++))},[e]),t?`radix-${t}`:""}const Cl=["top","right","bottom","left"],je=Math.min,le=Math.max,nn=Math.round,Kt=Math.floor,Me=e=>({x:e,y:e}),Ol={left:"right",right:"left",bottom:"top",top:"bottom"},Rl={start:"end",end:"start"};function Qn(e,t,n){return le(e,je(t,n))}function ke(e,t){return typeof e=="function"?e(t):e}function Ae(e){return e.split("-")[0]}function dt(e){return e.split("-")[1]}function Er(e){return e==="x"?"y":"x"}function $r(e){return e==="y"?"height":"width"}function Le(e){return["top","bottom"].includes(Ae(e))?"y":"x"}function Sr(e){return Er(Le(e))}function _l(e,t,n){n===void 0&&(n=!1);const r=dt(e),o=Sr(e),i=$r(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=rn(s)),[s,rn(s)]}function Tl(e){const t=rn(e);return[er(e),t,er(t)]}function er(e){return e.replace(/start|end/g,t=>Rl[t])}function Pl(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function kl(e,t,n,r){const o=dt(e);let i=Pl(Ae(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(er)))),i}function rn(e){return e.replace(/left|right|bottom|top/g,t=>Ol[t])}function Al(e){return{top:0,right:0,bottom:0,left:0,...e}}function Mi(e){return typeof e!="number"?Al(e):{top:e,right:e,bottom:e,left:e}}function on(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function po(e,t,n){let{reference:r,floating:o}=e;const i=Le(t),s=Sr(t),a=$r(s),c=Ae(t),l=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(c){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(dt(t)){case"start":h[s]-=p*(n&&l?-1:1);break;case"end":h[s]+=p*(n&&l?-1:1);break}return h}const Dl=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=po(l,r,c),p=r,h={},m=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:l,padding:u=0}=ke(e,t)||{};if(l==null)return{};const f=Mi(u),p={x:n,y:r},h=Sr(o),m=$r(h),b=await s.getDimensions(l),y=h==="y",v=y?"top":"left",w=y?"bottom":"right",x=y?"clientHeight":"clientWidth",$=i.reference[m]+i.reference[h]-p[h]-i.floating[m],C=p[h]-i.reference[h],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let S=E?E[x]:0;(!S||!await(s.isElement==null?void 0:s.isElement(E)))&&(S=a.floating[x]||i.floating[m]);const k=$/2-C/2,z=S/2-b[m]/2-1,R=je(f[v],z),T=je(f[w],z),P=R,I=S-b[m]-T,j=S/2-b[m]/2+k,L=Qn(P,j,I),B=!c.arrow&&dt(o)!=null&&j!==L&&i.reference[m]/2-(jj<=0)){var T,P;const j=(((T=i.flip)==null?void 0:T.index)||0)+1,L=S[j];if(L)return{data:{index:j,overflows:R},reset:{placement:L}};let B=(P=R.filter(W=>W.overflows[0]<=0).sort((W,M)=>W.overflows[1]-M.overflows[1])[0])==null?void 0:P.placement;if(!B)switch(h){case"bestFit":{var I;const W=(I=R.filter(M=>{if(E){const H=Le(M.placement);return H===w||H==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(H=>H>0).reduce((H,J)=>H+J,0)]).sort((M,H)=>M[1]-H[1])[0])==null?void 0:I[0];W&&(B=W);break}case"initialPlacement":B=a;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function ho(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function go(e){return Cl.some(t=>e[t]>=0)}const Ml=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ke(e,t);switch(r){case"referenceHidden":{const i=await kt(t,{...o,elementContext:"reference"}),s=ho(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:go(s)}}}case"escaped":{const i=await kt(t,{...o,altBoundary:!0}),s=ho(i,n.floating);return{data:{escapedOffsets:s,escaped:go(s)}}}default:return{}}}}};async function Ll(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ae(n),a=dt(n),c=Le(n)==="y",l=["left","top"].includes(s)?-1:1,u=i&&c?-1:1,f=ke(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),c?{x:h*u,y:p*l}:{x:p*l,y:h*u}}const Nl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await Ll(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},Fl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:y=>{let{x:v,y:w}=y;return{x:v,y:w}}},...c}=ke(e,t),l={x:n,y:r},u=await kt(t,c),f=Le(Ae(o)),p=Er(f);let h=l[p],m=l[f];if(i){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",w=h+u[y],x=h-u[v];h=Qn(w,h,x)}if(s){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=m+u[y],x=m-u[v];m=Qn(w,m,x)}const b=a.fn({...t,[p]:h,[f]:m});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:i,[f]:s}}}}}},zl=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=ke(e,t),u={x:n,y:r},f=Le(o),p=Er(f);let h=u[p],m=u[f];const b=ke(a,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const x=p==="y"?"height":"width",$=i.reference[p]-i.floating[x]+y.mainAxis,C=i.reference[p]+i.reference[x]-y.mainAxis;h<$?h=$:h>C&&(h=C)}if(l){var v,w;const x=p==="y"?"width":"height",$=["top","left"].includes(Ae(o)),C=i.reference[f]-i.floating[x]+($&&((v=s.offset)==null?void 0:v[f])||0)+($?0:y.crossAxis),E=i.reference[f]+i.reference[x]+($?0:((w=s.offset)==null?void 0:w[f])||0)-($?y.crossAxis:0);mE&&(m=E)}return{[p]:h,[f]:m}}}},Bl=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:c=()=>{},...l}=ke(e,t),u=await kt(t,l),f=Ae(o),p=dt(o),h=Le(o)==="y",{width:m,height:b}=i.floating;let y,v;f==="top"||f==="bottom"?(y=f,v=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(v=f,y=p==="end"?"top":"bottom");const w=b-u.top-u.bottom,x=m-u.left-u.right,$=je(b-u[y],w),C=je(m-u[v],x),E=!t.middlewareData.shift;let S=$,k=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=w),E&&!p){const R=le(u.left,0),T=le(u.right,0),P=le(u.top,0),I=le(u.bottom,0);h?k=m-2*(R!==0||T!==0?R+T:le(u.left,u.right)):S=b-2*(P!==0||I!==0?P+I:le(u.top,u.bottom))}await c({...t,availableWidth:k,availableHeight:S});const z=await s.getDimensions(a.floating);return m!==z.width||b!==z.height?{reset:{rects:!0}}:{}}}};function yn(){return typeof window<"u"}function pt(e){return Li(e)?(e.nodeName||"").toLowerCase():"#document"}function ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Se(e){var t;return(t=(Li(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Li(e){return yn()?e instanceof Node||e instanceof ue(e).Node:!1}function be(e){return yn()?e instanceof Element||e instanceof ue(e).Element:!1}function $e(e){return yn()?e instanceof HTMLElement||e instanceof ue(e).HTMLElement:!1}function mo(e){return!yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ue(e).ShadowRoot}function jt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Wl(e){return["table","td","th"].includes(pt(e))}function wn(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Cr(e){const t=Or(),n=be(e)?ve(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Hl(e){let t=Ne(e);for(;$e(t)&&!at(t);){if(Cr(t))return t;if(wn(t))return null;t=Ne(t)}return null}function Or(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function at(e){return["html","body","#document"].includes(pt(e))}function ve(e){return ue(e).getComputedStyle(e)}function xn(e){return be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ne(e){if(pt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mo(e)&&e.host||Se(e);return mo(t)?t.host:t}function Ni(e){const t=Ne(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:$e(t)&&jt(t)?t:Ni(t)}function At(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ni(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=ue(o);if(i){const a=tr(s);return t.concat(s,s.visualViewport||[],jt(o)?o:[],a&&n?At(a):[])}return t.concat(o,At(o,[],n))}function tr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fi(e){const t=ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=$e(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=nn(n)!==i||nn(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Rr(e){return be(e)?e:e.contextElement}function st(e){const t=Rr(e);if(!$e(t))return Me(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Fi(t);let s=(i?nn(n.width):n.width)/r,a=(i?nn(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Vl=Me(0);function zi(e){const t=ue(e);return!Or()||!t.visualViewport?Vl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ul(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ue(e)?!1:t}function Ke(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Rr(e);let s=Me(1);t&&(r?be(r)&&(s=st(r)):s=st(e));const a=Ul(i,n,r)?zi(i):Me(0);let c=(o.left+a.x)/s.x,l=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const p=ue(i),h=r&&be(r)?ue(r):r;let m=p,b=tr(m);for(;b&&r&&h!==m;){const y=st(b),v=b.getBoundingClientRect(),w=ve(b),x=v.left+(b.clientLeft+parseFloat(w.paddingLeft))*y.x,$=v.top+(b.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,l*=y.y,u*=y.x,f*=y.y,c+=x,l+=$,m=ue(b),b=tr(m)}}return on({width:u,height:f,x:c,y:l})}function Kl(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Se(r),a=t?wn(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},l=Me(1);const u=Me(0),f=$e(r);if((f||!f&&!i)&&((pt(r)!=="body"||jt(s))&&(c=xn(r)),$e(r))){const p=Ke(r);l=st(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x,y:n.y*l.y-c.scrollTop*l.y+u.y}}function Gl(e){return Array.from(e.getClientRects())}function nr(e,t){const n=xn(e).scrollLeft;return t?t.left+n:Ke(Se(e)).left+n}function Yl(e){const t=Se(e),n=xn(e),r=e.ownerDocument.body,o=le(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=le(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+nr(e);const a=-n.scrollTop;return ve(r).direction==="rtl"&&(s+=le(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function ql(e,t){const n=ue(e),r=Se(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const l=Or();(!l||l&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function Xl(e,t){const n=Ke(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=$e(e)?st(e):Me(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,l=r*i.y;return{width:s,height:a,x:c,y:l}}function bo(e,t,n){let r;if(t==="viewport")r=ql(e,n);else if(t==="document")r=Yl(Se(e));else if(be(t))r=Xl(t,n);else{const o=zi(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return on(r)}function Bi(e,t){const n=Ne(e);return n===t||!be(n)||at(n)?!1:ve(n).position==="fixed"||Bi(n,t)}function Jl(e,t){const n=t.get(e);if(n)return n;let r=At(e,[],!1).filter(a=>be(a)&&pt(a)!=="body"),o=null;const i=ve(e).position==="fixed";let s=i?Ne(e):e;for(;be(s)&&!at(s);){const a=ve(s),c=Cr(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||jt(s)&&!c&&Bi(e,s))?r=r.filter(u=>u!==s):o=a,s=Ne(s)}return t.set(e,r),r}function Zl(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?wn(t)?[]:Jl(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((l,u)=>{const f=bo(t,u,o);return l.top=le(f.top,l.top),l.right=je(f.right,l.right),l.bottom=je(f.bottom,l.bottom),l.left=le(f.left,l.left),l},bo(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ql(e){const{width:t,height:n}=Fi(e);return{width:t,height:n}}function eu(e,t,n){const r=$e(t),o=Se(t),i=n==="fixed",s=Ke(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Me(0);if(r||!r&&!i)if((pt(t)!=="body"||jt(o))&&(a=xn(t)),r){const h=Ke(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&(c.x=nr(o));let l=0,u=0;if(o&&!r&&!i){const h=o.getBoundingClientRect();u=h.top+a.scrollTop,l=h.left+a.scrollLeft-nr(o,h)}const f=s.left+a.scrollLeft-c.x-l,p=s.top+a.scrollTop-c.y-u;return{x:f,y:p,width:s.width,height:s.height}}function Ln(e){return ve(e).position==="static"}function vo(e,t){if(!$e(e)||ve(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Se(e)===n&&(n=n.ownerDocument.body),n}function Wi(e,t){const n=ue(e);if(wn(e))return n;if(!$e(e)){let o=Ne(e);for(;o&&!at(o);){if(be(o)&&!Ln(o))return o;o=Ne(o)}return n}let r=vo(e,t);for(;r&&Wl(r)&&Ln(r);)r=vo(r,t);return r&&at(r)&&Ln(r)&&!Cr(r)?n:r||Hl(e)||n}const tu=async function(e){const t=this.getOffsetParent||Wi,n=this.getDimensions,r=await n(e.floating);return{reference:eu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nu(e){return ve(e).direction==="rtl"}const ru={convertOffsetParentRelativeRectToViewportRelativeRect:Kl,getDocumentElement:Se,getClippingRect:Zl,getOffsetParent:Wi,getElementRects:tu,getClientRects:Gl,getDimensions:Ql,getScale:st,isElement:be,isRTL:nu};function ou(e,t){let n=null,r;const o=Se(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:l,top:u,width:f,height:p}=e.getBoundingClientRect();if(a||t(),!f||!p)return;const h=Kt(u),m=Kt(o.clientWidth-(l+f)),b=Kt(o.clientHeight-(u+p)),y=Kt(l),w={rootMargin:-h+"px "+-m+"px "+-b+"px "+-y+"px",threshold:le(0,je(1,c))||1};let x=!0;function $(C){const E=C[0].intersectionRatio;if(E!==c){if(!x)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver($,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver($,w)}n.observe(e)}return s(!0),i}function iu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,l=Rr(e),u=o||i?[...l?At(l):[],...At(t)]:[];u.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=l&&a?ou(l,n):null;let p=-1,h=null;s&&(h=new ResizeObserver(v=>{let[w]=v;w&&w.target===l&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(t)})),n()}),l&&!c&&h.observe(l),h.observe(t));let m,b=c?Ke(e):null;c&&y();function y(){const v=Ke(e);b&&(v.x!==b.x||v.y!==b.y||v.width!==b.width||v.height!==b.height)&&n(),b=v,m=requestAnimationFrame(y)}return n(),()=>{var v;u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f==null||f(),(v=h)==null||v.disconnect(),h=null,c&&cancelAnimationFrame(m)}}const su=Nl,au=Fl,cu=jl,lu=Bl,uu=Ml,yo=Il,fu=zl,du=(e,t,n)=>{const r=new Map,o={platform:ru,...n},i={...o.platform,_c:r};return Dl(e,t,{...o,platform:i})};var Qt=typeof document<"u"?d.useLayoutEffect:d.useEffect;function sn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!sn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!sn(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Hi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wo(e,t){const n=Hi(e);return Math.round(t*n)/n}function Nn(e){const t=d.useRef(e);return Qt(()=>{t.current=e}),t}function pu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[u,f]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=d.useState(r);sn(p,r)||h(r);const[m,b]=d.useState(null),[y,v]=d.useState(null),w=d.useCallback(M=>{M!==E.current&&(E.current=M,b(M))},[]),x=d.useCallback(M=>{M!==S.current&&(S.current=M,v(M))},[]),$=i||m,C=s||y,E=d.useRef(null),S=d.useRef(null),k=d.useRef(u),z=c!=null,R=Nn(c),T=Nn(o),P=Nn(l),I=d.useCallback(()=>{if(!E.current||!S.current)return;const M={placement:t,strategy:n,middleware:p};T.current&&(M.platform=T.current),du(E.current,S.current,M).then(H=>{const J={...H,isPositioned:P.current!==!1};j.current&&!sn(k.current,J)&&(k.current=J,di.flushSync(()=>{f(J)}))})},[p,t,n,T,P]);Qt(()=>{l===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[l]);const j=d.useRef(!1);Qt(()=>(j.current=!0,()=>{j.current=!1}),[]),Qt(()=>{if($&&(E.current=$),C&&(S.current=C),$&&C){if(R.current)return R.current($,C,I);I()}},[$,C,I,R,z]);const L=d.useMemo(()=>({reference:E,floating:S,setReference:w,setFloating:x}),[w,x]),B=d.useMemo(()=>({reference:$,floating:C}),[$,C]),W=d.useMemo(()=>{const M={position:n,left:0,top:0};if(!B.floating)return M;const H=wo(B.floating,u.x),J=wo(B.floating,u.y);return a?{...M,transform:"translate("+H+"px, "+J+"px)",...Hi(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:J}},[n,a,B.floating,u.x,u.y]);return d.useMemo(()=>({...u,update:I,refs:L,elements:B,floatingStyles:W}),[u,I,L,B,W])}const hu=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?yo({element:r.current,padding:o}).fn(n):{}:r?yo({element:r,padding:o}).fn(n):{}}}},gu=(e,t)=>({...su(e),options:[e,t]}),mu=(e,t)=>({...au(e),options:[e,t]}),bu=(e,t)=>({...fu(e),options:[e,t]}),vu=(e,t)=>({...cu(e),options:[e,t]}),yu=(e,t)=>({...lu(e),options:[e,t]}),wu=(e,t)=>({...uu(e),options:[e,t]}),xu=(e,t)=>({...hu(e),options:[e,t]});var Eu="Arrow",Vi=d.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return F.jsx(ze.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:F.jsx("polygon",{points:"0,0 30,0 15,10"})})});Vi.displayName=Eu;var $u=Vi;function Su(e,t=[]){let n=[];function r(i,s){const a=d.createContext(s),c=n.length;n=[...n,s];function l(f){const{scope:p,children:h,...m}=f,b=(p==null?void 0:p[e][c])||a,y=d.useMemo(()=>m,Object.values(m));return F.jsx(b.Provider,{value:y,children:h})}function u(f,p){const h=(p==null?void 0:p[e][c])||a,m=d.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,u]}const o=()=>{const i=n.map(s=>d.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Cu(o,...t)]}function Cu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(i)[`__scope${l}`];return{...a,...f}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ou(e){const[t,n]=d.useState(void 0);return Ue(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,l=Array.isArray(c)?c[0]:c;s=l.inlineSize,a=l.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var _r="Popper",[Ui,Ki]=Su(_r),[Ru,Gi]=Ui(_r),Yi=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return F.jsx(Ru,{scope:t,anchor:r,onAnchorChange:o,children:n})};Yi.displayName=_r;var qi="PopperAnchor",Xi=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=Gi(qi,n),s=d.useRef(null),a=Ye(t,s);return d.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:F.jsx(ze.div,{...o,ref:a})});Xi.displayName=qi;var Tr="PopperContent",[_u,Tu]=Ui(Tr),Ji=d.forwardRef((e,t)=>{var Be,Ce,bt,vt,yt,wt;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:m,...b}=e,y=Gi(Tr,n),[v,w]=d.useState(null),x=Ye(t,fe=>w(fe)),[$,C]=d.useState(null),E=Ou($),S=(E==null?void 0:E.width)??0,k=(E==null?void 0:E.height)??0,z=r+(i!=="center"?"-"+i:""),R=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},T=Array.isArray(l)?l:[l],P=T.length>0,I={padding:R,boundary:T.filter(ku),altBoundary:P},{refs:j,floatingStyles:L,placement:B,isPositioned:W,middlewareData:M}=pu({strategy:"fixed",placement:z,whileElementsMounted:(...fe)=>iu(...fe,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[gu({mainAxis:o+k,alignmentAxis:s}),c&&mu({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?bu():void 0,...I}),c&&vu({...I}),yu({...I,apply:({elements:fe,rects:Xe,availableWidth:Je,availableHeight:Ze})=>{const{width:On,height:Rn}=Xe.reference,Qe=fe.floating.style;Qe.setProperty("--radix-popper-available-width",`${Je}px`),Qe.setProperty("--radix-popper-available-height",`${Ze}px`),Qe.setProperty("--radix-popper-anchor-width",`${On}px`),Qe.setProperty("--radix-popper-anchor-height",`${Rn}px`)}}),$&&xu({element:$,padding:a}),Au({arrowWidth:S,arrowHeight:k}),p&&wu({strategy:"referenceHidden",...I})]}),[H,J]=es(B),ie=ft(m);Ue(()=>{W&&(ie==null||ie())},[W,ie]);const zt=(Be=M.arrow)==null?void 0:Be.x,Bt=(Ce=M.arrow)==null?void 0:Ce.y,Wt=((bt=M.arrow)==null?void 0:bt.centerOffset)!==0,[Ht,qe]=d.useState();return Ue(()=>{v&&qe(window.getComputedStyle(v).zIndex)},[v]),F.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:W?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ht,"--radix-popper-transform-origin":[(vt=M.transformOrigin)==null?void 0:vt.x,(yt=M.transformOrigin)==null?void 0:yt.y].join(" "),...((wt=M.hide)==null?void 0:wt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:F.jsx(_u,{scope:n,placedSide:H,onArrowChange:C,arrowX:zt,arrowY:Bt,shouldHideArrow:Wt,children:F.jsx(ze.div,{"data-side":H,"data-align":J,...b,ref:x,style:{...b.style,animation:W?void 0:"none"}})})})});Ji.displayName=Tr;var Zi="PopperArrow",Pu={top:"bottom",right:"left",bottom:"top",left:"right"},Qi=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=Tu(Zi,r),s=Pu[i.placedSide];return F.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:F.jsx($u,{...o,ref:n,style:{...o.style,display:"block"}})})});Qi.displayName=Zi;function ku(e){return e!==null}var Au=e=>({name:"transformOrigin",options:e,fn(t){var y,v,w;const{placement:n,rects:r,middlewareData:o}=t,s=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[l,u]=es(n),f={start:"0%",center:"50%",end:"100%"}[u],p=(((v=o.arrow)==null?void 0:v.x)??0)+a/2,h=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let m="",b="";return l==="bottom"?(m=s?f:`${p}px`,b=`${-c}px`):l==="top"?(m=s?f:`${p}px`,b=`${r.floating.height+c}px`):l==="right"?(m=`${-c}px`,b=s?f:`${h}px`):l==="left"&&(m=`${r.floating.width+c}px`,b=s?f:`${h}px`),{data:{x:m,y:b}}}});function es(e){const[t,n="center"]=e.split("-");return[t,n]}var Du=Yi,Iu=Xi,ju=Ji,Mu=Qi;function Lu(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var ts=e=>{const{present:t,children:n}=e,r=Nu(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),i=Ye(r.ref,Fu(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:i}):null};ts.displayName="Presence";function Nu(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),i=d.useRef("none"),s=e?"mounted":"unmounted",[a,c]=Lu(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const l=Gt(r.current);i.current=a==="mounted"?l:"none"},[a]),Ue(()=>{const l=r.current,u=o.current;if(u!==e){const p=i.current,h=Gt(l);e?c("MOUNT"):h==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(u&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ue(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,f=h=>{const b=Gt(r.current).includes(h.animationName);if(h.target===t&&b&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=h=>{h.target===t&&(i.current=Gt(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function Gt(e){return(e==null?void 0:e.animationName)||"none"}function Fu(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zu({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Bu({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=ft(n),c=d.useCallback(l=>{if(i){const f=typeof l=="function"?l(e):l;f!==e&&a(f)}else o(l)},[i,e,o,a]);return[s,c]}function Bu({defaultProp:e,onChange:t}){const n=d.useState(e),[r]=n,o=d.useRef(r),i=ft(t);return d.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var Wu="VisuallyHidden",ns=d.forwardRef((e,t)=>F.jsx(ze.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));ns.displayName=Wu;var Hu=ns,[En,Cm]=dl("Tooltip",[Ki]),$n=Ki(),Vu="TooltipProvider",rr="tooltip.open",[Om,Pr]=En(Vu),Sn="Tooltip",[Uu,Cn]=En(Sn),rs=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,c=Pr(Sn,e.__scopeTooltip),l=$n(t),[u,f]=d.useState(null),p=Sl(),h=d.useRef(0),m=s??c.disableHoverableContent,b=a??c.delayDuration,y=d.useRef(!1),[v=!1,w]=zu({prop:r,defaultProp:o,onChange:S=>{S?(c.onOpen(),document.dispatchEvent(new CustomEvent(rr))):c.onClose(),i==null||i(S)}}),x=d.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),$=d.useCallback(()=>{window.clearTimeout(h.current),y.current=!1,w(!0)},[w]),C=d.useCallback(()=>{window.clearTimeout(h.current),w(!1)},[w]),E=d.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,w(!0)},b)},[b,w]);return d.useEffect(()=>()=>window.clearTimeout(h.current),[]),F.jsx(Du,{...l,children:F.jsx(Uu,{scope:t,contentId:p,open:v,stateAttribute:x,trigger:u,onTriggerChange:f,onTriggerEnter:d.useCallback(()=>{c.isOpenDelayed?E():$()},[c.isOpenDelayed,E,$]),onTriggerLeave:d.useCallback(()=>{m?C():window.clearTimeout(h.current)},[C,m]),onOpen:$,onClose:C,disableHoverableContent:m,children:n})})};rs.displayName=Sn;var or="TooltipTrigger",os=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Cn(or,n),i=Pr(or,n),s=$n(n),a=d.useRef(null),c=Ye(t,a,o.onTriggerChange),l=d.useRef(!1),u=d.useRef(!1),f=d.useCallback(()=>l.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),F.jsx(Iu,{asChild:!0,...s,children:F.jsx(ze.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:Re(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Re(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Re(e.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Re(e.onFocus,()=>{l.current||o.onOpen()}),onBlur:Re(e.onBlur,o.onClose),onClick:Re(e.onClick,o.onClose)})})});os.displayName=or;var Ku="TooltipPortal",[Rm,Gu]=En(Ku,{forceMount:void 0}),ct="TooltipContent",is=d.forwardRef((e,t)=>{const n=Gu(ct,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Cn(ct,e.__scopeTooltip);return F.jsx(ts,{present:r||s.open,children:s.disableHoverableContent?F.jsx(ss,{side:o,...i,ref:t}):F.jsx(Yu,{side:o,...i,ref:t})})}),Yu=d.forwardRef((e,t)=>{const n=Cn(ct,e.__scopeTooltip),r=Pr(ct,e.__scopeTooltip),o=d.useRef(null),i=Ye(t,o),[s,a]=d.useState(null),{trigger:c,onClose:l}=n,u=o.current,{onPointerInTransitChange:f}=r,p=d.useCallback(()=>{a(null),f(!1)},[f]),h=d.useCallback((m,b)=>{const y=m.currentTarget,v={x:m.clientX,y:m.clientY},w=Ju(v,y.getBoundingClientRect()),x=Zu(v,w),$=Qu(b.getBoundingClientRect()),C=tf([...x,...$]);a(C),f(!0)},[f]);return d.useEffect(()=>()=>p(),[p]),d.useEffect(()=>{if(c&&u){const m=y=>h(y,u),b=y=>h(y,c);return c.addEventListener("pointerleave",m),u.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",b)}}},[c,u,h,p]),d.useEffect(()=>{if(s){const m=b=>{const y=b.target,v={x:b.clientX,y:b.clientY},w=(c==null?void 0:c.contains(y))||(u==null?void 0:u.contains(y)),x=!ef(v,s);w?p():x&&(p(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[c,u,s,l,p]),F.jsx(ss,{...e,ref:i})}),[qu,Xu]=En(Sn,{isInside:!1}),ss=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,c=Cn(ct,n),l=$n(n),{onClose:u}=c;return d.useEffect(()=>(document.addEventListener(rr,u),()=>document.removeEventListener(rr,u)),[u]),d.useEffect(()=>{if(c.trigger){const f=p=>{const h=p.target;h!=null&&h.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),F.jsx(Ii,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:F.jsxs(ju,{"data-state":c.stateAttribute,...l,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[F.jsx(Oi,{children:r}),F.jsx(qu,{scope:n,isInside:!0,children:F.jsx(Hu,{id:c.contentId,role:"tooltip",children:o||r})})]})})});is.displayName=ct;var as="TooltipArrow",cs=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=$n(n);return Xu(as,n).isInside?null:F.jsx(Mu,{...o,...r,ref:t})});cs.displayName=as;function Ju(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Zu(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Qu(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function ef(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=u>r&&n<(l-a)*(r-c)/(u-c)+a&&(o=!o)}return o}function tf(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),nf(t)}function nf(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var rf=rs,of=os,sf=is,af=cs;function cf(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function U(e,t){if(e==null)return{};var n=cf(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}let Y;(function(e){e[e.UNSUPPORTED_INPUT=0]="UNSUPPORTED_INPUT",e[e.NO_COMPONENT_FOR_TYPE=1]="NO_COMPONENT_FOR_TYPE",e[e.UNKNOWN_INPUT=2]="UNKNOWN_INPUT",e[e.DUPLICATE_KEYS=3]="DUPLICATE_KEYS",e[e.ALREADY_REGISTERED_TYPE=4]="ALREADY_REGISTERED_TYPE",e[e.CLIPBOARD_ERROR=5]="CLIPBOARD_ERROR",e[e.THEME_ERROR=6]="THEME_ERROR",e[e.PATH_DOESNT_EXIST=7]="PATH_DOESNT_EXIST",e[e.INPUT_TYPE_OVERRIDE=8]="INPUT_TYPE_OVERRIDE",e[e.EMPTY_KEY=9]="EMPTY_KEY"})(Y||(Y={}));const lf={[Y.UNSUPPORTED_INPUT]:(e,t)=>[`An input with type \`${e}\` input was found at path \`${t}\` but it's not supported yet.`],[Y.NO_COMPONENT_FOR_TYPE]:(e,t)=>[`Type \`${e}\` found at path \`${t}\` can't be displayed in panel because no component supports it yet.`],[Y.UNKNOWN_INPUT]:(e,t)=>[`input at path \`${e}\` is not recognized.`,t],[Y.DUPLICATE_KEYS]:(e,t,n)=>[`Key \`${e}\` of path \`${t}\` already exists at path \`${n}\`. Even nested keys need to be unique. Rename one of the keys.`],[Y.ALREADY_REGISTERED_TYPE]:e=>[`Type ${e} has already been registered. You can't register a component with the same type.`],[Y.CLIPBOARD_ERROR]:e=>["Error copying the value",e],[Y.THEME_ERROR]:(e,t)=>[`Error accessing the theme \`${e}.${t}\` value.`],[Y.PATH_DOESNT_EXIST]:e=>[`Error getting the value at path \`${e}\`. There is probably an error in your \`render\` function.`],[Y.PATH_DOESNT_EXIST]:e=>[`Error accessing the value at path \`${e}\``],[Y.INPUT_TYPE_OVERRIDE]:(e,t,n)=>[`Input at path \`${e}\` already exists with type: \`${t}\`. Its type cannot be overridden with type \`${n}\`.`],[Y.EMPTY_KEY]:()=>["Keys can not be empty, if you want to hide a label use whitespace."]};function ls(e,t,...n){const[r,...o]=lf[t](...n);console[e]("LEVA: "+r,...o)}const _e=ls.bind(null,"warn"),uf=ls.bind(null,"log"),ff=["value"],df=["schema"],pf=["value"],us=[],Ge={};function xo(e){let{value:t}=e,n=U(e,ff);for(let r of us){const o=r(t,n);if(o)return o}}function De(e,t){let{schema:n}=t,r=U(t,df);if(e in Ge){_e(Y.ALREADY_REGISTERED_TYPE,e);return}us.push((o,i)=>n(o,i)&&e),Ge[e]=r}function Fn(e,t,n,r){const{normalize:o}=Ge[e];if(o)return o(t,n,r);if(typeof t!="object"||!("value"in t))return{value:t};const{value:i}=t,s=U(t,pf);return{value:i,settings:s}}function hf(e,t,n,r,o,i){const{sanitize:s}=Ge[e];return s?s(t,n,r,o,i):t}function Eo(e,t,n){const{format:r}=Ge[e];return r?r(t,n):t}function gf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;te>n?n:e{if(e===""||typeof e=="number")return e;try{const t=Ie(e);if(!isNaN(t))return t}catch{}return parseFloat(e)},bf=Math.log(10);function So(e){let t=Math.abs(+String(e).replace(".",""));if(t===0)return .01;for(;t!==0&&t%10===0;)t/=10;const n=Math.floor(Math.log(t)/bf)+1,r=Math.floor(Math.log10(Math.abs(e))),o=Math.pow(10,r-n);return Math.max(o,.001)}const an=(e,t,n)=>n===t?0:(Fe(e,t,n)-t)/(n-t),cn=(e,t,n)=>e*(n-t)+t,vf=()=>"_"+Math.random().toString(36).substr(2,9),Co=/\(([0-9+\-*/^ .]+)\)/,Oo=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,Ro=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,_o=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,To=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,Po=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function Ie(e){if(isNaN(Number(e)))if(Co.test(e)){const t=e.replace(Co,(n,r)=>String(Ie(r)));return Ie(t)}else if(Oo.test(e)){const t=e.replace(Oo,(n,r,o)=>String(Math.pow(Number(r),Number(o))));return Ie(t)}else if(Ro.test(e)){const t=e.replace(Ro,(n,r,o)=>String(Number(r)*Number(o)));return Ie(t)}else if(_o.test(e)){const t=e.replace(_o,(n,r,o)=>{if(o!=0)return String(Number(r)/Number(o));throw new Error("Division by zero")});return Ie(t)}else if(To.test(e)){const t=e.replace(To,(n,r,o)=>String(Number(r)+Number(o)));return Ie(t)}else if(Po.test(e)){const t=e.replace(Po,(n,r,o)=>String(Number(r)-Number(o)));return Ie(t)}else return Number(e);return Number(e)}function yf(e,t){return t.reduce((n,r)=>(e&&e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}function wf(e,t){const n=D({},e);return t.forEach(r=>r in e&&delete n[r]),n}function xf(e,t){return e.reduce((n,r,o)=>Object.assign(n,{[t[o]]:r}),{})}function fs(e){return Object.prototype.toString.call(e)==="[object Object]"}const Ef=e=>fs(e)&&Object.keys(e).length===0;let me;(function(e){e.BUTTON="BUTTON",e.BUTTON_GROUP="BUTTON_GROUP",e.MONITOR="MONITOR",e.FOLDER="FOLDER"})(me||(me={}));let ye;(function(e){e.SELECT="SELECT",e.IMAGE="IMAGE",e.NUMBER="NUMBER",e.COLOR="COLOR",e.STRING="STRING",e.BOOLEAN="BOOLEAN",e.INTERVAL="INTERVAL",e.VECTOR3D="VECTOR3D",e.VECTOR2D="VECTOR2D"})(ye||(ye={}));const $f=["type","__customInput"],Sf=["render","label","optional","order","disabled","hint","onChange","onEditStart","onEditEnd","transient"],Cf=["type"];function ds(e,t,n={},r){var o,i;if(typeof e!="object"||Array.isArray(e))return{type:r,input:e,options:D({key:t,label:t,optional:!1,disabled:!1,order:0},n)};if("__customInput"in e){const{type:C,__customInput:E}=e,S=U(e,$f);return ds(E,t,S,C)}const{render:s,label:a,optional:c,order:l=0,disabled:u,hint:f,onChange:p,onEditStart:h,onEditEnd:m,transient:b}=e,y=U(e,Sf),v=D({render:s,key:t,label:a??t,hint:f,transient:b??!!p,onEditStart:h,onEditEnd:m,disabled:u,optional:c,order:l},n);let{type:w}=y,x=U(y,Cf);if(w=r??w,w in me)return{type:w,input:x,options:v};let $;return r&&fs(x)&&"value"in x?$=x.value:$=Ef(x)?void 0:x,{type:w,input:$,options:D(D({},v),{},{onChange:p,optional:(o=v.optional)!==null&&o!==void 0?o:!1,disabled:(i=v.disabled)!==null&&i!==void 0?i:!1})}}function Of(e,t,n,r){const o=ds(e,t),{type:i,input:s,options:a}=o;if(i)return i in me?o:{type:i,input:Fn(i,s,n,r),options:a};let c=xo(s);return c?{type:c,input:Fn(c,s,n,r),options:a}:(c=xo({value:s}),c?{type:c,input:Fn(c,{value:s},n,r),options:a}:!1)}function ko(e,t,n,r,o){const{value:i,type:s,settings:a}=e;e.value=ps({type:s,value:i,settings:a},t,n,r),e.fromPanel=o}const Rf=function(t,n,r){this.type="LEVA_ERROR",this.message="LEVA: "+t,this.previousValue=n,this.error=r};function ps({type:e,value:t,settings:n},r,o,i){const s=e!=="SELECT"&&typeof r=="function"?r(t):r;let a;try{a=hf(e,s,n,t,o,i)}catch(c){throw new Rf(`The value \`${r}\` did not result in a correct value.`,t,c)}return Tt(a,t)?t:a}const hs=(e,t,n=!1)=>{let r=0;return function(){const o=arguments,i=n&&!r,s=()=>e.apply(this,o);window.clearTimeout(r),r=window.setTimeout(s,t),i&&s()}},gs=e=>e.shiftKey?5:e.altKey?1/5:1;function _f(e,t){const n=console.error;console.error=()=>{},pi.render(e,t),console.error=n}const Tf=["value"],Pf=["min","max"],kf=e=>{if(typeof e=="number")return!0;if(typeof e=="string"){const t=parseFloat(e);return isNaN(t)?!1:e.substring((""+t).length).trim().length<4}return!1},ms=(e,{min:t=-1/0,max:n=1/0,suffix:r})=>{const o=parseFloat(e);if(e===""||isNaN(o))throw Error("Invalid number");const i=Fe(o,t,n);return r?i+r:i},Af=(e,{pad:t=0,suffix:n})=>{const r=parseFloat(e).toFixed(t);return n?r+n:r},bs=e=>{let{value:t}=e,n=U(e,Tf);const{min:r=-1/0,max:o=1/0}=n,i=U(n,Pf);let s=parseFloat(t);const a=typeof t=="string"?t.substring((""+s).length):void 0;s=Fe(s,r,o);let c=n.step;c||(Number.isFinite(r)?Number.isFinite(o)?c=+(Math.abs(o-r)/100).toPrecision(1):c=+(Math.abs(s-r)/100).toPrecision(1):Number.isFinite(o)&&(c=+(Math.abs(o-s)/100).toPrecision(1)));const l=c?So(c)*10:So(s);c=c||l/10;const u=Math.round(Fe(Math.log10(1/l),0,2));return{value:a?s+a:s,settings:D({initialValue:s,step:c,pad:u,min:r,max:o,suffix:a},i)}},vs=(e,{step:t,initialValue:n})=>{const r=Math.round((e-n)/t);return n+r*t};var ys=Object.freeze({__proto__:null,schema:kf,sanitize:ms,format:Af,normalize:bs,sanitizeStep:vs});function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t({colors:{elevation1:"#292d39",elevation2:"#181c20",elevation3:"#373c4b",accent1:"#0066dc",accent2:"#007bff",accent3:"#3c93ff",highlight1:"#535760",highlight2:"#8c92a4",highlight3:"#fefefe",vivid1:"#ffcc00",folderWidgetColor:"$highlight2",folderTextColor:"$highlight3",toolTipBackground:"$highlight3",toolTipText:"$elevation2"},radii:{xs:"2px",sm:"3px",lg:"10px"},space:{xs:"3px",sm:"6px",md:"10px",rowGap:"7px",colGap:"7px"},fonts:{mono:"ui-monospace, SFMono-Regular, Menlo, 'Roboto Mono', monospace",sans:"system-ui, sans-serif"},fontSizes:{root:"11px",toolTip:"$root"},sizes:{rootWidth:"280px",controlWidth:"160px",numberInputMinWidth:"38px",scrubberWidth:"8px",scrubberHeight:"16px",rowHeight:"24px",folderTitleHeight:"20px",checkboxSize:"16px",joystickWidth:"100px",joystickHeight:"100px",colorPickerWidth:"$controlWidth",colorPickerHeight:"100px",imagePreviewWidth:"$controlWidth",imagePreviewHeight:"100px",monitorHeight:"60px",titleBarHeight:"39px"},shadows:{level1:"0 0 9px 0 #00000088",level2:"0 4px 14px #00000033"},borderWidths:{root:"0px",input:"1px",focus:"1px",hover:"1px",active:"1px",folder:"1px"},fontWeights:{label:"normal",folder:"normal",button:"normal"}});function Yt(e,t){const[n,r]=e.split(" "),o={};return n!=="none"&&(o.boxShadow=`${t.inset?"inset ":""}0 0 0 $borderWidths${[t.key]} $colors${n!=="default"&&n||t.borderColor}`),r&&(o.backgroundColor=r),o}const $t={$inputStyle:()=>e=>Yt(e,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>e=>Yt(e,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>e=>Yt(e,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>e=>Yt(e,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:A,css:_m,createTheme:If,globalCss:jf,keyframes:Tm}=fl({prefix:"leva",theme:$s(),utils:D(D({},$t),{},{$flex:()=>({display:"flex",alignItems:"center"}),$flexCenter:()=>({display:"flex",alignItems:"center",justifyContent:"center"}),$reset:()=>({outline:"none",fontSize:"inherit",fontWeight:"inherit",color:"inherit",fontFamily:"inherit",border:"none",backgroundColor:"transparent",appearance:"none"}),$draggable:()=>({touchAction:"none",WebkitUserDrag:"none",userSelect:"none"}),$focus:e=>({"&:focus":$t.$focusStyle()(e)}),$focusWithin:e=>({"&:focus-within":$t.$focusStyle()(e)}),$hover:e=>({"&:hover":$t.$hoverStyle()(e)}),$active:e=>({"&:active":$t.$activeStyle()(e)})})}),Mf=jf({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});function Lf(e){const t=$s();if(!e)return{theme:t,className:""};Object.keys(e).forEach(r=>{Object.assign(t[r],e[r])});const n=If(t);return{theme:t,className:n.className}}function Te(e,t){const{theme:n}=d.useContext(kr);if(!(e in n)||!(t in n[e]))return _e(Y.THEME_ERROR,e,t),"";let r=t;for(;;){let o=n[e][r];if(typeof o=="string"&&o.charAt(0)==="$")r=o.substr(1);else return o}}const Ss=A("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),Cs=A("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${Ss}`]:{paddingLeft:0}}),Nf=A(Cs,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),Ff=A("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),zf=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],Bf=["onUpdate"];function Ar(e){let{innerLabel:t,value:n,onUpdate:r,onChange:o,onKeyDown:i,type:s,id:a,inputType:c="text",rows:l=0}=e,u=U(e,zf);const{id:f,emitOnEditStart:p,emitOnEditEnd:h,disabled:m}=te(),b=a||f,y=d.useRef(null),v=l>0,w=v?"textarea":"input",x=d.useCallback(E=>S=>{const k=S.currentTarget.value;E(k)},[]);g.useEffect(()=>{const E=y.current,S=x(k=>{r(k),h()});return E==null||E.addEventListener("blur",S),()=>E==null?void 0:E.removeEventListener("blur",S)},[x,r,h]);const $=d.useCallback(E=>{E.key==="Enter"&&x(r)(E)},[x,r]),C=Object.assign({as:w},v?{rows:l}:{},u);return g.createElement(Ff,{textArea:v},t&&typeof t=="string"?g.createElement(Cs,null,t):t,g.createElement(Ss,X({levaType:s,ref:y,id:b,type:c,autoComplete:"off",spellCheck:"false",value:n,onChange:x(o),onFocus:()=>p(),onKeyPress:$,onKeyDown:i,disabled:m},C)))}function Wf(e){let{onUpdate:t}=e,n=U(e,Bf);const r=d.useCallback(i=>t(mf(i)),[t]),o=d.useCallback(i=>{const s=i.key==="ArrowUp"?1:i.key==="ArrowDown"?-1:0;if(s){i.preventDefault();const a=i.altKey?.1:i.shiftKey?10:1;t(c=>parseFloat(c)+s*a)}},[t]);return g.createElement(Ar,X({},n,{onUpdate:r,onKeyDown:o,type:"number"}))}const ln=A("div",{}),ir=A("div",{position:"relative",background:"$elevation2",transition:"height 300ms ease",variants:{fill:{true:{},false:{}},flat:{false:{},true:{}},isRoot:{true:{},false:{paddingLeft:"$md","&::after":{content:'""',position:"absolute",left:0,top:0,width:"$borderWidths$folder",height:"100%",backgroundColor:"$folderWidgetColor",opacity:.4,transform:"translateX(-50%)"}}}},compoundVariants:[{isRoot:!0,fill:!1,css:{overflowY:"auto",maxHeight:"calc(100vh - 20px - $$titleBarHeight)"}},{isRoot:!0,flat:!1,css:{borderRadius:"$lg"}}]}),Hf=A("div",{$flex:"",color:"$folderTextColor",userSelect:"none",cursor:"pointer",height:"$folderTitleHeight",fontWeight:"$folder","> svg":{marginLeft:-4,marginRight:4,cursor:"pointer",fill:"$folderWidgetColor",opacity:.6},"&:hover > svg":{fill:"$folderWidgetColor"},[`&:hover + ${ir}::after`]:{opacity:.6},[`${ln}:hover > & + ${ir}::after`]:{opacity:.6},[`${ln}:hover > & > svg`]:{opacity:1}}),Os=A("div",{position:"relative",display:"grid",gridTemplateColumns:"100%",rowGap:"$rowGap",transition:"opacity 250ms ease",variants:{toggled:{true:{opacity:1,transitionDelay:"250ms"},false:{opacity:0,transitionDelay:"0ms",pointerEvents:"none"}},isRoot:{true:{"& > div":{paddingLeft:"$md",paddingRight:"$md"},"& > div:first-of-type":{paddingTop:"$sm"},"& > div:last-of-type":{paddingBottom:"$sm"},[`> ${ln}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),Rs=A("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${Os} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),_s=A(Rs,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),Vf=A("div",{$flex:"",height:"100%",position:"relative",overflow:"hidden","& > div":{marginLeft:"$colGap",padding:"0 $xs",opacity:.4},"& > div:hover":{opacity:.8},"& > div > svg":{display:"none",cursor:"pointer",width:13,minWidth:13,height:13,backgroundColor:"$elevation2"},"&:hover > div > svg":{display:"block"},variants:{align:{top:{height:"100%",alignItems:"flex-start",paddingTop:"$sm"}}}}),Uf=A("input",{$reset:"",height:0,width:0,opacity:0,margin:0,"& + label":{position:"relative",$flexCenter:"",height:"100%",userSelect:"none",cursor:"pointer",paddingLeft:2,paddingRight:"$sm",pointerEvents:"auto"},"& + label:after":{content:'""',width:6,height:6,backgroundColor:"$elevation3",borderRadius:"50%",$activeStyle:""},"&:focus + label:after":{$focusStyle:""},"& + label:active:after":{backgroundColor:"$accent1",$focusStyle:""},"&:checked + label:after":{backgroundColor:"$accent1"}}),sr=A("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}}),Kf=A("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${sr}`]:{pointerEvents:"auto"}}}}}),Ts=A("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"}),Gf=A("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),Yf=A(af,{fill:"$toolTipBackground"});function Dr({children:e}){const{className:t}=d.useContext(kr);return g.createElement(Dc,{className:t},e)}const qf=["align"];function Xf(){const{id:e,disable:t,disabled:n}=te();return g.createElement(g.Fragment,null,g.createElement(Uf,{id:e+"__disable",type:"checkbox",checked:!n,onChange:()=>t(!n)}),g.createElement("label",{htmlFor:e+"__disable"}))}function Jf(e){const{id:t,optional:n,hint:r}=te(),o=e.htmlFor||(t?{htmlFor:t}:null),i=!r&&typeof e.children=="string"?{title:e.children}:null;return g.createElement(g.Fragment,null,n&&g.createElement(Xf,null),r!==void 0?g.createElement(rf,null,g.createElement(of,{asChild:!0},g.createElement(sr,X({},o,e))),g.createElement(sf,{side:"top",sideOffset:2},g.createElement(Gf,null,r,g.createElement(Yf,null)))):g.createElement(sr,X({},o,i,e)))}function we(e){let{align:t}=e,n=U(e,qf);const{value:r,label:o,key:i,disabled:s}=te(),{hideCopyButton:a}=Df(),c=!a&&i!==void 0,[l,u]=d.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[i]:r??""})),u(!0)}catch{_e(Y.CLIPBOARD_ERROR,{[i]:r})}};return g.createElement(Vf,{align:t,onPointerLeave:()=>u(!1)},g.createElement(Jf,n),c&&!s&&g.createElement("div",{title:`Click to copy ${typeof o=="string"?o:i} value`},l?g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},g.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),g.createElement("path",{fillRule:"evenodd",d:"M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})):g.createElement("svg",{onClick:f,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},g.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),g.createElement("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"}))))}const Zf=["toggled"],Qf=A("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function Ir(e){let{toggled:t}=e,n=U(e,Zf);return g.createElement(Qf,X({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${t?0:-90}deg)`}},n),g.createElement("path",{d:"M3.8 4.4c.4.3 1 .3 1.4 0L8 1.7A1 1 0 007.4 0H1.6a1 1 0 00-.7 1.7l3 2.7z"}))}const ed=["input"];function he(e){let{input:t}=e,n=U(e,ed);return t?g.createElement(_s,n):g.createElement(Rs,n)}function Ps({value:e,type:t,settings:n,setValue:r}){const[o,i]=d.useState(Eo(t,e,n)),s=d.useRef(e),a=d.useRef(n);a.current=n;const c=d.useCallback(u=>i(Eo(t,u,a.current)),[t]),l=d.useCallback(u=>{try{r(u)}catch(f){const{type:p,previousValue:h}=f;if(p!=="LEVA_ERROR")throw f;c(h)}},[c,r]);return d.useEffect(()=>{Tt(e,s.current)||c(e),s.current=e},[e,c]),{displayValue:o,onChange:i,onUpdate:l}}function Lt(e,t){const{emitOnEditStart:n,emitOnEditEnd:r}=te();return vc(o=>{o.first&&(document.body.classList.add("leva__panel__dragged"),n==null||n());const i=e(o);return o.last&&(document.body.classList.remove("leva__panel__dragged"),r==null||r()),i},t)}function td(e){const t=d.useRef(null),n=d.useRef(null),r=d.useRef(!1);return d.useEffect(()=>{const o=hs(()=>{t.current.width=t.current.offsetWidth*window.devicePixelRatio,t.current.height=t.current.offsetHeight*window.devicePixelRatio,e(t.current,n.current)},250);return window.addEventListener("resize",o),r.current||(o(),r.current=!0),()=>window.removeEventListener("resize",o)},[e]),d.useEffect(()=>{n.current=t.current.getContext("2d")},[]),[t,n]}function ks(){const e=d.useRef(null),t=d.useRef({x:0,y:0}),n=d.useCallback(r=>{Object.assign(t.current,r),e.current&&(e.current.style.transform=`translate3d(${t.current.x}px, ${t.current.y}px, 0)`)},[]);return[e,n]}const nd=["__refCount"],zn=(e,t)=>{if(!e[t])return null;const n=e[t];return U(n,nd)};function rd(e){const t=Mt(),[n,r]=d.useState(zn(t.getData(),e)),o=d.useCallback(l=>t.setValueAtPath(e,l,!0),[e,t]),i=d.useCallback(l=>t.setSettingsAtPath(e,l),[e,t]),s=d.useCallback(l=>t.disableInputAtPath(e,l),[e,t]),a=d.useCallback(()=>t.emitOnEditStart(e),[e,t]),c=d.useCallback(()=>t.emitOnEditEnd(e),[e,t]);return d.useEffect(()=>{r(zn(t.getData(),e));const l=t.useStore.subscribe(u=>zn(u.data,e),r,{equalityFn:bn});return()=>l()},[t,e]),[n,{set:o,setSettings:i,disable:s,storeId:t.storeId,emitOnEditStart:a,emitOnEditEnd:c}]}const od=A("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),As=A("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),ar=A("div",{position:"absolute",width:"$scrubberWidth",height:"$scrubberHeight",borderRadius:"$xs",boxShadow:"0 0 0 2px $colors$elevation2",backgroundColor:"$accent2",cursor:"pointer",$active:"none $accent1",$hover:"none $accent3",variants:{position:{left:{borderTopRightRadius:0,borderBottomRightRadius:0,transform:"translateX(calc(-0.5 * ($sizes$scrubberWidth + 4px)))"},right:{borderTopLeftRadius:0,borderBottomLeftRadius:0,transform:"translateX(calc(0.5 * ($sizes$scrubberWidth + 4px)))"}}}}),Ds=A("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),Is=A("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function id({value:e,min:t,max:n,onDrag:r,step:o,initialValue:i}){const s=d.useRef(null),a=d.useRef(null),c=d.useRef(0),l=Te("sizes","scrubberWidth"),u=Lt(({event:p,first:h,xy:[m],movement:[b],memo:y})=>{if(h){const{width:w,left:x}=s.current.getBoundingClientRect();c.current=w-parseFloat(l),y=(p==null?void 0:p.target)===a.current?e:cn((m-x)/w,t,n)}const v=y+cn(b/c.current,0,n-t);return r(vs(v,{step:o,initialValue:i})),y}),f=an(e,t,n);return g.createElement(Ds,X({ref:s},u()),g.createElement(As,null,g.createElement(Is,{style:{left:0,right:`${(1-f)*100}%`}})),g.createElement(ar,{ref:a,style:{left:`calc(${f} * (100% - ${l}))`}}))}const sd=g.memo(({label:e,onUpdate:t,step:n,innerLabelTrim:r})=>{const[o,i]=d.useState(!1),s=Lt(({active:a,delta:[c],event:l,memo:u=0})=>(i(a),u+=c/2,Math.abs(u)>=1&&(t(f=>parseFloat(f)+Math.floor(u)*n*gs(l)),u=0),u));return g.createElement(Nf,X({dragging:o,title:e.length>1?e:""},s()),e.slice(0,r))});function js({label:e,id:t,displayValue:n,onUpdate:r,onChange:o,settings:i,innerLabelTrim:s=1}){const a=s>0&&g.createElement(sd,{label:e,step:i.step,onUpdate:r,innerLabelTrim:s});return g.createElement(Wf,{id:t,value:String(n),onUpdate:r,onChange:o,innerLabel:a})}function ad(){const e=te(),{label:t,value:n,onUpdate:r,settings:o,id:i}=e,{min:s,max:a}=o,c=a!==1/0&&s!==-1/0;return g.createElement(he,{input:!0},g.createElement(we,null,t),g.createElement(od,{hasRange:c},c&&g.createElement(id,X({value:parseFloat(n),onDrag:r},o)),g.createElement(js,X({},e,{id:i,label:"value",innerLabelTrim:c?0:1}))))}const{sanitizeStep:cd}=ys,ld=U(ys,["sanitizeStep"]);var ud=D({component:ad},ld);const fd=(e,t)=>ce().schema({options:ce().passesAnyOf(ce().object(),ce().array())}).test(t),dd=(e,{values:t})=>{if(t.indexOf(e)<0)throw Error("Selected value doesn't match Select options");return e},pd=(e,{values:t})=>t.indexOf(e),hd=e=>{let{value:t,options:n}=e,r,o;return Array.isArray(n)?(o=n,r=n.map(i=>String(i))):(o=Object.values(n),r=Object.keys(n)),"value"in e?o.includes(t)||(r.unshift(String(t)),o.unshift(t)):t=o[0],Object.values(n).includes(t)||(n[String(t)]=t),{value:t,settings:{keys:r,values:o}}};var gd=Object.freeze({__proto__:null,schema:fd,sanitize:dd,format:pd,normalize:hd});const md=A("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),cr=A("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),bd=A("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${cr}:focus + &`]:{$focusStyle:""},[`${cr}:hover + &`]:{$hoverStyle:""}});function vd({displayValue:e,value:t,onUpdate:n,id:r,settings:o,disabled:i}){const{keys:s,values:a}=o,c=d.useRef();return t===a[e]&&(c.current=s[e]),g.createElement(md,null,g.createElement(cr,{id:r,value:e,onChange:l=>n(a[Number(l.currentTarget.value)]),disabled:i},s.map((l,u)=>g.createElement("option",{key:l,value:u},l))),g.createElement(bd,null,c.current),g.createElement(Ir,{toggled:!0}))}function yd(){const{label:e,value:t,displayValue:n,onUpdate:r,id:o,disabled:i,settings:s}=te();return g.createElement(he,{input:!0},g.createElement(we,null,e),g.createElement(vd,{id:o,value:t,displayValue:n,onUpdate:r,settings:s,disabled:i}))}var wd=D({component:yd},gd);const xd=e=>ce().string().test(e),Ed=e=>{if(typeof e!="string")throw Error("Invalid string");return e},$d=({value:e,editable:t=!0,rows:n=!1})=>({value:e,settings:{editable:t,rows:typeof n=="number"?n:n?5:0}});var Sd=Object.freeze({__proto__:null,schema:xd,sanitize:Ed,normalize:$d});const Cd=["displayValue","onUpdate","onChange","editable"],Od=A("div",{whiteSpace:"pre-wrap"});function Rd(e){let{displayValue:t,onUpdate:n,onChange:r,editable:o=!0}=e,i=U(e,Cd);return o?g.createElement(Ar,X({value:t,onUpdate:n,onChange:r},i)):g.createElement(Od,null,t)}function _d(){const{label:e,settings:t,displayValue:n,onUpdate:r,onChange:o}=te();return g.createElement(he,{input:!0},g.createElement(we,null,e),g.createElement(Rd,X({displayValue:n,onUpdate:r,onChange:o},t)))}var Td=D({component:_d},Sd);const Pd=e=>ce().boolean().test(e),kd=e=>{if(typeof e!="boolean")throw Error("Invalid boolean");return e};var Ad=Object.freeze({__proto__:null,schema:Pd,sanitize:kd});const Dd=A("div",{position:"relative",$flex:"",height:"$rowHeight",input:{$reset:"",height:0,width:0,opacity:0,margin:0},label:{position:"relative",$flexCenter:"",userSelect:"none",cursor:"pointer",height:"$checkboxSize",width:"$checkboxSize",backgroundColor:"$elevation3",borderRadius:"$sm",$hover:""},"input:focus + label":{$focusStyle:""},"input:focus:checked + label, input:checked + label:hover":{$hoverStyle:"$accent3"},"input + label:active":{backgroundColor:"$accent1"},"input:checked + label:active":{backgroundColor:"$accent1"},"label > svg":{display:"none",width:"90%",height:"90%",stroke:"$highlight3"},"input:checked + label":{backgroundColor:"$accent2"},"input:checked + label > svg":{display:"block"}});function Id({value:e,onUpdate:t,id:n,disabled:r}){return g.createElement(Dd,null,g.createElement("input",{id:n,type:"checkbox",checked:e,onChange:o=>t(o.currentTarget.checked),disabled:r}),g.createElement("label",{htmlFor:n},g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},g.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}function jd(){const{label:e,value:t,onUpdate:n,disabled:r,id:o}=te();return g.createElement(he,{input:!0},g.createElement(we,null,e),g.createElement(Id,{value:t,onUpdate:n,id:o,disabled:r}))}var Md=D({component:jd},Ad);const Ld=["locked"];function Nd({value:e,id:t,valueKey:n,settings:r,onUpdate:o,innerLabelTrim:i}){const s=d.useRef(e[n]);s.current=e[n];const a=d.useCallback(l=>o({[n]:ps({type:"NUMBER",value:s.current,settings:r},l)}),[o,r,n]),c=Ps({type:"NUMBER",value:e[n],settings:r,setValue:a});return g.createElement(js,{id:t,label:n,value:e[n],displayValue:c.displayValue,onUpdate:c.onUpdate,onChange:c.onChange,settings:r,innerLabelTrim:i})}const Fd=A("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});function zd(e){let{locked:t}=e,n=U(e,Ld);return g.createElement("svg",X({width:"10",height:"10",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),t?g.createElement("path",{d:"M5 4.63601C5 3.76031 5.24219 3.1054 5.64323 2.67357C6.03934 2.24705 6.64582 1.9783 7.5014 1.9783C8.35745 1.9783 8.96306 2.24652 9.35823 2.67208C9.75838 3.10299 10 3.75708 10 4.63325V5.99999H5V4.63601ZM4 5.99999V4.63601C4 3.58148 4.29339 2.65754 4.91049 1.99307C5.53252 1.32329 6.42675 0.978302 7.5014 0.978302C8.57583 0.978302 9.46952 1.32233 10.091 1.99162C10.7076 2.65557 11 3.57896 11 4.63325V5.99999H12C12.5523 5.99999 13 6.44771 13 6.99999V13C13 13.5523 12.5523 14 12 14H3C2.44772 14 2 13.5523 2 13V6.99999C2 6.44771 2.44772 5.99999 3 5.99999H4ZM3 6.99999H12V13H3V6.99999Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}):g.createElement("path",{d:"M9 3.63601C9 2.76044 9.24207 2.11211 9.64154 1.68623C10.0366 1.26502 10.6432 1 11.5014 1C12.4485 1 13.0839 1.30552 13.4722 1.80636C13.8031 2.23312 14 2.84313 14 3.63325H15C15 2.68242 14.7626 1.83856 14.2625 1.19361C13.6389 0.38943 12.6743 0 11.5014 0C10.4294 0 9.53523 0.337871 8.91218 1.0021C8.29351 1.66167 8 2.58135 8 3.63601V6H1C0.447715 6 0 6.44772 0 7V13C0 13.5523 0.447715 14 1 14H10C10.5523 14 11 13.5523 11 13V7C11 6.44772 10.5523 6 10 6H9V3.63601ZM1 7H10V13H1V7Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function jr({value:e,onUpdate:t,settings:n,innerLabelTrim:r}){const{id:o,setSettings:i}=te(),{lock:s,locked:a}=n;return g.createElement(Fd,{withLock:s},s&&g.createElement(zd,{locked:a,onClick:()=>i({locked:!a})}),Object.keys(e).map((c,l)=>g.createElement(Nd,{id:l===0?o:`${o}.${c}`,key:c,valueKey:c,value:e,settings:n[c],onUpdate:t,innerLabelTrim:r})))}const Ms=(e,t)=>{const n={};let r=0,o=1/0;Object.entries(e).forEach(([i,s])=>{n[i]=bs(D({value:s},t[i])).settings,r=Math.max(r,n[i].step),o=Math.min(o,n[i].pad)});for(let i in n){const{step:s,min:a,max:c}=t[i]||{};!isFinite(s)&&(!isFinite(a)||!isFinite(c))&&(n[i].step=r,n[i].pad=o)}return n},Bd=["lock"],Wd=["value"];function Hd(e){const t=ce().array().length(e).every.number(),n=r=>{if(!r||typeof r!="object")return!1;const o=Object.values(r);return o.length===e&&o.every(i=>isFinite(i))};return r=>t.test(r)||n(r)}function Vd(e){return Array.isArray(e)?"array":"object"}function Ot(e,t,n){return Vd(e)===t?e:t==="array"?Object.values(e):xf(e,n)}const Ud=(e,t,n)=>{const r=Ot(e,"object",t.keys);for(let s in r)r[s]=ms(r[s],t[s]);const o=Object.keys(r);let i={};if(o.length===t.keys.length)i=r;else{const s=Ot(n,"object",t.keys);if(o.length===1&&t.locked){const a=o[0],c=r[a],l=s[a],u=l!==0?c/l:1;for(let f in s)f===a?i[a]=c:i[f]=s[f]*u}else i=D(D({},s),r)}return Ot(i,t.format,t.keys)},Kd=(e,t)=>Ot(e,"object",t.keys),Gd=e=>!!e&&("step"in e||"min"in e||"max"in e);function Yd(e,t,n=[]){const{lock:r=!1}=t,o=U(t,Bd),i=Array.isArray(e)?"array":"object",s=i==="object"?Object.keys(e):n,a=Ot(e,"object",s),c=Gd(o)?s.reduce((u,f)=>Object.assign(u,{[f]:o}),{}):o,l=Ms(a,c);return{value:i==="array"?e:a,settings:D(D({},l),{},{format:i,keys:s,lock:r,locked:!1})}}function Ls(e){return{schema:Hd(e.length),normalize:t=>{let{value:n}=t,r=U(t,Wd);return Yd(n,r,e)},format:(t,n)=>Kd(t,n),sanitize:(t,n,r)=>Ud(t,n,r)}}var qd={grad:.9,turn:360,rad:360/(2*Math.PI)},Oe=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Z=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},pe=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},Ns=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Ao=function(e){return{r:pe(e.r,0,255),g:pe(e.g,0,255),b:pe(e.b,0,255),a:pe(e.a)}},Bn=function(e){return{r:Z(e.r),g:Z(e.g),b:Z(e.b),a:Z(e.a,3)}},Xd=/^#([0-9a-f]{3,8})$/i,qt=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Fs=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=Math.max(t,n,r),s=i-Math.min(t,n,r),a=s?i===t?(n-r)/s:i===n?2+(r-t)/s:4+(t-n)/s:0;return{h:60*(a<0?a+6:a),s:i?s/i*100:0,v:i/255*100,a:o}},zs=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var i=Math.floor(t),s=r*(1-n),a=r*(1-(t-i)*n),c=r*(1-(1-t+i)*n),l=i%6;return{r:255*[r,a,s,s,c,r][l],g:255*[c,r,r,a,s,s][l],b:255*[s,s,c,r,r,a][l],a:o}},Do=function(e){return{h:Ns(e.h),s:pe(e.s,0,100),l:pe(e.l,0,100),a:pe(e.a)}},Io=function(e){return{h:Z(e.h),s:Z(e.s),l:Z(e.l),a:Z(e.a,3)}},jo=function(e){return zs((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},Rt=function(e){return{h:(t=Fs(e)).h,s:(o=(200-(n=t.s))*(r=t.v)/100)>0&&o<200?n*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,r,o},Jd=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zd=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qd=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ep=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lr={string:[[function(e){var t=Xd.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Z(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?Z(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Qd.exec(e)||ep.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ao({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Jd.exec(e)||Zd.exec(e);if(!t)return null;var n,r,o=Do({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(qd[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return jo(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=o===void 0?1:o;return Oe(t)&&Oe(n)&&Oe(r)?Ao({r:Number(t),g:Number(n),b:Number(r),a:Number(i)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,o=e.a,i=o===void 0?1:o;if(!Oe(t)||!Oe(n)||!Oe(r))return null;var s=Do({h:Number(t),s:Number(n),l:Number(r),a:Number(i)});return jo(s)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,i=o===void 0?1:o;if(!Oe(t)||!Oe(n)||!Oe(r))return null;var s=function(a){return{h:Ns(a.h),s:pe(a.s,0,100),v:pe(a.v,0,100),a:pe(a.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(i)});return zs(s)},"hsv"]]},Mo=function(e,t){for(var n=0;n=.5},e.prototype.toHex=function(){return t=Bn(this.rgba),n=t.r,r=t.g,o=t.b,s=(i=t.a)<1?qt(Z(255*i)):"","#"+qt(n)+qt(r)+qt(o)+s;var t,n,r,o,i,s},e.prototype.toRgb=function(){return Bn(this.rgba)},e.prototype.toRgbString=function(){return t=Bn(this.rgba),n=t.r,r=t.g,o=t.b,(i=t.a)<1?"rgba("+n+", "+r+", "+o+", "+i+")":"rgb("+n+", "+r+", "+o+")";var t,n,r,o,i},e.prototype.toHsl=function(){return Io(Rt(this.rgba))},e.prototype.toHslString=function(){return t=Io(Rt(this.rgba)),n=t.h,r=t.s,o=t.l,(i=t.a)<1?"hsla("+n+", "+r+"%, "+o+"%, "+i+")":"hsl("+n+", "+r+"%, "+o+"%)";var t,n,r,o,i},e.prototype.toHsv=function(){return t=Fs(this.rgba),{h:Z(t.h),s:Z(t.s),v:Z(t.v),a:Z(t.a,3)};var t},e.prototype.invert=function(){return re({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),re(Wn(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),re(Wn(this.rgba,-t))},e.prototype.grayscale=function(){return re(Wn(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),re(Lo(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),re(Lo(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?re({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):Z(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=Rt(this.rgba);return typeof t=="number"?re({h:t,s:n.s,l:n.l,a:n.a}):Z(n.h)},e.prototype.isEqual=function(t){return this.toHex()===re(t).toHex()},e}(),re=function(e){return e instanceof ur?e:new ur(e)},No=[],np=function(e){e.forEach(function(t){No.indexOf(t)<0&&(t(ur,lr),No.push(t))})};function rp(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var o in n)r[n[o]]=o;var i={};e.prototype.toName=function(s){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,c,l=r[this.toHex()];if(l)return l;if(s!=null&&s.closest){var u=this.toRgb(),f=1/0,p="black";if(!i.length)for(var h in n)i[h]=new e(n[h]).toRgb();for(var m in n){var b=(a=u,c=i[m],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));b=0||(o[n]=e[n]);return o}function fr(e){var t=d.useRef(e),n=d.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var lt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:y.buttons>0)&&o.current?i(Fo(o.current,y,a.current)):b(!1)},m=function(){return b(!1)};function b(y){var v=c.current,w=dr(o.current),x=y?w.addEventListener:w.removeEventListener;x(v?"touchmove":"mousemove",h),x(v?"touchend":"mouseup",m)}return[function(y){var v=y.nativeEvent,w=o.current;if(w&&(zo(v),!function($,C){return C&&!_t($)}(v,c.current)&&w)){if(_t(v)){c.current=!0;var x=v.changedTouches||[];x.length&&(a.current=x[0].identifier)}w.focus(),i(Fo(w,v,a.current)),b(!0)}},function(y){var v=y.which||y.keyCode;v<37||v>40||(y.preventDefault(),s({left:v===39?.05:v===37?-.05:0,top:v===40?.05:v===38?-.05:0}))},b]},[s,i]),u=l[0],f=l[1],p=l[2];return d.useEffect(function(){return p},[p]),g.createElement("div",ht({},r,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:o,onKeyDown:f,tabIndex:0,role:"slider"}))}),Nt=function(e){return e.filter(Boolean).join(" ")},Nr=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,i=Nt(["react-colorful__pointer",e.className]);return g.createElement("div",{className:i,style:{top:100*o+"%",left:100*n+"%"}},g.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},oe=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},Ws=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:oe(e.h),s:oe(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:oe(o/2),a:oe(r,2)}},pr=function(e){var t=Ws(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Vn=function(e){var t=Ws(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Hs=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var i=Math.floor(t),s=r*(1-n),a=r*(1-(t-i)*n),c=r*(1-(1-t+i)*n),l=i%6;return{r:oe(255*[r,a,s,s,c,r][l]),g:oe(255*[c,r,r,a,s,s][l]),b:oe(255*[s,s,c,r,r,a][l]),a:oe(o,2)}},Vs=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=Math.max(t,n,r),s=i-Math.min(t,n,r),a=s?i===t?(n-r)/s:i===n?2+(r-t)/s:4+(t-n)/s:0;return{h:oe(60*(a<0?a+6:a)),s:oe(i?s/i*100:0),v:oe(i/255*100),a:o}},Us=g.memo(function(e){var t=e.hue,n=e.onChange,r=Nt(["react-colorful__hue",e.className]);return g.createElement("div",{className:r},g.createElement(Lr,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:lt(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":oe(t),"aria-valuemax":"360","aria-valuemin":"0"},g.createElement(Nr,{className:"react-colorful__hue-pointer",left:t/360,color:pr({h:t,s:100,v:100,a:1})})))}),Ks=g.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:pr({h:t.h,s:100,v:100,a:1})};return g.createElement("div",{className:"react-colorful__saturation",style:r},g.createElement(Lr,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:lt(t.s+100*o.left,0,100),v:lt(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+oe(t.s)+"%, Brightness "+oe(t.v)+"%"},g.createElement(Nr,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:pr(t)})))}),Fr=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Gs(e,t,n){var r=fr(n),o=d.useState(function(){return e.toHsva(t)}),i=o[0],s=o[1],a=d.useRef({color:t,hsva:i});d.useEffect(function(){if(!e.equal(t,a.current.color)){var l=e.toHsva(t);a.current={hsva:l,color:t},s(l)}},[t,e]),d.useEffect(function(){var l;Fr(i,a.current.hsva)||e.equal(l=e.fromHsva(i),a.current.color)||(a.current={hsva:i,color:l},r(l))},[i,e,r]);var c=d.useCallback(function(l){s(function(u){return Object.assign({},u,l)})},[]);return[i,c]}var op=typeof window<"u"?d.useLayoutEffect:d.useEffect,ip=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Bo=new Map,Ys=function(e){op(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Bo.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Bo.set(t,n);var r=ip();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},sp=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,i=e.onChange,s=Mr(e,["className","colorModel","color","onChange"]),a=d.useRef(null);Ys(a);var c=Gs(n,o,i),l=c[0],u=c[1],f=Nt(["react-colorful",t]);return g.createElement("div",ht({},s,{ref:a,className:f}),g.createElement(Ks,{hsva:l,onChange:u}),g.createElement(Us,{hue:l.h,onChange:u,className:"react-colorful__last-control"}))},ap=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Vn(Object.assign({},n,{a:0}))+", "+Vn(Object.assign({},n,{a:1}))+")"},i=Nt(["react-colorful__alpha",t]),s=oe(100*n.a);return g.createElement("div",{className:i},g.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),g.createElement(Lr,{onMove:function(a){r({a:a.left})},onKey:function(a){r({a:lt(n.a+a.left)})},"aria-label":"Alpha","aria-valuetext":s+"%","aria-valuenow":s,"aria-valuemin":"0","aria-valuemax":"100"},g.createElement(Nr,{className:"react-colorful__alpha-pointer",left:n.a,color:Vn(n)})))},cp=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,i=e.onChange,s=Mr(e,["className","colorModel","color","onChange"]),a=d.useRef(null);Ys(a);var c=Gs(n,o,i),l=c[0],u=c[1],f=Nt(["react-colorful",t]);return g.createElement("div",ht({},s,{ref:a,className:f}),g.createElement(Ks,{hsva:l,onChange:u}),g.createElement(Us,{hue:l.h,onChange:u}),g.createElement(ap,{hsva:l,onChange:u,className:"react-colorful__last-control"}))},lp={defaultColor:{r:0,g:0,b:0,a:1},toHsva:Vs,fromHsva:Hs,equal:Fr},up=function(e){return g.createElement(cp,ht({},e,{colorModel:lp}))},fp={defaultColor:{r:0,g:0,b:0},toHsva:function(e){return Vs({r:e.r,g:e.g,b:e.b,a:1})},fromHsva:function(e){return{r:(t=Hs(e)).r,g:t.g,b:t.b};var t},equal:Fr},dp=function(e){return g.createElement(sp,ht({},e,{colorModel:fp}))};function gt(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?i(u.value):o(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function mt(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]0)&&!(o=r.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return i}function hp(){for(var e=[],t=0;t0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function mp(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=gp.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var bp=[".DS_Store","Thumbs.db"];function vp(e){return gt(this,void 0,void 0,function(){return mt(this,function(t){return un(e)&&yp(e)?[2,$p(e.dataTransfer,e.type)]:wp(e)?[2,xp(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,Ep(e)]:[2,[]]})})}function yp(e){return un(e.dataTransfer)}function wp(e){return un(e)&&un(e.target)}function un(e){return typeof e=="object"&&e!==null}function xp(e){return hr(e.target.files).map(function(t){return Ft(t)})}function Ep(e){return gt(this,void 0,void 0,function(){var t;return mt(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Ft(r)})]}})})}function $p(e,t){return gt(this,void 0,void 0,function(){var n,r;return mt(this,function(o){switch(o.label){case 0:return e===null?[2,[]]:e.items?(n=hr(e.items).filter(function(i){return i.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(Sp))]):[3,2];case 1:return r=o.sent(),[2,Wo(qs(r))];case 2:return[2,Wo(hr(e.files).map(function(i){return Ft(i)}))]}})})}function Wo(e){return e.filter(function(t){return bp.indexOf(t.name)===-1})}function hr(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,Yo(n)];if(e.sizen)return[!1,Yo(n)]}return[!0,null]}function St(e){return e!=null}function Np(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,i=e.multiple,s=e.maxFiles;return!i&&t.length>1||i&&s>=1&&t.length>s?!1:t.every(function(a){var c=Zs(a,n),l=Ko(c,1),u=l[0],f=Qs(a,r,o),p=Ko(f,1),h=p[0];return u&&h})}function fn(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Xt(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function Xo(e){e.preventDefault()}function Fp(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function zp(e){return e.indexOf("Edge/")!==-1}function Bp(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Fp(e)||zp(e)}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),s=1;se.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rh(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}var zr=d.forwardRef(function(e,t){var n=e.children,r=dn(e,Kp),o=na(r),i=o.open,s=dn(o,Gp);return d.useImperativeHandle(t,function(){return{open:i}},[i]),g.createElement(d.Fragment,null,n(G(G({},s),{},{open:i})))});zr.displayName="Dropzone";var ta={disabled:!1,getFilesFromEvent:vp,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};zr.defaultProps=ta;zr.propTypes={children:K.func,accept:K.oneOfType([K.string,K.arrayOf(K.string)]),multiple:K.bool,preventDropOnDocument:K.bool,noClick:K.bool,noKeyboard:K.bool,noDrag:K.bool,noDragEventsBubbling:K.bool,minSize:K.number,maxSize:K.number,maxFiles:K.number,disabled:K.bool,getFilesFromEvent:K.func,onFileDialogCancel:K.func,onFileDialogOpen:K.func,useFsAccessApi:K.bool,onDragEnter:K.func,onDragLeave:K.func,onDragOver:K.func,onDrop:K.func,onDropAccepted:K.func,onDropRejected:K.func,validator:K.func};var br={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function na(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=G(G({},ta),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,i=t.maxSize,s=t.minSize,a=t.multiple,c=t.maxFiles,l=t.onDragEnter,u=t.onDragLeave,f=t.onDragOver,p=t.onDrop,h=t.onDropAccepted,m=t.onDropRejected,b=t.onFileDialogCancel,y=t.onFileDialogOpen,v=t.useFsAccessApi,w=t.preventDropOnDocument,x=t.noClick,$=t.noKeyboard,C=t.noDrag,E=t.noDragEventsBubbling,S=t.validator,k=d.useMemo(function(){return typeof y=="function"?y:Zo},[y]),z=d.useMemo(function(){return typeof b=="function"?b:Zo},[b]),R=d.useRef(null),T=d.useRef(null),P=d.useReducer(oh,br),I=Un(P,2),j=I[0],L=I[1],B=j.isFocused,W=j.isFileDialogActive,M=j.draggedFiles,H=d.useRef(typeof window<"u"&&window.isSecureContext&&v&&Wp()),J=function(){!H.current&&W&&setTimeout(function(){if(T.current){var N=T.current.files;N.length||(L({type:"closeDialog"}),z())}},300)};d.useEffect(function(){return window.addEventListener("focus",J,!1),function(){window.removeEventListener("focus",J,!1)}},[T,W,z,H]);var ie=d.useRef([]),zt=function(N){R.current&&R.current.contains(N.target)||(N.preventDefault(),ie.current=[])};d.useEffect(function(){return w&&(document.addEventListener("dragover",Xo,!1),document.addEventListener("drop",zt,!1)),function(){w&&(document.removeEventListener("dragover",Xo),document.removeEventListener("drop",zt))}},[R,w]);var Bt=d.useCallback(function(O){O.preventDefault(),O.persist(),Ze(O),ie.current=[].concat(Xp(ie.current),[O.target]),Xt(O)&&Promise.resolve(o(O)).then(function(N){fn(O)&&!E||(L({draggedFiles:N,isDragActive:!0,type:"setDraggedFiles"}),l&&l(O))})},[o,l,E]),Wt=d.useCallback(function(O){O.preventDefault(),O.persist(),Ze(O);var N=Xt(O);if(N&&O.dataTransfer)try{O.dataTransfer.dropEffect="copy"}catch{}return N&&f&&f(O),!1},[f,E]),Ht=d.useCallback(function(O){O.preventDefault(),O.persist(),Ze(O);var N=ie.current.filter(function(se){return R.current&&R.current.contains(se)}),Q=N.indexOf(O.target);Q!==-1&&N.splice(Q,1),ie.current=N,!(N.length>0)&&(L({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),Xt(O)&&u&&u(O))},[R,u,E]),qe=d.useCallback(function(O,N){var Q=[],se=[];O.forEach(function(ge){var xt=Zs(ge,n),et=Un(xt,2),_n=et[0],Tn=et[1],Pn=Qs(ge,s,i),Vt=Un(Pn,2),kn=Vt[0],An=Vt[1],Dn=S?S(ge):null;if(_n&&kn&&!Dn)Q.push(ge);else{var In=[Tn,An];Dn&&(In=In.concat(Dn)),se.push({file:ge,errors:In.filter(function(ma){return ma})})}}),(!a&&Q.length>1||a&&c>=1&&Q.length>c)&&(Q.forEach(function(ge){se.push({file:ge,errors:[Lp]})}),Q.splice(0)),L({acceptedFiles:Q,fileRejections:se,type:"setFiles"}),p&&p(Q,se,N),se.length>0&&m&&m(se,N),Q.length>0&&h&&h(Q,N)},[L,a,n,s,i,c,p,h,m,S]),Be=d.useCallback(function(O){O.preventDefault(),O.persist(),Ze(O),ie.current=[],Xt(O)&&Promise.resolve(o(O)).then(function(N){fn(O)&&!E||qe(N,O)}),L({type:"reset"})},[o,qe,E]),Ce=d.useCallback(function(){if(H.current){L({type:"openDialog"}),k();var O={multiple:a,types:Hp(n)};window.showOpenFilePicker(O).then(function(N){return o(N)}).then(function(N){qe(N,null),L({type:"closeDialog"})}).catch(function(N){Vp(N)?(z(N),L({type:"closeDialog"})):Up(N)&&(H.current=!1,T.current&&(T.current.value=null,T.current.click()))});return}T.current&&(L({type:"openDialog"}),k(),T.current.value=null,T.current.click())},[L,k,z,v,qe,n,a]),bt=d.useCallback(function(O){!R.current||!R.current.isEqualNode(O.target)||(O.key===" "||O.key==="Enter"||O.keyCode===32||O.keyCode===13)&&(O.preventDefault(),Ce())},[R,Ce]),vt=d.useCallback(function(){L({type:"focus"})},[]),yt=d.useCallback(function(){L({type:"blur"})},[]),wt=d.useCallback(function(){x||(Bp()?setTimeout(Ce,0):Ce())},[x,Ce]),fe=function(N){return r?null:N},Xe=function(N){return $?null:fe(N)},Je=function(N){return C?null:fe(N)},Ze=function(N){E&&N.stopPropagation()},On=d.useMemo(function(){return function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=O.refKey,Q=N===void 0?"ref":N,se=O.role,ge=O.onKeyDown,xt=O.onFocus,et=O.onBlur,_n=O.onClick,Tn=O.onDragEnter,Pn=O.onDragOver,Vt=O.onDragLeave,kn=O.onDrop,An=dn(O,Yp);return G(G(mr({onKeyDown:Xe(xe(ge,bt)),onFocus:Xe(xe(xt,vt)),onBlur:Xe(xe(et,yt)),onClick:fe(xe(_n,wt)),onDragEnter:Je(xe(Tn,Bt)),onDragOver:Je(xe(Pn,Wt)),onDragLeave:Je(xe(Vt,Ht)),onDrop:Je(xe(kn,Be)),role:typeof se=="string"&&se!==""?se:"button"},Q,R),!r&&!$?{tabIndex:0}:{}),An)}},[R,bt,vt,yt,wt,Bt,Wt,Ht,Be,$,C,r]),Rn=d.useCallback(function(O){O.stopPropagation()},[]),Qe=d.useMemo(function(){return function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=O.refKey,Q=N===void 0?"ref":N,se=O.onChange,ge=O.onClick,xt=dn(O,qp),et=mr({accept:n,multiple:a,type:"file",style:{display:"none"},onChange:fe(xe(se,Be)),onClick:fe(xe(ge,Rn)),tabIndex:-1},Q,T);return G(G({},et),xt)}},[T,n,a,Be,r]),Hr=M.length,Vr=Hr>0&&Np({files:M,accept:n,minSize:s,maxSize:i,multiple:a,maxFiles:c}),ga=Hr>0&&!Vr;return G(G({},j),{},{isDragAccept:Vr,isDragReject:ga,isFocused:B&&!r,getRootProps:On,getInputProps:Qe,rootRef:R,inputRef:T,open:fe(Ce)})}function oh(e,t){switch(t.type){case"focus":return G(G({},e),{},{isFocused:!0});case"blur":return G(G({},e),{},{isFocused:!1});case"openDialog":return G(G({},br),{},{isFileDialogActive:!0});case"closeDialog":return G(G({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":var n=t.isDragActive,r=t.draggedFiles;return G(G({},e),{},{draggedFiles:r,isDragActive:n});case"setFiles":return G(G({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return G({},br);default:return e}}function Zo(){}/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */var ih=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */var sh=ih;function Qo(e){return sh(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var ra=function(t){var n,r;return!(Qo(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,Qo(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */var ah=ra,Br=function(t){return ah(t)||typeof t=="function"||Array.isArray(t)};/*! + * for-in + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */var ch=function(t,n,r){for(var o in t)if(n.call(r,t[o],o,t)===!1)break},lh=Br,uh=ch;function oa(e,t){for(var n=arguments.length,r=0;++r + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */var hh=function(e,t,n,r,o){if(!gh(e)||!t)return e;if(t=Jt(t),n&&(t+="."+Jt(n)),r&&(t+="."+Jt(r)),o&&(t+="."+Jt(o)),t in e)return e[t];for(var i=t.split("."),s=i.length,a=-1;e&&++a + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */var mh=function(e,t){if(e===null||typeof e>"u")throw new TypeError("expected first argument to be an object.");if(typeof t>"u"||typeof Symbol>"u"||typeof Object.getOwnPropertySymbols!="function")return e;for(var n=Object.prototype.propertyIsEnumerable,r=Object(e),o=arguments.length,i=0;++i"u")throw new TypeError("Cannot convert undefined or null to object");ei(e)||(e={});for(var t=1;t + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */var Sh=yh,Ch=function(e,t,n){if(typeof e!="string")throw new TypeError("expected a string");typeof t=="function"&&(n=t,t=null),typeof t=="string"&&(t={sep:t});var r=Sh({sep:"."},t),o=r.quotes||['"',"'","`"],i;r.brackets===!0?i={"<":">","(":")","[":"]","{":"}"}:r.brackets&&(i=r.brackets);var s=[],a=[],c=[""],l=r.sep,u=e.length,f=-1,p;function h(){if(i&&a.length)return i[a[a.length-1]]}for(;++f + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */var _h=function(t){return typeof t<"u"&&t!==null&&(typeof t=="object"||typeof t=="function")},ti=_h,Th=function(t){ti(t)||(t={});for(var n=arguments.length,r=1;r + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */var Ah=function(t){return typeof t<"u"&&t!==null&&(typeof t=="object"||typeof t=="function")};/*! + * set-value + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */var Dh=Ch,Ih=Th,ni=ra,ri=Ah,jh=function(e,t,n){if(!ri(e)||(Array.isArray(t)&&(t=[].concat.apply([],t).join(".")),typeof t!="string"))return e;for(var r=Dh(t,{sep:".",brackets:!0}).filter(Mh),o=r.length,i=-1,s=e;++ie.filter(Boolean).join(".");function zh(e){const t=e.split(".");return[t.pop(),t.join(".")||void 0]}function Bh(e,t){return Object.entries(yf(e,t)).reduce((n,[,{value:r,disabled:o,key:i}])=>(n[i]=o?void 0:r,n),{})}function Wh(e,t){const n=d.useRef();return Tt(e,n.current)||(n.current=e),n.current}function ia(e,t){return d.useMemo(e,Wh(t))}function Hh(e){const t=d.useRef(null),n=d.useRef(null),r=d.useRef(!0);return d.useLayoutEffect(()=>{e||(t.current.style.height="0px",t.current.style.overflow="hidden")},[]),d.useEffect(()=>{if(r.current){r.current=!1;return}let o;const i=t.current,s=()=>{e&&(i.style.removeProperty("height"),i.style.removeProperty("overflow"),n.current.scrollIntoView({behavior:"smooth",block:"nearest"}))};i.addEventListener("transitionend",s,{once:!0});const{height:a}=n.current.getBoundingClientRect();return i.style.height=a+"px",e||(i.style.overflow="hidden",o=window.setTimeout(()=>i.style.height="0px",50)),()=>{i.removeEventListener("transitionend",s),clearTimeout(o)}},[e]),{wrapperRef:t,contentRef:n}}const Vh=e=>{const[t,n]=d.useState(e.getVisiblePaths());return d.useEffect(()=>{n(e.getVisiblePaths());const r=e.useStore.subscribe(e.getVisiblePaths,n,{equalityFn:bn});return()=>r()},[e]),t};function Uh(e,t,n){return e.useStore(o=>{const i=D(D({},n),o.data);return Bh(i,t)},bn)}function sa(e=3){const t=d.useRef(null),n=d.useRef(null),[r,o]=d.useState(!1),i=d.useCallback(()=>o(!0),[]),s=d.useCallback(()=>o(!1),[]);return d.useLayoutEffect(()=>{if(r){const{bottom:a,top:c,left:l}=t.current.getBoundingClientRect(),{height:u}=n.current.getBoundingClientRect(),f=a+u>window.innerHeight-40?"up":"down";n.current.style.position="fixed",n.current.style.zIndex="10000",n.current.style.left=l+"px",f==="down"?n.current.style.top=a+e+"px":n.current.style.bottom=window.innerHeight-c+e+"px"}},[e,r]),{popinRef:t,wrapperRef:n,shown:r,show:i,hide:s}}np([rp]);const Kh={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};ce.extend({color:()=>e=>re(e).isValid()});const Gh=e=>ce().color().test(e);function aa(e,{format:t,hasAlpha:n,isString:r}){const o=Kh[t]+(r&&t!=="hex"?"String":""),i=e[o]();return typeof i=="object"&&!n?wf(i,["a"]):i}const ca=(e,t)=>{const n=re(e);if(!n.isValid())throw Error("Invalid color");return aa(n,t)},Yh=(e,t)=>aa(re(e),D(D({},t),{},{isString:!0,format:"hex"})),qh=({value:e})=>{const t=tp(e),n=t==="name"?"hex":t,r=typeof e=="object"?"a"in e:t==="hex"&&e.length===8||/^(rgba)|(hsla)|(hsva)/.test(e),o={format:n,hasAlpha:r,isString:typeof e=="string"};return{value:ca(e,o),settings:o}};var Xh=Object.freeze({__proto__:null,schema:Gh,sanitize:ca,format:Yh,normalize:qh});const Jh=A("div",{position:"relative",boxSizing:"border-box",borderRadius:"$sm",overflow:"hidden",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",backgroundColor:"#fff",backgroundImage:`url('data:image/svg+xml;charset=utf-8,')`,$inputStyle:"",$hover:"",zIndex:1,variants:{active:{true:{$inputStyle:"$accent1"}}},"&::before":{content:'""',position:"absolute",top:0,bottom:0,right:0,left:0,backgroundColor:"currentColor",zIndex:1}}),Zh=A("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),Qh=A("div",{width:"$colorPickerWidth",height:"$colorPickerHeight",".react-colorful":{width:"100%",height:"100%",boxShadow:"$level2",cursor:"crosshair"},".react-colorful__saturation":{borderRadius:"$sm $sm 0 0"},".react-colorful__alpha, .react-colorful__hue":{height:10},".react-colorful__last-control":{borderRadius:"0 0 $sm $sm"},".react-colorful__pointer":{height:12,width:12}});function si(e,t){return t!=="rgb"?re(e).toRgb():e}function eg({value:e,displayValue:t,settings:n,onUpdate:r}){const{emitOnEditStart:o,emitOnEditEnd:i}=te(),{format:s,hasAlpha:a}=n,{popinRef:c,wrapperRef:l,shown:u,show:f,hide:p}=sa(),h=d.useRef(0),[m,b]=d.useState(()=>si(e,s)),y=a?up:dp,v=()=>{b(si(e,s)),f(),o()},w=()=>{p(),i(),window.clearTimeout(h.current)},x=()=>{h.current=window.setTimeout(w,500)};return d.useEffect(()=>()=>window.clearTimeout(h.current),[]),g.createElement(g.Fragment,null,g.createElement(Jh,{ref:c,active:u,onClick:()=>v(),style:{color:t}}),u&&g.createElement(Dr,null,g.createElement(Ts,{onPointerUp:w}),g.createElement(Qh,{ref:l,onMouseEnter:()=>window.clearTimeout(h.current),onMouseLeave:$=>$.buttons===0&&x()},g.createElement(y,{color:m,onChange:r}))))}function tg(){const{value:e,displayValue:t,label:n,onChange:r,onUpdate:o,settings:i}=te();return g.createElement(he,{input:!0},g.createElement(we,null,n),g.createElement(Zh,null,g.createElement(eg,{value:e,displayValue:t,onChange:r,onUpdate:o,settings:i}),g.createElement(Ar,{value:t,onChange:r,onUpdate:o})))}var ng=D({component:tg},Xh);function rg(){const{label:e,displayValue:t,onUpdate:n,settings:r}=te();return g.createElement(he,{input:!0},g.createElement(we,null,e),g.createElement(jr,{value:t,settings:r,onUpdate:n}))}var og=D({component:rg},Ls(["x","y","z"]));const ig=A("div",{$flexCenter:"",position:"relative",backgroundColor:"$elevation3",borderRadius:"$sm",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",touchAction:"none",$draggable:"",$hover:"","&:active":{cursor:"none"},"&::after":{content:'""',backgroundColor:"$accent2",height:4,width:4,borderRadius:2}}),sg=A("div",{$flexCenter:"",width:"$joystickWidth",height:"$joystickHeight",borderRadius:"$sm",boxShadow:"$level2",position:"fixed",zIndex:1e4,overflow:"hidden",$draggable:"",transform:"translate(-50%, -50%)",variants:{isOutOfBounds:{true:{backgroundColor:"$elevation1"},false:{backgroundColor:"$elevation3"}}},"> div":{position:"absolute",$flexCenter:"",borderStyle:"solid",borderWidth:1,borderColor:"$highlight1",backgroundColor:"$elevation3",width:"80%",height:"80%","&::after,&::before":{content:'""',position:"absolute",zindex:10,backgroundColor:"$highlight1"},"&::before":{width:"100%",height:1},"&::after":{height:"100%",width:1}},"> span":{position:"relative",zindex:100,width:10,height:10,backgroundColor:"$accent2",borderRadius:"50%"}});function ag({value:e,settings:t,onUpdate:n}){const r=d.useRef(),o=d.useRef(0),i=d.useRef(0),s=d.useRef(1),[a,c]=d.useState(!1),[l,u]=d.useState(!1),[f,p]=ks(),h=d.useRef(null),m=d.useRef(null);d.useLayoutEffect(()=>{if(a){const{top:P,left:I,width:j,height:L}=h.current.getBoundingClientRect();m.current.style.left=I+j/2+"px",m.current.style.top=P+L/2+"px"}},[a]);const{keys:[b,y],joystick:v}=t,w=v==="invertY"?1:-1,{[b]:{step:x},[y]:{step:$}}=t,C=Te("sizes","joystickWidth"),E=Te("sizes","joystickHeight"),S=parseFloat(C)*.8/2,k=parseFloat(E)*.8/2,z=d.useCallback(()=>{r.current||(u(!0),o.current&&p({x:o.current*S}),i.current&&p({y:i.current*-k}),r.current=window.setInterval(()=>{n(P=>{const I=x*o.current*s.current,j=w*$*i.current*s.current;return Array.isArray(P)?{[b]:P[0]+I,[y]:P[1]+j}:{[b]:P[b]+I,[y]:P[y]+j}})},16))},[S,k,n,p,x,$,b,y,w]),R=d.useCallback(()=>{window.clearTimeout(r.current),r.current=void 0,u(!1)},[]);d.useEffect(()=>{function P(I){s.current=gs(I)}return window.addEventListener("keydown",P),window.addEventListener("keyup",P),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",P),window.removeEventListener("keyup",P)}},[]);const T=Lt(({first:P,active:I,delta:[j,L],movement:[B,W]})=>{P&&c(!0);const M=Fe(B,-S,S),H=Fe(W,-k,k);o.current=Math.abs(B)>Math.abs(M)?Math.sign(B-M):0,i.current=Math.abs(W)>Math.abs(H)?Math.sign(H-W):0;let J=e[b],ie=e[y];I?(o.current||(J+=j*x*s.current,p({x:M})),i.current||(ie-=w*L*$*s.current,p({y:H})),o.current||i.current?z():R(),n({[b]:J,[y]:ie})):(c(!1),o.current=0,i.current=0,p({x:0,y:0}),R())});return g.createElement(ig,X({ref:h},T()),a&&g.createElement(Dr,null,g.createElement(sg,{ref:m,isOutOfBounds:l},g.createElement("div",null),g.createElement("span",{ref:f}))))}const cg=A("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function lg(){const{label:e,displayValue:t,onUpdate:n,settings:r}=te();return g.createElement(he,{input:!0},g.createElement(we,null,e),g.createElement(cg,{withJoystick:!!r.joystick},r.joystick&&g.createElement(ag,{value:t,settings:r,onUpdate:n}),g.createElement(jr,{value:t,settings:r,onUpdate:n})))}const ug=["joystick"],la=Ls(["x","y"]),fg=e=>{let{joystick:t=!0}=e,n=U(e,ug);const{value:r,settings:o}=la.normalize(n);return{value:r,settings:D(D({},o),{},{joystick:t})}};var dg=D(D({component:lg},la),{},{normalize:fg});const pg=e=>{if(e!==void 0){if(e instanceof File)try{return URL.createObjectURL(e)}catch{return}if(typeof e=="string"&&e.indexOf("blob:")===0)return e;throw Error("Invalid image format [undefined | blob | File].")}},hg=(e,t)=>typeof t=="object"&&"image"in t,gg=({image:e})=>({value:e});var mg=Object.freeze({__proto__:null,sanitize:pg,schema:hg,normalize:gg});const bg=A("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),vg=A("div",{$flexCenter:"",overflow:"hidden",height:"$rowHeight",background:"$elevation3",textAlign:"center",color:"inherit",borderRadius:"$sm",outline:"none",userSelect:"none",cursor:"pointer",$inputStyle:"",$hover:"",$focusWithin:"",$active:"$accent1 $elevation1",variants:{isDragAccept:{true:{$inputStyle:"$accent1",backgroundColor:"$elevation1"}}}}),yg=A("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),wg=A("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),xg=A("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),Eg=A("div",{$flexCenter:"",top:"0",right:"0",marginRight:"$sm",height:"100%",cursor:"pointer",variants:{disabled:{true:{color:"$elevation3",cursor:"default"}}},"&::after,&::before":{content:'""',position:"absolute",height:2,width:10,borderRadius:1,backgroundColor:"currentColor"},"&::after":{transform:"rotate(45deg)"},"&::before":{transform:"rotate(-45deg)"}});function $g(){const{label:e,value:t,onUpdate:n,disabled:r}=te(),{popinRef:o,wrapperRef:i,shown:s,show:a,hide:c}=sa(),l=d.useCallback(m=>{m.length&&n(m[0])},[n]),u=d.useCallback(m=>{m.stopPropagation(),n(void 0)},[n]),{getRootProps:f,getInputProps:p,isDragAccept:h}=na({maxFiles:1,accept:"image/*",onDrop:l,disabled:r});return g.createElement(he,{input:!0},g.createElement(we,null,e),g.createElement(bg,null,g.createElement(yg,{ref:o,hasImage:!!t,onPointerDown:()=>!!t&&a(),onPointerUp:c,style:{backgroundImage:t?`url(${t})`:"none"}}),s&&!!t&&g.createElement(Dr,null,g.createElement(Ts,{onPointerUp:c,style:{cursor:"pointer"}}),g.createElement(wg,{ref:i,style:{backgroundImage:`url(${t})`}})),g.createElement(vg,f({isDragAccept:h}),g.createElement("input",p()),g.createElement(xg,null,h?"drop image":"click or drop")),g.createElement(Eg,{onClick:u,disabled:!t})))}var Sg=D({component:$g},mg);const ai=ce().number(),Cg=(e,t)=>ce().array().length(2).every.number().test(e)&&ce().schema({min:ai,max:ai}).test(t),pn=e=>({min:e[0],max:e[1]}),ua=(e,{bounds:[t,n]},r)=>{const o=Array.isArray(e)?pn(e):e,i={min:r[0],max:r[1]},{min:s,max:a}=D(D({},i),o);return[Fe(Number(s),t,Math.max(t,a)),Fe(Number(a),Math.min(n,s),n)]},Og=({value:e,min:t,max:n})=>{const r={min:t,max:n},o=Ms(pn(e),{min:r,max:r}),i=[t,n],s=D(D({},o),{},{bounds:i});return{value:ua(pn(e),s,e),settings:s}};var Rg=Object.freeze({__proto__:null,schema:Cg,format:pn,sanitize:ua,normalize:Og});const _g=["value","bounds","onDrag"],Tg=["bounds"],Pg=A("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function kg(e){let{value:t,bounds:[n,r],onDrag:o}=e,i=U(e,_g);const s=d.useRef(null),a=d.useRef(null),c=d.useRef(null),l=d.useRef(0),u=Te("sizes","scrubberWidth"),f=Lt(({event:m,first:b,xy:[y],movement:[v],memo:w={}})=>{if(b){const{width:$,left:C}=s.current.getBoundingClientRect();l.current=$-parseFloat(u);const E=(m==null?void 0:m.target)===a.current||(m==null?void 0:m.target)===c.current;w.pos=cn((y-C)/$,n,r);const S=Math.abs(w.pos-t.min)-Math.abs(w.pos-t.max);w.key=S<0||S===0&&w.pos<=t.min?"min":"max",E&&(w.pos=t[w.key])}const x=w.pos+cn(v/l.current,0,r-n);return o({[w.key]:cd(x,i[w.key])}),w}),p=`calc(${an(t.min,n,r)} * (100% - ${u} - 8px) + 4px)`,h=`calc(${1-an(t.max,n,r)} * (100% - ${u} - 8px) + 4px)`;return g.createElement(Ds,X({ref:s},f()),g.createElement(As,null,g.createElement(Is,{style:{left:p,right:h}})),g.createElement(ar,{position:"left",ref:a,style:{left:p}}),g.createElement(ar,{position:"right",ref:c,style:{right:h}}))}function Ag(){const{label:e,displayValue:t,onUpdate:n,settings:r}=te(),o=U(r,Tg);return g.createElement(g.Fragment,null,g.createElement(he,{input:!0},g.createElement(we,null,e),g.createElement(Pg,null,g.createElement(kg,X({value:t},r,{onDrag:n})),g.createElement(jr,{value:t,settings:o,onUpdate:n,innerLabelTrim:0}))))}var Dg=D({component:Ag},Rg);const Ig=()=>{const e=new Map;return{on:(t,n)=>{let r=e.get(t);r===void 0&&(r=new Set,e.set(t,r)),r.add(n)},off:(t,n)=>{const r=e.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.delete(t))},emit:(t,...n)=>{const r=e.get(t);if(r!==void 0)for(const o of r)o(...n)}}},jg=["type","value"],Mg=["onChange","transient","onEditStart","onEditEnd"],Lg=function(){const t=xa(yc(()=>({data:{}}))),n=Ig();this.storeId=vf(),this.useStore=t;const r={},o=new Set;this.getVisiblePaths=()=>{const s=this.getData(),a=Object.keys(s),c=[];Object.entries(r).forEach(([u,f])=>{f.render&&a.some(p=>p.indexOf(u)===0)&&!f.render(this.get)&&c.push(u+".")});const l=[];return o.forEach(u=>{u in s&&s[u].__refCount>0&&c.every(f=>u.indexOf(f)===-1)&&(!s[u].render||s[u].render(this.get))&&l.push(u)}),l},this.setOrderedPaths=s=>{s.forEach(a=>o.add(a))},this.orderPaths=s=>(this.setOrderedPaths(s),s),this.disposePaths=s=>{t.setState(a=>{const c=a.data;return s.forEach(l=>{if(l in c){const u=c[l];u.__refCount--,u.__refCount===0&&u.type in me&&delete c[l]}}),{data:c}})},this.dispose=()=>{t.setState(()=>({data:{}}))},this.getFolderSettings=s=>r[s]||{},this.getData=()=>t.getState().data,this.addData=(s,a)=>{t.setState(c=>{const l=c.data;return Object.entries(s).forEach(([u,f])=>{let p=l[u];if(p){const{type:h,value:m}=f,b=U(f,jg);h!==p.type?_e(Y.INPUT_TYPE_OVERRIDE,h):((p.__refCount===0||a)&&Object.assign(p,b),p.__refCount++)}else l[u]=D(D({},f),{},{__refCount:1})}),{data:l}})},this.setValueAtPath=(s,a,c)=>{t.setState(l=>{const u=l.data;return ko(u[s],a,s,this,c),{data:u}})},this.setSettingsAtPath=(s,a)=>{t.setState(c=>{const l=c.data;return l[s].settings=D(D({},l[s].settings),a),{data:l}})},this.disableInputAtPath=(s,a)=>{t.setState(c=>{const l=c.data;return l[s].disabled=a,{data:l}})},this.set=(s,a)=>{t.setState(c=>{const l=c.data;return Object.entries(s).forEach(([u,f])=>{try{ko(l[u],f,void 0,void 0,a)}catch{}}),{data:l}})},this.getInput=s=>{try{return this.getData()[s]}catch{_e(Y.PATH_DOESNT_EXIST,s)}},this.get=s=>{var a;return(a=this.getInput(s))===null||a===void 0?void 0:a.value},this.emitOnEditStart=s=>{n.emit(`onEditStart:${s}`,this.get(s),s,D(D({},this.getInput(s)),{},{get:this.get}))},this.emitOnEditEnd=s=>{n.emit(`onEditEnd:${s}`,this.get(s),s,D(D({},this.getInput(s)),{},{get:this.get}))},this.subscribeToEditStart=(s,a)=>{const c=`onEditStart:${s}`;return n.on(c,a),()=>n.off(c,a)},this.subscribeToEditEnd=(s,a)=>{const c=`onEditEnd:${s}`;return n.on(c,a),()=>n.off(c,a)};const i=(s,a,c)=>{const l={};return Object.entries(s).forEach(([u,f])=>{if(u==="")return _e(Y.EMPTY_KEY);let p=Wr(a,u);if(f.type===me.FOLDER){const h=i(f.schema,p,c);Object.assign(l,h),p in r||(r[p]=f.settings)}else if(u in c)_e(Y.DUPLICATE_KEYS,u,p,c[u].path);else{const h=Of(f,u,p,l);if(h){const{type:m,options:b,input:y}=h,{onChange:v,transient:w,onEditStart:x,onEditEnd:$}=b,C=U(b,Mg);l[p]=D(D(D({type:m},C),y),{},{fromPanel:!0}),c[u]={path:p,onChange:v,transient:w,onEditStart:x,onEditEnd:$}}else _e(Y.UNKNOWN_INPUT,p,f)}}),l};this.getDataFromSchema=s=>{const a={};return[i(s,"",a),a]}},fa=new Lg,Ng={collapsed:!1};function Fg(e,t){return{type:me.FOLDER,schema:e,settings:D(D({},Ng),t)}}const ci=e=>"__levaInput"in e,zg=(e,t)=>{const n={},r=t?t.toLowerCase():null;return e.forEach(o=>{const[i,s]=zh(o);(!r||i.toLowerCase().indexOf(r)>-1)&&Fh(n,s,{[i]:{__levaInput:!0,path:o}})}),n},Bg=["type","label","path","valueKey","value","settings","setValue","disabled"];function Wg(e){let{type:t,label:n,path:r,valueKey:o,value:i,settings:s,setValue:a,disabled:c}=e,l=U(e,Bg);const{displayValue:u,onChange:f,onUpdate:p}=Ps({type:t,value:i,settings:s,setValue:a}),h=Ge[t].component;return h?g.createElement(ws.Provider,{value:D({key:o,path:r,id:""+r,label:n,displayValue:u,value:i,onChange:f,onUpdate:p,settings:s,setValue:a,disabled:c},l)},g.createElement(Kf,{disabled:c},g.createElement(h,null))):(_e(Y.NO_COMPONENT_FOR_TYPE,t,r),null)}const Hg=A("button",{display:"block",$reset:"",fontWeight:"$button",height:"$rowHeight",borderStyle:"none",borderRadius:"$sm",backgroundColor:"$elevation1",color:"$highlight1","&:not(:disabled)":{color:"$highlight3",backgroundColor:"$accent2",cursor:"pointer",$hover:"$accent3",$active:"$accent3 $accent1",$focus:""}});function Vg({onClick:e,settings:t,label:n}){const r=Mt();return g.createElement(he,null,g.createElement(Hg,{disabled:t.disabled,onClick:()=>e(r.get)},n))}const Ug=A("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),Kg=A("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),Gg=({label:e,opts:t})=>{let n=typeof e=="string"&&e.trim()===""?null:e,r=t;return typeof t.opts=="object"&&(r.label!==void 0&&(n=t.label),r=t.opts),{label:n,opts:r}};function Yg(e){const{label:t,opts:n}=Gg(e),r=Mt();return g.createElement(he,{input:!!t},t&&g.createElement(we,null,t),g.createElement(Ug,null,Object.entries(n).map(([o,i])=>g.createElement(Kg,{key:o,onClick:()=>i(r.get)},o))))}const qg=A("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),da=100;function Xg(e,t){e.push(t),e.length>da&&e.shift()}const Jg=d.forwardRef(function({initialValue:e},t){const n=Te("colors","highlight3"),r=Te("colors","elevation2"),o=Te("colors","highlight1"),[i,s]=d.useMemo(()=>[re(o).alpha(.4).toRgbString(),re(o).alpha(.1).toRgbString()],[o]),a=d.useRef([e]),c=d.useRef(e),l=d.useRef(e),u=d.useRef(),f=d.useCallback((m,b)=>{if(!m)return;const{width:y,height:v}=m,w=new Path2D,x=y/da,$=v*.05;for(let S=0;S({frame:m=>{(c.current===void 0||ml.current)&&(l.current=m),Xg(a.current,m),u.current=requestAnimationFrame(()=>f(p.current,h.current))}}),[p,h,f]),d.useEffect(()=>()=>cancelAnimationFrame(u.current),[]),g.createElement(qg,{ref:p})}),li=e=>Number.isFinite(e)?e.toPrecision(2):e.toString(),Zg=d.forwardRef(function({initialValue:e},t){const[n,r]=d.useState(li(e));return d.useImperativeHandle(t,()=>({frame:o=>r(li(o))}),[]),g.createElement("div",null,n)});function ui(e){return typeof e=="function"?e():e.current}function Qg({label:e,objectOrFn:t,settings:n}){const r=d.useRef(),o=d.useRef(ui(t));return d.useEffect(()=>{const i=window.setInterval(()=>{var s;document.hidden||(s=r.current)===null||s===void 0||s.frame(ui(t))},n.interval);return()=>window.clearInterval(i)},[t,n.interval]),g.createElement(he,{input:!0},g.createElement(we,{align:"top"},e),n.graph?g.createElement(Jg,{ref:r,initialValue:o.current}):g.createElement(Zg,{ref:r,initialValue:o.current}))}const em=["type","label","key"],tm={[me.BUTTON]:Vg,[me.BUTTON_GROUP]:Yg,[me.MONITOR]:Qg},nm=g.memo(({path:e})=>{const[t,{set:n,setSettings:r,disable:o,storeId:i,emitOnEditStart:s,emitOnEditEnd:a}]=rd(e);if(!t)return null;const{type:c,label:l,key:u}=t,f=U(t,em);if(c in me){const p=tm[c];return g.createElement(p,X({label:l,path:e},f))}return c in Ge?g.createElement(Wg,X({key:i+e,type:c,label:l,storeId:i,path:e,valueKey:u,setValue:n,setSettings:r,disable:o,emitOnEditStart:s,emitOnEditEnd:a},f)):(uf(Y.UNSUPPORTED_INPUT,c,e),null)});function rm({toggle:e,toggled:t,name:n}){return g.createElement(Hf,{onClick:()=>e()},g.createElement(Ir,{toggled:t}),g.createElement("div",null,n))}const om=({name:e,path:t,tree:n})=>{const r=Mt(),o=Wr(t,e),{collapsed:i,color:s}=r.getFolderSettings(o),[a,c]=d.useState(!i),l=d.useRef(null),u=Te("colors","folderWidgetColor"),f=Te("colors","folderTextColor");return d.useLayoutEffect(()=>{l.current.style.setProperty("--leva-colors-folderWidgetColor",s||u),l.current.style.setProperty("--leva-colors-folderTextColor",s||f)},[s,u,f]),g.createElement(ln,{ref:l},g.createElement(rm,{name:e,toggled:a,toggle:()=>c(p=>!p)}),g.createElement(pa,{parent:o,tree:n,toggled:a}))},pa=g.memo(({isRoot:e=!1,fill:t=!1,flat:n=!1,parent:r,tree:o,toggled:i})=>{const{wrapperRef:s,contentRef:a}=Hh(i),c=Mt(),l=([f,p])=>{var h;return(ci(p)?(h=c.getInput(p.path))===null||h===void 0?void 0:h.order:c.getFolderSettings(Wr(r,f)).order)||0},u=Object.entries(o).sort((f,p)=>l(f)-l(p));return g.createElement(ir,{ref:s,isRoot:e,fill:t,flat:n},g.createElement(Os,{ref:a,isRoot:e,toggled:i},u.map(([f,p])=>ci(p)?g.createElement(nm,{key:p.path,valueKey:p.valueKey,path:p.path}):g.createElement(om,{key:f,name:f,path:r,tree:p}))))}),im=A("div",{position:"relative",fontFamily:"$mono",fontSize:"$root",color:"$rootText",backgroundColor:"$elevation1",variants:{fill:{false:{position:"fixed",top:"10px",right:"10px",zIndex:1e3,width:"$rootWidth"},true:{position:"relative",width:"100%"}},flat:{false:{borderRadius:"$lg",boxShadow:"$level1"}},oneLineLabels:{true:{[`${_s}`]:{gridTemplateColumns:"auto",gridAutoColumns:"minmax(max-content, 1fr)",gridAutoRows:"minmax($sizes$rowHeight), auto)",rowGap:0,columnGap:0,marginTop:"$rowGap"}}},hideTitleBar:{true:{$$titleBarHeight:"0px"},false:{$$titleBarHeight:"$sizes$titleBarHeight"}}},"&,*,*:after,*:before":{boxSizing:"border-box"},"*::selection":{backgroundColor:"$accent2"}}),ha=40,hn=A("i",{$flexCenter:"",width:ha,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),sm=A("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),am=A("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${hn}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),cm=A("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),lm=A("div",{touchAction:"none",$flexCenter:"",flex:1,"> svg":{fill:"$highlight1"},color:"$highlight1",variants:{drag:{true:{$draggable:"","> svg":{transition:"fill 250ms ease"},"&:hover":{color:"$highlight3"},"&:hover > svg":{fill:"$highlight3"}}},filterEnabled:{false:{paddingRight:ha}}}}),um=g.forwardRef(({setFilter:e,toggle:t},n)=>{const[r,o]=d.useState(""),i=d.useMemo(()=>hs(e,250),[e]),s=()=>{e(""),o("")},a=c=>{const l=c.currentTarget.value;t(!0),o(l)};return d.useEffect(()=>{i(r)},[r,i]),g.createElement(g.Fragment,null,g.createElement(cm,{ref:n,value:r,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:c=>c.stopPropagation(),onChange:a}),g.createElement(hn,{onClick:()=>s(),style:{visibility:r?"visible":"hidden"}},g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},g.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))))});function fm({setFilter:e,onDrag:t,onDragStart:n,onDragEnd:r,toggle:o,toggled:i,title:s,drag:a,filterEnabled:c,from:l}){const[u,f]=d.useState(!1),p=d.useRef(null);d.useEffect(()=>{var m,b;u?(m=p.current)===null||m===void 0||m.focus():(b=p.current)===null||b===void 0||b.blur()},[u]);const h=Lt(({offset:[m,b],first:y,last:v})=>{t({x:m,y:b}),y&&n({x:m,y:b}),v&&r({x:m,y:b})},{filterTaps:!0,from:({offset:[m,b]})=>[(l==null?void 0:l.x)||m,(l==null?void 0:l.y)||b]});return d.useEffect(()=>{const m=b=>{b.key==="L"&&b.shiftKey&&b.metaKey&&f(y=>!y)};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[]),g.createElement(g.Fragment,null,g.createElement(sm,{mode:a?"drag":void 0},g.createElement(hn,{active:!i,onClick:()=>o()},g.createElement(Ir,{toggled:i,width:12,height:8})),g.createElement(lm,X({},a?h():{},{drag:a,filterEnabled:c}),s===void 0&&a?g.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},g.createElement("circle",{cx:"2",cy:"2",r:"2"}),g.createElement("circle",{cx:"14",cy:"2",r:"2"}),g.createElement("circle",{cx:"26",cy:"2",r:"2"}),g.createElement("circle",{cx:"2",cy:"12",r:"2"}),g.createElement("circle",{cx:"14",cy:"12",r:"2"}),g.createElement("circle",{cx:"26",cy:"12",r:"2"})):s),c&&g.createElement(hn,{active:u,onClick:()=>f(m=>!m)},g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},g.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),g.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-13a4 4 0 00-3.446 6.032l-2.261 2.26a1 1 0 101.414 1.415l2.261-2.261A4 4 0 1011 5z",clipRule:"evenodd"})))),g.createElement(am,{toggled:u},g.createElement(um,{ref:p,setFilter:e,toggle:o})))}const dm=["store","hidden","theme","collapsed"];function pm(e){let{store:t,hidden:n=!1,theme:r,collapsed:o=!1}=e,i=U(e,dm);const s=ia(()=>Lf(r),[r]),[a,c]=d.useState(!o),l=typeof o=="object"?!o.collapsed:a,u=d.useMemo(()=>typeof o=="object"?f=>{typeof f=="function"?o.onChange(!f(!o.collapsed)):o.onChange(!f)}:c,[o]);return!t||n?null:g.createElement(kr.Provider,{value:s},g.createElement(hm,X({store:t},i,{toggled:l,setToggle:u,rootClass:s.className})))}const hm=g.memo(({store:e,rootClass:t,fill:n=!1,flat:r=!1,neverHide:o=!1,oneLineLabels:i=!1,titleBar:s={title:void 0,drag:!0,filter:!0,position:void 0,onDrag:void 0,onDragStart:void 0,onDragEnd:void 0},hideCopyButton:a=!1,toggled:c,setToggle:l})=>{var u,f;const p=Vh(e),[h,m]=d.useState(""),b=d.useMemo(()=>zg(p,h),[p,h]),[y,v]=ks(),w=o||p.length>0,x=typeof s=="object"&&s.title||void 0,$=typeof s=="object"&&(u=s.drag)!==null&&u!==void 0?u:!0,C=typeof s=="object"&&(f=s.filter)!==null&&f!==void 0?f:!0,E=typeof s=="object"&&s.position||void 0,S=typeof s=="object"&&s.onDrag||void 0,k=typeof s=="object"&&s.onDragStart||void 0,z=typeof s=="object"&&s.onDragEnd||void 0;return g.useEffect(()=>{v({x:E==null?void 0:E.x,y:E==null?void 0:E.y})},[E,v]),Mf(),g.createElement(Es.Provider,{value:{hideCopyButton:a}},g.createElement(im,{ref:y,className:t,fill:n,flat:r,oneLineLabels:i,hideTitleBar:!s,style:{display:w?"block":"none"}},s&&g.createElement(fm,{onDrag:R=>{v(R),S==null||S(R)},onDragStart:R=>k==null?void 0:k(R),onDragEnd:R=>z==null?void 0:z(R),setFilter:m,toggle:R=>l(T=>R??!T),toggled:c,title:x,drag:$,filterEnabled:C,from:E}),w&&g.createElement(xs.Provider,{value:e},g.createElement(pa,{isRoot:!0,fill:n,flat:r,tree:b,toggled:c}))))}),gm=["isRoot"];let gn=!1,We=null;function mm(e){let{isRoot:t=!1}=e,n=U(e,gm);return d.useEffect(()=>(gn=!0,!t&&We&&(We.remove(),We=null),()=>{t||(gn=!1)}),[t]),g.createElement(pm,X({store:fa},n))}function bm(e){d.useEffect(()=>{e&&!gn&&(We||(We=document.getElementById("leva__root")||Object.assign(document.createElement("div"),{id:"leva__root"}),document.body&&(document.body.appendChild(We),_f(g.createElement(mm,{isRoot:!0}),We))),gn=!0)},[e])}function vm(e,t,n,r,o){let i,s,a,c,l;return typeof e=="string"?(s=e,i=t,Array.isArray(n)&&(l=n)):(i=e,Array.isArray(t)?l=t:(c=t,l=n)),{schema:i,folderName:s,folderSettings:a,hookSettings:c,deps:l||[]}}function Pm(e,t,n,r,o){const{folderName:i,schema:s,folderSettings:a,hookSettings:c,deps:l}=vm(e,t,n),u=typeof s=="function",f=d.useRef(!1),p=d.useRef(!0),h=ia(()=>{f.current=!0;const T=typeof s=="function"?s():s;return i?{[i]:Fg(T,a)}:T},l),m=!(c!=null&&c.store);bm(m);const[b]=d.useState(()=>(c==null?void 0:c.store)||fa),[y,v]=d.useMemo(()=>b.getDataFromSchema(h),[b,h]),[w,x,$,C,E]=d.useMemo(()=>{const T=[],P=[],I={},j={},L={};return Object.values(v).forEach(({path:B,onChange:W,onEditStart:M,onEditEnd:H,transient:J})=>{T.push(B),W?(I[B]=W,J||P.push(B)):P.push(B),M&&(j[B]=M),H&&(L[B]=H)}),[T,P,I,j,L]},[v]),S=d.useMemo(()=>b.orderPaths(w),[w,b]),k=Uh(b,x,y),z=d.useCallback(T=>{const P=Object.entries(T).reduce((I,[j,L])=>Object.assign(I,{[v[j].path]:L}),{});b.set(P,!1)},[b,v]),R=d.useCallback(T=>b.get(v[T].path),[b,v]);return d.useEffect(()=>{const T=!p.current&&f.current;return b.addData(y,T),p.current=!1,f.current=!1,()=>b.disposePaths(S)},[b,S,y]),d.useEffect(()=>{const T=[];return Object.entries($).forEach(([P,I])=>{I(b.get(P),P,D({initial:!0,get:b.get},b.getInput(P)));const j=b.useStore.subscribe(L=>{const B=L.data[P];return[B.disabled?void 0:B.value,B]},([L,B])=>I(L,P,D({initial:!1,get:b.get},B)),{equalityFn:bn});T.push(j)}),()=>T.forEach(P=>P())},[b,$]),d.useEffect(()=>{const T=[];return Object.entries(C).forEach(([P,I])=>T.push(b.subscribeToEditStart(P,I))),Object.entries(E).forEach(([P,I])=>T.push(b.subscribeToEditEnd(P,I))),()=>T.forEach(P=>P())},[C,E,b]),u?[k,z,R]:k}De(ye.SELECT,wd);De(ye.IMAGE,Sg);De(ye.NUMBER,ud);De(ye.COLOR,ng);De(ye.STRING,Td);De(ye.BOOLEAN,Md);De(ye.INTERVAL,Dg);De(ye.VECTOR3D,og);De(ye.VECTOR2D,dg);export{Sm as G,$m as T,Pm as u}; diff --git a/example/bundle/assets/lil-gui.module.min-Bc0DeA9g.js b/example/bundle/assets/lil-gui.module.min-Bc0DeA9g.js new file mode 100644 index 000000000..428c5fdf0 --- /dev/null +++ b/example/bundle/assets/lil-gui.module.min-Bc0DeA9g.js @@ -0,0 +1,10 @@ +/** + * lil-gui + * https://lil-gui.georgealways.com + * @version 0.17.0 + * @author George Michael Brower + * @license MIT + */class u{constructor(t,i,e,n,a="div"){this.parent=t,this.object=i,this.property=e,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(n),this.$name=document.createElement("div"),this.$name.classList.add("name"),u.nextNameID=u.nextNameID||0,this.$name.id="lil-gui-name-"+ ++u.nextNameID,this.$widget=document.createElement(a),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(e)}name(t){return this._name=t,this.$name.innerHTML=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled||(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t)),this}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(t){const i=this.parent.add(this.object,this.property,t);return i.name(this._name),this.destroy(),i}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.object[this.property]=t,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class C extends u{constructor(t,i,e){super(t,i,e,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function w(l){let t,i;return(t=l.match(/(#|0x)?([a-f0-9]{6})/i))?i=t[2]:(t=l.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?i=parseInt(t[1]).toString(16).padStart(2,0)+parseInt(t[2]).toString(16).padStart(2,0)+parseInt(t[3]).toString(16).padStart(2,0):(t=l.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(i=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),!!i&&"#"+i}const k={isPrimitive:!0,match:l=>typeof l=="string",fromHexString:w,toHexString:w},m={isPrimitive:!0,match:l=>typeof l=="number",fromHexString:l=>parseInt(l.substring(1),16),toHexString:l=>"#"+l.toString(16).padStart(6,0)},L={isPrimitive:!1,match:Array.isArray,fromHexString(l,t,i=1){const e=m.fromHexString(l);t[0]=(e>>16&255)/255*i,t[1]=(e>>8&255)/255*i,t[2]=(255&e)/255*i},toHexString:([l,t,i],e=1)=>m.toHexString(l*(e=255/e)<<16^t*e<<8^i*e<<0)},S={isPrimitive:!1,match:l=>Object(l)===l,fromHexString(l,t,i=1){const e=m.fromHexString(l);t.r=(e>>16&255)/255*i,t.g=(e>>8&255)/255*i,t.b=(255&e)/255*i},toHexString:({r:l,g:t,b:i},e=1)=>m.toHexString(l*(e=255/e)<<16^t*e<<8^i*e<<0)},D=[k,m,L,S];class F extends u{constructor(t,i,e,n){var a;super(t,i,e,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(a=this.initialValue,D.find(r=>r.match(a))),this._rgbScale=n,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const r=w(this.$text.value);r&&this._setValueFromHexString(r)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){const i=this._format.fromHexString(t);this.setValue(i)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class f extends u{constructor(t,i,e){super(t,i,e,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",n=>{n.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class V extends u{constructor(t,i,e,n,a,r){super(t,i,e,"number"),this._initInput(),this.min(n),this.max(a);const d=r!==void 0;this.step(d?r:this._getImplicitStep(),d),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,i=!0){return this._step=t,this._stepExplicit=i,this}updateDisplay(){const t=this.getValue();if(this._hasSlider){let i=(t-this._min)/(this._max-this._min);i=Math.max(0,Math.min(i,1)),this.$fill.style.width=100*i+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const t=s=>{const p=parseFloat(this.$input.value);isNaN(p)||(this._snapClampSetValue(p+s),this.$input.value=this.getValue())};let i,e,n,a,r,d=!1;const h=s=>{if(d){const p=s.clientX-i,o=s.clientY-e;Math.abs(o)>5?(s.preventDefault(),this.$input.blur(),d=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(p)>5&&c()}if(!d){const p=s.clientY-n;r-=p*this._step*this._arrowKeyMultiplier(s),a+r>this._max?r=this._max-a:a+r{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",c)};this.$input.addEventListener("input",()=>{let s=parseFloat(this.$input.value);isNaN(s)||(this._stepExplicit&&(s=this._snap(s)),this.setValue(this._clamp(s)))}),this.$input.addEventListener("keydown",s=>{s.code==="Enter"&&this.$input.blur(),s.code==="ArrowUp"&&(s.preventDefault(),t(this._step*this._arrowKeyMultiplier(s))),s.code==="ArrowDown"&&(s.preventDefault(),t(this._step*this._arrowKeyMultiplier(s)*-1))}),this.$input.addEventListener("wheel",s=>{this._inputFocused&&(s.preventDefault(),t(this._step*this._normalizeMouseWheel(s)))},{passive:!1}),this.$input.addEventListener("mousedown",s=>{i=s.clientX,e=n=s.clientY,d=!0,a=this.getValue(),r=0,window.addEventListener("mousemove",h),window.addEventListener("mouseup",c)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const t=o=>{const g=this.$slider.getBoundingClientRect();let b=(x=o,v=g.left,y=g.right,A=this._min,_=this._max,(x-v)/(y-v)*(_-A)+A);var x,v,y,A,_;this._snapClampSetValue(b)},i=o=>{t(o.clientX)},e=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",e)};let n,a,r=!1;const d=o=>{o.preventDefault(),this._setDraggingStyle(!0),t(o.touches[0].clientX),r=!1},h=o=>{if(r){const g=o.touches[0].clientX-n,b=o.touches[0].clientY-a;Math.abs(g)>Math.abs(b)?d(o):(window.removeEventListener("touchmove",h),window.removeEventListener("touchend",c))}else o.preventDefault(),t(o.touches[0].clientX)},c=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",h),window.removeEventListener("touchend",c)},s=this._callOnFinishChange.bind(this);let p;this.$slider.addEventListener("mousedown",o=>{this._setDraggingStyle(!0),t(o.clientX),window.addEventListener("mousemove",i),window.addEventListener("mouseup",e)}),this.$slider.addEventListener("touchstart",o=>{o.touches.length>1||(this._hasScrollBar?(n=o.touches[0].clientX,a=o.touches[0].clientY,r=!0):d(o),window.addEventListener("touchmove",h,{passive:!1}),window.addEventListener("touchend",c))},{passive:!1}),this.$slider.addEventListener("wheel",o=>{if(Math.abs(o.deltaX)this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){const t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class M extends u{constructor(t,i,e,n){super(t,i,e,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(n)?n:Object.values(n),this._names=Array.isArray(n)?n:Object.keys(n),this._names.forEach(a=>{const r=document.createElement("option");r.innerHTML=a,this.$select.appendChild(r)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const t=this.getValue(),i=this._values.indexOf(t);return this.$select.selectedIndex=i,this.$display.innerHTML=i===-1?t:this._names[i],this}}class H extends u{constructor(t,i,e){super(t,i,e,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",n=>{n.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let $=!1;class E{constructor({parent:t,autoPlace:i=t===void 0,container:e,width:n,title:a="Controls",injectStyles:r=!0,touchStyles:d=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",h=>{h.code!=="Enter"&&h.code!=="Space"||(h.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(a),d&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!$&&r&&(function(h){const c=document.createElement("style");c.innerHTML=h;const s=document.querySelector("head link[rel=stylesheet], head style");s?document.head.insertBefore(c,s):document.head.appendChild(c)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),$=!0),e?e.appendChild(this.domElement):i&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),n&&this.domElement.style.setProperty("--width",n+"px"),this.domElement.addEventListener("keydown",h=>h.stopPropagation()),this.domElement.addEventListener("keyup",h=>h.stopPropagation())}add(t,i,e,n,a){if(Object(e)===e)return new M(this,t,i,e);const r=t[i];switch(typeof r){case"number":return new V(this,t,i,e,n,a);case"boolean":return new C(this,t,i);case"string":return new H(this,t,i);case"function":return new f(this,t,i)}console.error(`gui.add failed + property:`,i,` + object:`,t,` + value:`,r)}addColor(t,i,e=1){return new F(this,t,i,e)}addFolder(t){return new E({parent:this,title:t})}load(t,i=!0){return t.controllers&&this.controllers.forEach(e=>{e instanceof f||e._name in t.controllers&&e.load(t.controllers[e._name])}),i&&t.folders&&this.folders.forEach(e=>{e._title in t.folders&&e.load(t.folders[e._title])}),this}save(t=!0){const i={controllers:{},folders:{}};return this.controllers.forEach(e=>{if(!(e instanceof f)){if(e._name in i.controllers)throw new Error(`Cannot save GUI with duplicate property "${e._name}"`);i.controllers[e._name]=e.save()}}),t&&this.folders.forEach(e=>{if(e._title in i.folders)throw new Error(`Cannot save GUI with duplicate folder "${e._title}"`);i.folders[e._title]=e.save()}),i}open(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const i=this.$children.clientHeight;this.$children.style.height=i+"px",this.domElement.classList.add("transition");const e=a=>{a.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",e))};this.$children.addEventListener("transitionend",e);const n=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame(()=>{this.$children.style.height=n+"px"})}),this}title(t){return this._title=t,this.$title.innerHTML=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(i=>i.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),this._onChange!==void 0&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(i=>{t=t.concat(i.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(i=>{t=t.concat(i.foldersRecursive())}),t}}export{E as g}; diff --git a/example/bundle/assets/mars-CdKTnHSf.js b/example/bundle/assets/mars-CdKTnHSf.js new file mode 100644 index 000000000..0ab18fd36 --- /dev/null +++ b/example/bundle/assets/mars-CdKTnHSf.js @@ -0,0 +1 @@ +import{ag as _,S as h,W as x,a as P,D as S,A as B,G as T}from"./three.module-CA-qMkP1.js";import{F as y,d as m}from"./FlyOrbitControls-BAcl0bbv.js";import{g as C}from"./lil-gui.module.min-Bc0DeA9g.js";import{T as p}from"./TilesRenderer-5XUDbyI2.js";import"./EllipsoidRegionHelper-CaOebIdf.js";import"./EllipsoidRegion-CSZafkN2.js";import"./Ellipsoid-_mEueZip.js";import"./OrbitControls-BpFvfpv4.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";let t,n,r,o,e,i;const a={errorTarget:12,displayBoxBounds:!1,fog:!1};D();g();function D(){const u=new _(14208704,.0075,250);r=new h,o=new x({antialias:!0}),o.setPixelRatio(window.devicePixelRatio),o.setSize(window.innerWidth,window.innerHeight),o.setClearColor(14208704),document.body.appendChild(o.domElement),o.domElement.tabIndex=1,t=new P(60,window.innerWidth/window.innerHeight,1,4e3),t.position.set(20,10,20),n=new y(t,o.domElement),n.screenSpacePanning=!1,n.minDistance=1,n.maxDistance=2e3,n.maxPolarAngle=Math.PI/2,n.baseSpeed=.1,n.fastSpeed=.2;const l=new S(16777215);l.position.set(1,2,3),r.add(l);const w=new B(16777215,.2);r.add(w);const d=new T;d.rotation.set(Math.PI/2,0,0),r.add(d),e=new p("https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize_tileset.json"),e.registerPlugin(new m),e.fetchOptions.mode="cors",e.lruCache.minSize=900,e.lruCache.maxSize=1300,e.errorTarget=12,i=new p("https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_sky/0528_0260184_to_s64o256_sky_tileset.json"),i.registerPlugin(new m),i.fetchOptions.mode="cors",i.lruCache=e.lruCache,d.add(e.group,i.group),c(),window.addEventListener("resize",c,!1);const s=new C;s.add(a,"fog").onChange(f=>{r.fog=f?u:null}),s.add(a,"displayBoxBounds"),s.add(a,"errorTarget",0,100),s.open()}function c(){t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix(),o.setSize(window.innerWidth,window.innerHeight),o.setPixelRatio(window.devicePixelRatio)}function g(){requestAnimationFrame(g),t.updateMatrixWorld(),e.errorTarget=a.errorTarget,e.getPluginByName("DEBUG_TILES_PLUGIN").displayBoxBounds=a.displayBoxBounds,i.getPluginByName("DEBUG_TILES_PLUGIN").displayBoxBounds=a.displayBoxBounds,e.setCamera(t),e.setResolutionFromRenderer(t,o),e.update(),i.setCamera(t),i.setResolutionFromRenderer(t,o),i.update(),o.render(r,t)} diff --git a/example/bundle/assets/metadata-CarZlTVb.js b/example/bundle/assets/metadata-CarZlTVb.js new file mode 100644 index 000000000..62338b192 --- /dev/null +++ b/example/bundle/assets/metadata-CarZlTVb.js @@ -0,0 +1,172 @@ +import{W as Y,S as G,a as $,D as j,A as V,G as N,V as W,R as k,k as C,ap as X,d as z}from"./three.module-CA-qMkP1.js";import{G as O}from"./GLTFLoader-JNhhxs0g.js";import{g as B}from"./lil-gui.module.min-Bc0DeA9g.js";import{E as K}from"./EnvironmentControls-7w_Q0bky.js";import{T as q}from"./TilesRenderer-5XUDbyI2.js";import{C as Z}from"./CesiumIonAuthPlugin-IKQrMOf_.js";import{G as J,a as Q}from"./GLTFMeshFeaturesExtension-CLQL6scj.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./Ellipsoid-_mEueZip.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";import"./GoogleCloudAuthPlugin-B6MTG2Cr.js";const ee=i=>class extends i{get featureTexture(){return this.uniforms.featureTexture.value}set featureTexture(e){const t=this.uniforms.featureTexture.value;t!==e&&t&&t.dispose(),this.uniforms.featureTexture.value=e}get nullFeatureId(){return this.uniforms.nullFeatureId.value}set nullFeatureId(e){e<0||e===null||e===void 0?(this.uniforms.nullFeatureId.value=null,this.setDefine("USE_NULL_FEATURE",0)):(this.uniforms.nullFeatureId.value=e,this.setDefine("USE_NULL_FEATURE",1))}get highlightFeatureId(){return this.uniforms.highlightFeatureId.value}set highlightFeatureId(e){e==null?(this.uniforms.highlightFeatureId.value=null,this.setDefine("USE_HIGHLIGHT_FEATURE",0)):(this.uniforms.highlightFeatureId.value=e,this.setDefine("USE_HIGHLIGHT_FEATURE",1))}constructor(...e){super(...e),this.isMeshFeaturesMaterial=!0,this.uniforms={featureChannelsLength:{value:0},featureChannels:{value:new Array(4).fill(0)},featureTexture:{value:null},nullFeatureId:{value:null},highlightFeatureId:{value:-1}},Object.assign(this.defines,{FEATURE_TYPE:0,USE_HIGHLIGHT_FEATURE:0,USE_NULL_FEATURE:0,FEATURE_ATTR:"",FEATURE_TEXTURE_ATTR:"uv"}),this.addEventListener("dispose",()=>{this.featureTexture&&this.featureTexture.dispose()})}copy(e){const t=this.defines;if(super.copy(e),e.defines&&Object.assign(this.defines,t,e.defines),e.uniforms)for(const r in this.uniforms){const n=e.uniforms[r].value;Array.isArray(n)?this.uniforms[r].value=n.slice():this.uniforms[r].value=n}this.needsUpdate=!0}setDefine(e,t){const r=this.defines;r[e]!==t&&(this.needsUpdate=!0),t===null?delete r[e]:r[e]=t}setFromMeshFeatures(e,t){let r=null;typeof t=="number"?r=e.getFeatureInfo()[t]||null:typeof t=="string"&&(r=e.getFeatureInfo().find(n=>n.label===t)||null),r===null?(this.setDefine("FEATURE_TYPE",0),this.featureTexture=null):"attribute"in r?this._setAttributeFeature(r.attribute):"texture"in r?this._setTextureFeature(e.textures[r.texture.index],r.texture.texCoord,r.texture.channels):this._setAttributeFeature(null),r!==null&&(this.nullFeatureId=r.nullFeatureId==null?null:r.nullFeatureId)}disableFeatureDisplay(){this.setDefine("FEATURE_TYPE",0),this.featureTexture=null}_setTextureFeature(e,t,r){const n=this.uniforms;this.setDefine("FEATURE_TYPE",3),t===0?(this.setDefine("FEATURE_TEXTURE_ATTR","uv"),this.setDefine("USE_UV","")):(this.setDefine("FEATURE_TEXTURE_ATTR",`uv${t}`),this.setDefine(`USE_UV${t}`,"")),t!==0&&this.setDefine("USE_UV",null),t!==1&&this.setDefine("USE_UV1",null),t!==2&&this.setDefine("USE_UV2",null),t!==3&&this.setDefine("USE_UV3",null),n.featureChannelsLength.value=r.length,n.featureChannels.value=[...r],this.featureTexture=e}_setAttributeFeature(e=null){e===null?this.setDefine("FEATURE_TYPE",1):(this.setDefine("FEATURE_TYPE",2),this.setDefine("FEATURE_ATTR",`_feature_id_${e}`)),this.featureTexture=null}customProgramCacheKey(){const e=this.defines;return`${e.FEATURE_TYPE}|${e.USE_HIGHLIGHT_FEATURE}|${e.USE_NULL_FEATURE}|${e.FEATURE_ATTR}|${e.FEATURE_TEXTURE_ATTR}`}onBeforeCompile(e){e.uniforms={...e.uniforms,...this.uniforms},e.defines=this.defines,e.vertexShader=e.vertexShader.replace(/^/,t=>` + // texture + #if FEATURE_TYPE == 3 + + varying vec2 _feature_uv; + + // attribute + #elif FEATURE_TYPE == 2 + + attribute float FEATURE_ATTR; + flat varying uint _feature_attr; + + // implicit + #elif FEATURE_TYPE == 1 + + flat varying uint _feature_attr; + + #endif + + ${t} + `).replace(/void main\(\) {/,t=>` + ${t} + + // texture + #if FEATURE_TYPE == 3 + + _feature_uv = FEATURE_TEXTURE_ATTR; + + // attribute + #elif FEATURE_TYPE == 2 + + _feature_attr = uint( FEATURE_ATTR ); + + // none + #elif FEATURE_TYPE == 1 + + _feature_attr = uint( gl_VertexID ); + + #endif + `),e.fragmentShader=e.fragmentShader.replace(/^/,t=>` + + #if USE_HIGHLIGHT_FEATURE + + uniform uint highlightFeatureId; + + #endif + + #if USE_NULL_FEATURE + + uniform uint nullFeatureId; + + #endif + + // texture + #if FEATURE_TYPE == 3 + + uniform sampler2D featureTexture; + uniform int featureChannelsLength; + uniform uint featureChannels[ 4 ]; + varying vec2 _feature_uv; + + // attribute + #elif FEATURE_TYPE == 2 + + flat varying uint _feature_attr; + + // none + #elif FEATURE_TYPE == 1 + + flat varying uint _feature_attr; + + #endif + + // https://www.shadertoy.com/view/XljGzV + vec3 hsl2rgb( in vec3 c ) { + + vec3 rgb = clamp( abs( mod( c.x * 6.0 + vec3( 0.0, 4.0, 2.0 ), 6.0 ) - 3.0 ) - 1.0, 0.0, 1.0 ); + return c.z + c.y * ( rgb - 0.5 ) * ( 1.0 - abs( 2.0 * c.z - 1.0 ) ); + + } + + // https://stackoverflow.com/questions/4200224/random-noise-functions-for-glsl + float rand( float v ) { + + return fract( sin( dot( vec2( v, v ), vec2( 12.9898, 78.233 ) ) ) * 43758.5453 ); + + } + + vec3 randFeatureColor( uint feature ) { + + vec3 hsl; + hsl.r = rand( float( feature ) / 5500.0 ); + hsl.g = 0.75; + hsl.b = 0.5; + return hsl2rgb( hsl ); + + } + + ${t} + `).replace(/#include /,t=>` + ${t} + + // disabled + #if FEATURE_TYPE != 0 + + uint featureId = 0u; + + // texture + #if FEATURE_TYPE == 3 + + // TODO: support anti aliasing here at the pixel edges + uvec4 fields = uvec4( texture( featureTexture, _feature_uv ) * float( 0xff ) ); + for ( int i = 0; i < min( featureChannelsLength, 4 ); i ++ ) { + + uint offset = 8u * featureChannels[ i ]; + featureId = featureId | ( fields[ i ] << offset ); + + } + + // attribute + #elif FEATURE_TYPE == 2 + + featureId = _feature_attr; + + // implicit + #elif FEATURE_TYPE == 1 + + featureId = _feature_attr; + + #endif + + #if USE_HIGHLIGHT_FEATURE + + if ( highlightFeatureId != featureId ) { + + diffuseColor.rgb *= 0.25; + + } + + #else + + vec3 featureColor = randFeatureColor( featureId ); + diffuseColor.rgb = mix( diffuseColor.rgb * featureColor, featureColor, 0.05 ); + + #endif + + #if USE_NULL_FEATURE + + if ( nullFeatureId == featureId ) { + + diffuseColor.rgb *= vec3( 0.0 ); + + } + + #endif + + #endif + + `)}};let h,p,_,T,I,l,A,g,R,U,w=!1,c=null,v=!1;const b=new W(-1,-1),y=new k;y.firstHitOnly=!0;y.params.Points.threshold=.05;const te=localStorage.getItem("ionApiKey")??"put-your-api-key-here",o={accessToken:te,assetId:2333904,reload:()=>{P()},featureIndex:0,propertyTexture:0,highlightAllFeatures:!1};re();H();function re(){g=document.getElementById("meshFeatures"),R=document.getElementById("structuralMetadata"),T=new Y({antialias:!0}),T.setPixelRatio(window.devicePixelRatio),T.setSize(window.innerWidth,window.innerHeight),T.setClearColor(1383455),document.body.appendChild(T.domElement),_=new G,h=new $(60,window.innerWidth/window.innerHeight,.1,5e3),h.position.set(-4,2,0).multiplyScalar(30),h.lookAt(0,0,0),p=new K(_,h,T.domElement),p.minDistance=.1,p.cameraRadius=.1,p.minAltitude=0,p.maxAltitude=Math.PI,p.adjustHeight=!1,p.addEventListener("start",()=>w=!0),p.addEventListener("end",()=>w=!1),I=new j(16777215,3.3),I.position.set(1,2,3).multiplyScalar(40),_.add(I),_.add(new V(16777215,1)),A=new N,A.position.y=40,_.add(A),P(),S(),window.addEventListener("resize",S,!1),window.addEventListener("pointermove",i=>{b.x=i.clientX/window.innerWidth*2-1,b.y=-(i.clientY/window.innerHeight)*2+1})}function ie(){U&&U.destroy(),U=new B;const i=U.addFolder("ion");i.add(o,"accessToken"),i.add(o,"assetId",[2333904,2342602]).onChange(P),i.add(o,"reload");const e=U.addFolder("features");o.assetId===2333904?(e.add(o,"featureIndex",[0,1]),e.add(o,"highlightAllFeatures")):e.add(o,"propertyTexture",{NONE:0,HORIZ_UNCERTAINTY:1,VERT_UNCERTAINTY:2})}function P(){l&&(l.dispose(),l.group.removeFromParent()),localStorage.setItem("ionApiKey",o.accessToken),l=new q,l.registerPlugin(new Z({apiToken:o.accessToken,assetId:o.assetId})),l.setCamera(h),A.add(l.group);const i=new O(l.manager);i.register(()=>new J),i.register(()=>new Q),l.manager.addHandler(/(gltf|glb)$/g,i),l.addEventListener("load-model",({scene:e})=>{e.traverse(t=>{if(t.material&&t.userData.meshFeatures){const r=ee(t.material.constructor),n=new r;n.copy(t.material),n.metalness=0,t.material=n}t.material&&t.userData.structuralMetadata&&(t.material.originalMap=t.material.map)})}),ie()}function S(){h.aspect=window.innerWidth/window.innerHeight,T.setPixelRatio(window.devicePixelRatio),T.setSize(window.innerWidth,window.innerHeight),h.updateProjectionMatrix()}function L(i,e,t,r=null,n=null,d=null){if(R.innerText=`STRUCTURAL_METADATA +`,n!==null){const u=i.getPropertyTableData(n,d);a(u,i.getPropertyTableInfo(n))}r!==null&&a(i.getPropertyAttributeData(r),i.getPropertyAttributeInfo()),a(i.getPropertyTextureData(e,t),i.getPropertyTextureInfo());function a(u,s){const f=Math.max(...Object.values(u).flatMap(m=>Object.keys(m)).map(m=>m.length));for(const m in u){R.innerText+=` +${s[m].name||s[m].className} +`;const F=u[m];for(const D in F){let E=F[D];E&&E.toArray&&(E=E.toArray()),E&&E.join&&(E=` +`+E.map(x=>x.toFixed?parseFloat(x.toFixed(6)):x).map((x,M)=>` [${M}] ${x}`).join(` +`)),typeof E=="number"&&(E=parseFloat(E.toFixed(6))),R.innerText+=` ${D.padEnd(f+1)} : ${E} +`}}}}function ne(){if(v||w)return;y.setFromCamera(b,h);const i=y.intersectObject(_)[0];if(i){const{object:e,face:t,point:r,index:n,faceIndex:d}=i,a=new C;if(t){const s=new X;s.setFromAttributeAndIndices(e.geometry.attributes.position,t.a,t.b,t.c),s.a.applyMatrix4(e.matrixWorld),s.b.applyMatrix4(e.matrixWorld),s.c.applyMatrix4(e.matrixWorld),s.getBarycoord(r,a)}else a.set(0,0,0);const{meshFeatures:u}=i.object.userData;u?(v=!0,u.getFeaturesAsync(d,a).then(s=>{v=!1,c={index:n,features:s,faceIndex:d,barycoord:a,object:e}})):c={index:n,features:null,faceIndex:d,barycoord:a,object:e}}else c=null}function ae(){const{featureIndex:i}=o;let e=null,t=null,r=null;if(c&&(e=c.object.userData.meshFeatures,t=c.object.userData.structuralMetadata,r=c.features),e!==null&&r!==null){const{index:n,faceIndex:d,barycoord:a}=c;if(g.innerText=`EXT_MESH_FEATURES + +`,g.innerText+=`feature : ${r.map(u=>u+"").join(", ")} +`,g.innerText+=`texture memory : ${T.info.memory.textures} +`,t!==null){const s=e.getFeatureInfo().map(f=>f.propertyTable);L(t,d,a,n,s,r)}}else if(g.innerText=`EXT_MESH_FEATURES + +`,g.innerText+=`feature : - +`,g.innerText+=`texture memory : ${T.info.memory.textures}`,t!==null){const{index:n,faceIndex:d,barycoord:a}=c;L(t,d,a,n)}else R.innerText="";l.forEachLoadedModel(n=>n.traverse(d=>{const a=d.material,{meshFeatures:u,structuralMetadata:s}=d.userData;if(a&&u)if(o.highlightAllFeatures)a.setFromMeshFeatures(u,i),a.highlightFeatureId=null;else if(c===null)a.disableFeatureDisplay();else{const f=r[i];a.setFromMeshFeatures(u,i),a.highlightFeatureId=f===null?-1:f}if(a&&s&&s.textureAccessors.length>0){let f=null;if(o.propertyTexture===0)f=a.originalMap;else if(o.propertyTexture===1){const F=s.getPropertyTextureInfo()[0].properties.r3dm_uncertainty_ce90sum;f=s.textures[F.index],f.channel=F.texCoord}else if(o.propertyTexture===2){const F=s.getPropertyTextureInfo()[1].properties.r3dm_uncertainty_le90sum;f=s.textures[F.index],f.channel=F.texCoord}a.map!==f&&(a.map=f,a.needsUpdate=!0)}}))}function H(){requestAnimationFrame(H),p.update(),h.updateMatrixWorld(),ae(),ne();const i=new z,e=new C(0,1,0);l.getBoundingSphere(i),l.group.position.copy(i.center).multiplyScalar(-1),A.quaternion.setFromUnitVectors(i.center.normalize(),e),l.setResolutionFromRenderer(h,T),l.update(),T.render(_,h)} diff --git a/example/bundle/assets/offscreenShadows-CUSnnjeQ.js b/example/bundle/assets/offscreenShadows-CUSnnjeQ.js new file mode 100644 index 000000000..0b632a231 --- /dev/null +++ b/example/bundle/assets/offscreenShadows-CUSnnjeQ.js @@ -0,0 +1 @@ +import{S as b,W as R,P,a as y,O as v,D as T,A as W,G as A,M as L,B as D,d as E}from"./three.module-CA-qMkP1.js";import{O}from"./OrbitControls-BpFvfpv4.js";import{g as z}from"./lil-gui.module.min-Bc0DeA9g.js";import{S as B}from"./stats.module--VATS4Kh.js";import{T as H}from"./TilesRenderer-5XUDbyI2.js";import"./I3DMLoader-Bb2sAfDf.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";import"./GLTFLoader-JNhhxs0g.js";import"./Ellipsoid-_mEueZip.js";import"./B3DMLoader-QE4NIaTt.js";import"./PNTSLoader-CZfdYf2b.js";import"./CMPTLoader-C0bkMPP6.js";import"./GLTFExtensionLoader-Bl-gplNT.js";import"./EllipsoidRegion-CSZafkN2.js";let a,p,m,i,e,t,d,c,h,r,w;const u=0,g=1,S=2,s={errorTarget:2,shadowStrategy:u,orthographic:!1};I();x();function F({scene:o}){o.traverse(n=>{n.isMesh&&(n.material=new L,n.castShadow=!0,n.receiveShadow=!0)})}function j(o){o.traverse(n=>{n.isMesh&&n.material.dispose()})}function I(){m=new b,i=new R({antialias:!0}),i.setPixelRatio(window.devicePixelRatio),i.setSize(window.innerWidth,window.innerHeight),i.setClearColor(1383455),i.shadowMap.enabled=!0,i.shadowMap.type=P,document.body.appendChild(i.domElement),a=new y(60,window.innerWidth/window.innerHeight,1,4e3),a.position.set(-56,232,260),t=new v,p=new O(a,i.domElement),p.screenSpacePanning=!1,p.minDistance=1,p.maxDistance=2e3,r=new T(16777215,1.25),r.position.set(-100,40,10),r.castShadow=!0,r.shadow.bias=-1e-4,r.shadow.normalBias=.2,r.shadow.mapSize.setScalar(2048);const o=r.shadow.camera;o.left=-120,o.bottom=-120,o.right=120,o.top=120,o.updateProjectionMatrix(),m.add(r);const n=new W(16777215,.05);m.add(n),c=new D,h=new E,d=new A,m.add(d);const M=window.location.hash.replace(/^#/,"")||"../data/tileset.json";e=new H(M),e.addEventListener("load-model",F),e.addEventListener("dispose-model",j),d.add(e.group),f(),window.addEventListener("resize",f,!1);const l=new z;l.width=300,l.add(s,"orthographic"),l.add(s,"errorTarget").min(0).max(25).step(1),l.add(s,"shadowStrategy",{NONE:u,DISPLAY_ACTIVE_TILES:g,USE_SHADOW_CAMERA:S}),l.open(),w=new B,w.showPanel(0),document.body.appendChild(w.dom)}function f(){a.aspect=window.innerWidth/window.innerHeight,i.setPixelRatio(window.devicePixelRatio),i.setSize(window.innerWidth,window.innerHeight),a.updateProjectionMatrix(),C()}function C(){t.position.copy(a.position),t.rotation.copy(a.rotation);const o=a.position.distanceTo(p.target)/2,n=window.innerWidth/window.innerHeight;t.left=-n*o,t.right=n*o,t.bottom=-o,t.top=o,t.near=a.near,t.far=a.far,t.updateProjectionMatrix()}function x(){switch(requestAnimationFrame(x),e.errorTarget=s.errorTarget,parseFloat(s.shadowStrategy)){case u:e.displayActiveTiles=!1,e.autoDisableRendererCulling=!0,e.deleteCamera(r.shadow.camera);break;case g:e.displayActiveTiles=!0,e.autoDisableRendererCulling=!1,e.deleteCamera(r.shadow.camera);break;case S:e.displayActiveTiles=!1,e.autoDisableRendererCulling=!1,e.setCamera(r.shadow.camera),e.setResolution(r.shadow.camera,r.shadow.mapSize);break}s.orthographic?(e.deleteCamera(a),e.setCamera(t),e.setResolutionFromRenderer(t,i)):(e.deleteCamera(t),e.setCamera(a),e.setResolutionFromRenderer(a,i)),d.rotation.set(0,0,0),s.up==="-Z"&&(d.rotation.x=Math.PI/2),d.updateMatrixWorld(!0),e.getBoundingBox(c)?(c.getCenter(e.group.position),e.group.position.multiplyScalar(-1)):e.getBoundingSphere(h)&&(e.group.position.copy(h.center),e.group.position.multiplyScalar(-1)),window.tiles=e,a.updateMatrixWorld(),t.updateMatrixWorld(),e.update(),_(),w.update()}function _(){C(),i.render(m,s.orthographic?t:a)} diff --git a/example/bundle/assets/pntsExample-IGZ5Jaom.js b/example/bundle/assets/pntsExample-IGZ5Jaom.js new file mode 100644 index 000000000..4a08a1a38 --- /dev/null +++ b/example/bundle/assets/pntsExample-IGZ5Jaom.js @@ -0,0 +1 @@ +import{S as c,W as m,P as l,a as h,D as p,A as f}from"./three.module-CA-qMkP1.js";import{O as u}from"./OrbitControls-BpFvfpv4.js";import{P as S}from"./PNTSLoader-CZfdYf2b.js";import"./readMagicBytes-Da5ueiou.js";import"./LoaderBase-CVSPpjX2.js";let n,a,o,e,i;g();d();function g(){o=new c,e=new m({antialias:!0}),e.setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1383455),e.shadowMap.enabled=!0,e.shadowMap.type=l,document.body.appendChild(e.domElement),n=new h(60,window.innerWidth/window.innerHeight,1,4e3),n.position.set(2,2,2),a=new u(n,e.domElement),a.screenSpacePanning=!1,a.minDistance=1,a.maxDistance=2e3,i=new p(16777215,1.25),i.position.set(1,2,3).multiplyScalar(40),i.castShadow=!0,i.shadow.bias=-.01,i.shadow.mapSize.setScalar(2048);const t=i.shadow.camera;t.left=-200,t.bottom=-200,t.right=200,t.top=200,t.updateProjectionMatrix(),o.add(i);const w=new f(16777215,.05);o.add(w),new S().loadAsync("https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/main/1.0/TilesetWithRequestVolume/points.pnts").then(s=>{console.log(s),o.add(s.scene)}),r(),window.addEventListener("resize",r,!1)}function r(){n.aspect=window.innerWidth/window.innerHeight,e.setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),n.updateProjectionMatrix()}function d(){requestAnimationFrame(d),P()}function P(){e.render(o,n)} diff --git a/example/bundle/assets/readMagicBytes-Da5ueiou.js b/example/bundle/assets/readMagicBytes-Da5ueiou.js new file mode 100644 index 000000000..09bab9737 --- /dev/null +++ b/example/bundle/assets/readMagicBytes-Da5ueiou.js @@ -0,0 +1 @@ +const y=new TextDecoder;function I(i){return y.decode(i)}function f(i,e,t,s,a,r){let n;switch(s){case"SCALAR":n=1;break;case"VEC2":n=2;break;case"VEC3":n=3;break;case"VEC4":n=4;break;default:throw new Error(`FeatureTable : Feature type not provided for "${r}".`)}let c;const o=t*n;switch(a){case"BYTE":c=new Int8Array(i,e,o);break;case"UNSIGNED_BYTE":c=new Uint8Array(i,e,o);break;case"SHORT":c=new Int16Array(i,e,o);break;case"UNSIGNED_SHORT":c=new Uint16Array(i,e,o);break;case"INT":c=new Int32Array(i,e,o);break;case"UNSIGNED_INT":c=new Uint32Array(i,e,o);break;case"FLOAT":c=new Float32Array(i,e,o);break;case"DOUBLE":c=new Float64Array(i,e,o);break;default:throw new Error(`FeatureTable : Feature component type not provided for "${r}".`)}return c}class T{constructor(e,t,s,a){this.buffer=e,this.binOffset=t+s,this.binLength=a;let r=null;if(s!==0){const n=new Uint8Array(e,t,s);r=JSON.parse(I(n))}else r={};this.header=r}getKeys(){return Object.keys(this.header)}getData(e,t,s=null,a=null){const r=this.header;if(!(e in r))return null;const n=r[e];if(n instanceof Object){if(Array.isArray(n))return n;{const{buffer:c,binOffset:o,binLength:h}=this,l=n.byteOffset||0,p=n.type||a,b=n.componentType||s;if("type"in n&&a&&n.type!==a)throw new Error("FeatureTable: Specified type does not match expected type.");const u=o+l,d=f(c,u,t,p,b,e);if(u+d.byteLength>o+h)throw new Error("FeatureTable: Feature data read outside binary body length.");return d}}else return n}getBuffer(e,t){const{buffer:s,binOffset:a}=this;return s.slice(a+e,a+e+t)}}class g{constructor(e){this.batchTable=e;const t=e.header.extensions["3DTILES_batch_table_hierarchy"];this.classes=t.classes;for(const a of this.classes){const r=a.instances;for(const n in r)a.instances[n]=this._parseProperty(r[n],a.length,n)}if(this.instancesLength=t.instancesLength,this.classIds=this._parseProperty(t.classIds,this.instancesLength,"classIds"),t.parentCounts?this.parentCounts=this._parseProperty(t.parentCounts,this.instancesLength,"parentCounts"):this.parentCounts=new Array(this.instancesLength).fill(1),t.parentIds){const a=this.parentCounts.reduce((r,n)=>r+n,0);this.parentIds=this._parseProperty(t.parentIds,a,"parentIds")}else this.parentIds=null;this.instancesIds=[];const s={};for(const a of this.classIds)s[a]=s[a]??0,this.instancesIds.push(s[a]),s[a]++}_parseProperty(e,t,s){if(Array.isArray(e))return e;{const{buffer:a,binOffset:r}=this.batchTable,n=e.byteOffset,c=e.componentType||"UNSIGNED_SHORT",o=r+n;return f(a,o,t,"SCALAR",c,s)}}getDataFromId(e,t={}){const s=this.parentCounts[e];if(this.parentIds&&s>0){let o=0;for(let h=0;h=this.count)throw new Error(`BatchTable: id value "${e}" out of bounds for "${this.count}" features number.`);for(const s of this.getKeys())s!=="extensions"&&(t[s]=super.getData(s,this.count)[e]);for(const s in this.extensions){const a=this.extensions[s];a.getDataFromId instanceof Function&&(t[s]=t[s]||{},a.getDataFromId(e,t[s]))}return t}getPropertyArray(e){return super.getData(e,this.count)}}function A(i){let e;if(i instanceof DataView?e=i:e=new DataView(i),String.fromCharCode(e.getUint8(0))==="{")return null;let t="";for(let s=0;s<4;s++)t+=String.fromCharCode(e.getUint8(s));return t}export{D as B,T as F,I as a,A as r}; diff --git a/example/bundle/assets/stats.module--VATS4Kh.js b/example/bundle/assets/stats.module--VATS4Kh.js new file mode 100644 index 000000000..74b251dc7 --- /dev/null +++ b/example/bundle/assets/stats.module--VATS4Kh.js @@ -0,0 +1 @@ +var P=function(){var m=0,a=document.createElement("div");a.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",a.addEventListener("click",function(n){n.preventDefault(),o(++m%a.children.length)},!1);function i(n){return a.appendChild(n.dom),n}function o(n){for(var l=0;l=r+1e3&&(u.update(e*1e3/(n-r),100),r=n,e=0,h)){var l=performance.memory;h.update(l.usedJSHeapSize/1048576,l.jsHeapSizeLimit/1048576)}return n},update:function(){f=this.end()},domElement:a,setMode:o}};P.Panel=function(m,a,i){var o=1/0,f=0,r=Math.round,e=r(window.devicePixelRatio||1),u=80*e,v=48*e,h=3*e,n=2*e,l=3*e,c=15*e,d=74*e,s=30*e,p=document.createElement("canvas");p.width=u,p.height=v,p.style.cssText="width:80px;height:48px";var t=p.getContext("2d");return t.font="bold "+9*e+"px Helvetica,Arial,sans-serif",t.textBaseline="top",t.fillStyle=i,t.fillRect(0,0,u,v),t.fillStyle=a,t.fillText(m,h,n),t.fillRect(l,c,d,s),t.fillStyle=i,t.globalAlpha=.9,t.fillRect(l,c,d,s),{dom:p,update:function(x,S){o=Math.min(o,x),f=Math.max(f,x),t.fillStyle=i,t.globalAlpha=1,t.fillRect(0,0,u,c),t.fillStyle=a,t.fillText(r(x)+" "+m+" ("+r(o)+"-"+r(f)+")",h,n),t.drawImage(p,l+e,c,d-e,s,l,c,d-e,s),t.fillRect(l+d-e,c,e,s),t.fillStyle=i,t.globalAlpha=.9,t.fillRect(l+d-e,c,e,r((1-x/S)*s))}}};export{P as S}; diff --git a/example/bundle/assets/three.module-CA-qMkP1.js b/example/bundle/assets/three.module-CA-qMkP1.js new file mode 100644 index 000000000..7a1f9bf28 --- /dev/null +++ b/example/bundle/assets/three.module-CA-qMkP1.js @@ -0,0 +1,3818 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function e(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=e(i);fetch(i.href,s)}})();/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const Va="166",mf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},gf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nu=0,fl=1,iu=2,_f=3,xf=0,Rl=1,su=2,cn=3,Rn=0,De=1,hn=2,Tn=0,xi=1,pl=2,ml=3,gl=4,ru=5,Xn=100,au=101,ou=102,lu=103,cu=104,hu=200,uu=201,du=202,fu=203,ca=204,ha=205,pu=206,mu=207,gu=208,_u=209,xu=210,vu=211,yu=212,Mu=213,Su=214,bu=0,Au=1,wu=2,Os=3,Eu=4,Tu=5,Cu=6,Ru=7,ir=0,Pu=1,Iu=2,Cn=0,Lu=1,Uu=2,Du=3,Nu=4,Ou=5,Fu=6,Bu=7,_l="attached",zu="detached",Ha=300,Pn=301,qn=302,Fs=303,Bs=304,os=306,zs=1e3,Ke=1001,ks=1002,Me=1003,Pl=1004,vf=1004,Ki=1005,yf=1005,ge=1006,Ts=1007,Mf=1007,un=1008,Sf=1008,mn=1009,Il=1010,Ll=1011,is=1012,Ga=1013,In=1014,Be=1015,ls=1016,Wa=1017,Xa=1018,Si=1020,Ul=35902,Dl=1021,Nl=1022,Ue=1023,Ol=1024,Fl=1025,vi=1026,bi=1027,qa=1028,sr=1029,Bl=1030,Ya=1031,bf=1032,Za=1033,Cs=33776,Rs=33777,Ps=33778,Is=33779,ua=35840,da=35841,fa=35842,pa=35843,ma=36196,ga=37492,_a=37496,xa=37808,va=37809,ya=37810,Ma=37811,Sa=37812,ba=37813,Aa=37814,wa=37815,Ea=37816,Ta=37817,Ca=37818,Ra=37819,Pa=37820,Ia=37821,Ls=36492,La=36494,Ua=36495,zl=36283,Da=36284,Na=36285,Oa=36286,ku=2200,Vu=2201,Hu=2202,Vs=2300,Fa=2301,oa=2302,pi=2400,mi=2401,Hs=2402,Ja=2500,kl=2501,Af=0,wf=1,Ef=2,Gu=3200,Wu=3201,Zn=0,Xu=1,An="",$e="srgb",Un="srgb-linear",$a="display-p3",rr="display-p3-linear",Gs="linear",se="srgb",Ws="rec709",Xs="p3",Tf=0,ui=7680,Cf=7681,Rf=7682,Pf=7683,If=34055,Lf=34056,Uf=5386,Df=512,Nf=513,Of=514,Ff=515,Bf=516,zf=517,kf=518,xl=519,qu=512,Yu=513,Zu=514,Vl=515,Ju=516,$u=517,Ku=518,Qu=519,qs=35044,Vf=35048,Hf=35040,Gf=35045,Wf=35049,Xf=35041,qf=35046,Yf=35050,Zf=35042,Jf="100",vl="300 es",dn=2e3,Ys=2001;class Dn{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const i=this._listeners[t];if(i!==void 0){const s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const i=n.slice(0);for(let s=0,a=i.length;s>8&255]+we[r>>16&255]+we[r>>24&255]+"-"+we[t&255]+we[t>>8&255]+"-"+we[t>>16&15|64]+we[t>>24&255]+"-"+we[e&63|128]+we[e>>8&255]+"-"+we[e>>16&255]+we[e>>24&255]+we[n&255]+we[n>>8&255]+we[n>>16&255]+we[n>>24&255]).toLowerCase()}function he(r,t,e){return Math.max(t,Math.min(e,r))}function Hl(r,t){return(r%t+t)%t}function $f(r,t,e,n,i){return n+(r-t)*(i-n)/(e-t)}function Kf(r,t,e){return r!==t?(e-r)/(t-r):0}function Us(r,t,e){return(1-e)*r+e*t}function Qf(r,t,e,n){return Us(r,t,1-Math.exp(-e*n))}function jf(r,t=1){return t-Math.abs(Hl(r,t*2)-t)}function tp(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*(3-2*r))}function ep(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*r*(r*(r*6-15)+10))}function np(r,t){return r+Math.floor(Math.random()*(t-r+1))}function ip(r,t){return r+Math.random()*(t-r)}function sp(r){return r*(.5-Math.random())}function rp(r){r!==void 0&&(bc=r);let t=bc+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function ap(r){return r*yi}function op(r){return r*ss}function lp(r){return(r&r-1)===0&&r!==0}function cp(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function hp(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function up(r,t,e,n,i){const s=Math.cos,a=Math.sin,o=s(e/2),l=a(e/2),c=s((t+n)/2),h=a((t+n)/2),u=s((t-n)/2),d=a((t-n)/2),f=s((n-t)/2),m=a((n-t)/2);switch(i){case"XYX":r.set(o*h,l*u,l*d,o*c);break;case"YZY":r.set(l*d,o*h,l*u,o*c);break;case"ZXZ":r.set(l*u,l*d,o*h,o*c);break;case"XZX":r.set(o*h,l*m,l*f,o*c);break;case"YXY":r.set(l*f,o*h,l*m,o*c);break;case"ZYZ":r.set(l*m,l*f,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Le(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function zt(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const dp={DEG2RAD:yi,RAD2DEG:ss,generateUUID:qe,clamp:he,euclideanModulo:Hl,mapLinear:$f,inverseLerp:Kf,lerp:Us,damp:Qf,pingpong:jf,smoothstep:tp,smootherstep:ep,randInt:np,randFloat:ip,randFloatSpread:sp,seededRandom:rp,degToRad:ap,radToDeg:op,isPowerOfTwo:lp,ceilPowerOfTwo:cp,floorPowerOfTwo:hp,setQuaternionFromProperEuler:up,normalize:zt,denormalize:Le};class Z{constructor(t=0,e=0){Z.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(he(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*n-a*i+t.x,this.y=s*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bt{constructor(t,e,n,i,s,a,o,l,c){Bt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,a,o,l,c)}set(t,e,n,i,s,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=i,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],v=i[1],x=i[4],y=i[7],I=i[2],w=i[5],C=i[8];return s[0]=a*_+o*v+l*I,s[3]=a*g+o*x+l*w,s[6]=a*p+o*y+l*C,s[1]=c*_+h*v+u*I,s[4]=c*g+h*x+u*w,s[7]=c*p+h*y+u*C,s[2]=d*_+f*v+m*I,s[5]=d*g+f*x+m*w,s[8]=d*p+f*y+m*C,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*s*h+n*o*l+i*s*c-i*a*l}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,d=o*l-h*s,f=c*s-a*l,m=e*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return t[0]=u*_,t[1]=(i*c-h*n)*_,t[2]=(o*n-i*a)*_,t[3]=d*_,t[4]=(h*e-i*l)*_,t[5]=(i*s-o*e)*_,t[6]=f*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*s)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-i*c,i*l,-i*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(To.makeScale(t,e)),this}rotate(t){return this.premultiply(To.makeRotation(-t)),this}translate(t,e){return this.premultiply(To.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const To=new Bt;function ju(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}const fp={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Qi(r,t){return new fp[r](t)}function Zs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function td(){const r=Zs("canvas");return r.style.display="block",r}const Ac={};function Gl(r){r in Ac||(Ac[r]=!0,console.warn(r))}function pp(r,t,e){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(t,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,e);break;default:n()}}setTimeout(s,e)})}const wc=new Bt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ec=new Bt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),mr={[Un]:{transfer:Gs,primaries:Ws,toReference:r=>r,fromReference:r=>r},[$e]:{transfer:se,primaries:Ws,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[rr]:{transfer:Gs,primaries:Xs,toReference:r=>r.applyMatrix3(Ec),fromReference:r=>r.applyMatrix3(wc)},[$a]:{transfer:se,primaries:Xs,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Ec),fromReference:r=>r.applyMatrix3(wc).convertLinearToSRGB()}},mp=new Set([Un,rr]),Kt={enabled:!0,_workingColorSpace:Un,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!mp.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;const n=mr[t].toReference,i=mr[e].fromReference;return i(n(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return mr[r].primaries},getTransfer:function(r){return r===An?Gs:mr[r].transfer}};function ns(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Co(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Pi;class ed{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Pi===void 0&&(Pi=Zs("canvas")),Pi.width=t.width,Pi.height=t.height;const n=Pi.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Pi}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=Zs("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),s=i.data;for(let a=0;a0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Ha)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case zs:t.x=t.x-Math.floor(t.x);break;case Ke:t.x=t.x<0?0:1;break;case ks:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case zs:t.y=t.y-Math.floor(t.y);break;case Ke:t.y=t.y<0?0:1;break;case ks:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}ue.DEFAULT_IMAGE=null;ue.DEFAULT_MAPPING=Ha;ue.DEFAULT_ANISOTROPY=1;class ne{constructor(t=0,e=0,n=0,i=1){ne.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*s,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,s;const l=t.elements,c=l[0],h=l[4],u=l[8],d=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const x=(c+1)/2,y=(f+1)/2,I=(p+1)/2,w=(h+d)/4,C=(u+_)/4,P=(m+g)/4;return x>y&&x>I?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=w/n,s=C/n):y>I?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=w/i,s=P/i):I<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(I),n=C/s,i=P/s),this.set(n,i,s,e),this}let v=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(u-_)/v,this.z=(d-h)/v,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class nd extends Dn{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new ne(0,0,t,e),this.scissorTest=!1,this.viewport=new ne(0,0,t,e);const i={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ge,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new ue(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o=0?1:-1,x=1-p*p;if(x>Number.EPSILON){const I=Math.sqrt(x),w=Math.atan2(I,p*v);g=Math.sin(g*w)/I,o=Math.sin(o*w)/I}const y=o*v;if(l=l*g+d*y,c=c*g+f*y,h=h*g+m*y,u=u*g+_*y,g===1-o){const I=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=I,c*=I,h*=I,u*=I}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=s[a],d=s[a+1],f=s[a+2],m=s[a+3];return t[e]=o*m+h*u+l*f-c*d,t[e+1]=l*m+h*d+c*u-o*f,t[e+2]=c*m+h*f+o*d-l*u,t[e+3]=h*m-o*u-l*d-c*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(a){case"XYZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"YZX":this._x=d*h*u+c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u-d*f*m;break;case"XZY":this._x=d*h*u-c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],d=n+o+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(he(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const i=Math.min(1,e/n);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+i*c-s*l,this._y=i*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*t._w+n*t._x+i*t._y+s*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-e;return this._w=f*a+e*this._w,this._x=f*n+e*this._x,this._y=f*i+e*this._y,this._z=f*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-e)*h)/c,d=Math.sin(e*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class T{constructor(t=0,e=0,n=0){T.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Tc.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Tc.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*i,this.y=s[1]*e+s[4]*n+s[7]*i,this.z=s[2]*e+s[5]*n+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,s=t.elements,a=1/(s[3]*e+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*e+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*e+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*i-o*n),h=2*(o*e-s*i),u=2*(s*n-a*e);return this.x=e+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=i+l*u+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i,this.y=s[1]*e+s[5]*n+s[9]*i,this.z=s[2]*e+s[6]*n+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Po.copy(this).projectOnVector(t),this.sub(Po)}reflect(t){return this.sub(Po.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(he(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Po=new T,Tc=new ze;class Ne{constructor(t=new T(1/0,1/0,1/0),e=new T(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,je),je.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(fs),_r.subVectors(this.max,fs),Ii.subVectors(t.a,fs),Li.subVectors(t.b,fs),Ui.subVectors(t.c,fs),On.subVectors(Li,Ii),Fn.subVectors(Ui,Li),jn.subVectors(Ii,Ui);let e=[0,-On.z,On.y,0,-Fn.z,Fn.y,0,-jn.z,jn.y,On.z,0,-On.x,Fn.z,0,-Fn.x,jn.z,0,-jn.x,-On.y,On.x,0,-Fn.y,Fn.x,0,-jn.y,jn.x,0];return!Io(e,Ii,Li,Ui,_r)||(e=[1,0,0,0,1,0,0,0,1],!Io(e,Ii,Li,Ui,_r))?!1:(xr.crossVectors(On,Fn),e=[xr.x,xr.y,xr.z],Io(e,Ii,Li,Ui,_r))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,je).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(je).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(xn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),xn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),xn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),xn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),xn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),xn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),xn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),xn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(xn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const xn=[new T,new T,new T,new T,new T,new T,new T,new T],je=new T,gr=new Ne,Ii=new T,Li=new T,Ui=new T,On=new T,Fn=new T,jn=new T,fs=new T,_r=new T,xr=new T,ti=new T;function Io(r,t,e,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){ti.fromArray(r,s);const o=i.x*Math.abs(ti.x)+i.y*Math.abs(ti.y)+i.z*Math.abs(ti.z),l=t.dot(ti),c=e.dot(ti),h=n.dot(ti);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const yp=new Ne,ps=new T,Lo=new T;class Ce{constructor(t=new T,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):yp.setFromPoints(t).getCenter(n);let i=0;for(let s=0,a=t.length;sthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ps.subVectors(t,this.center);const e=ps.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(ps,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Lo.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ps.copy(t.center).add(Lo)),this.expandByPoint(ps.copy(t.center).sub(Lo))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const vn=new T,Uo=new T,vr=new T,Bn=new T,Do=new T,yr=new T,No=new T;class cs{constructor(t=new T,e=new T(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,vn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=vn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(vn.copy(this.origin).addScaledVector(this.direction,e),vn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Uo.copy(t).add(e).multiplyScalar(.5),vr.copy(e).sub(t).normalize(),Bn.copy(this.origin).sub(Uo);const s=t.distanceTo(e)*.5,a=-this.direction.dot(vr),o=Bn.dot(this.direction),l=-Bn.dot(vr),c=Bn.lengthSq(),h=Math.abs(1-a*a);let u,d,f,m;if(h>0)if(u=a*l-o,d=a*o-l,m=s*h,u>=0)if(d>=-m)if(d<=m){const _=1/h;u*=_,d*=_,f=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d<=-m?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c):d<=m?(u=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Uo).addScaledVector(vr,d),f}intersectSphere(t,e){vn.subVectors(t.center,this.origin);const n=vn.dot(this.direction),i=vn.dot(vn)-n*n,s=t.radius*t.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(t.min.x-d.x)*c,i=(t.max.x-d.x)*c):(n=(t.max.x-d.x)*c,i=(t.min.x-d.x)*c),h>=0?(s=(t.min.y-d.y)*h,a=(t.max.y-d.y)*h):(s=(t.max.y-d.y)*h,a=(t.min.y-d.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a=0?(o=(t.min.z-d.z)*u,l=(t.max.z-d.z)*u):(o=(t.max.z-d.z)*u,l=(t.min.z-d.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l=0?n:i,e)}intersectsBox(t){return this.intersectBox(t,vn)!==null}intersectTriangle(t,e,n,i,s){Do.subVectors(e,t),yr.subVectors(n,t),No.crossVectors(Do,yr);let a=this.direction.dot(No),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Bn.subVectors(this.origin,t);const l=o*this.direction.dot(yr.crossVectors(Bn,yr));if(l<0)return null;const c=o*this.direction.dot(Do.cross(Bn));if(c<0||l+c>a)return null;const h=-o*Bn.dot(No);return h<0?null:this.at(h/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Rt{constructor(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g){Rt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g)}set(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g){const p=this.elements;return p[0]=t,p[4]=e,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 Rt().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Di.setFromMatrixColumn(t,0).length(),s=1/Di.setFromMatrixColumn(t,1).length(),a=1/Di.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,s=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=f+m*c,e[5]=d-_*c,e[9]=-o*l,e[2]=_-d*c,e[6]=m+f*c,e[10]=a*l}else if(t.order==="YXZ"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d+_*o,e[4]=m*o-f,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=f*o-m,e[6]=_+d*o,e[10]=a*l}else if(t.order==="ZXY"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d-_*o,e[4]=-a*u,e[8]=m+f*o,e[1]=f+m*o,e[5]=a*h,e[9]=_-d*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=m*c-f,e[8]=d*c+_,e[1]=l*u,e[5]=_*c+d,e[9]=f*c-m,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=_-d*u,e[8]=m*u+f,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=f*u+m,e[10]=d-_*u}else if(t.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=d*u+_,e[5]=a*h,e[9]=f*u-m,e[2]=m*u-f,e[6]=o*h,e[10]=_*u+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Mp,t,Sp)}lookAt(t,e,n){const i=this.elements;return Ge.subVectors(t,e),Ge.lengthSq()===0&&(Ge.z=1),Ge.normalize(),zn.crossVectors(n,Ge),zn.lengthSq()===0&&(Math.abs(n.z)===1?Ge.x+=1e-4:Ge.z+=1e-4,Ge.normalize(),zn.crossVectors(n,Ge)),zn.normalize(),Mr.crossVectors(Ge,zn),i[0]=zn.x,i[4]=Mr.x,i[8]=Ge.x,i[1]=zn.y,i[5]=Mr.y,i[9]=Ge.y,i[2]=zn.z,i[6]=Mr.z,i[10]=Ge.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],v=n[3],x=n[7],y=n[11],I=n[15],w=i[0],C=i[4],P=i[8],b=i[12],M=i[1],L=i[5],k=i[9],O=i[13],V=i[2],q=i[6],H=i[10],tt=i[14],G=i[3],pt=i[7],yt=i[11],gt=i[15];return s[0]=a*w+o*M+l*V+c*G,s[4]=a*C+o*L+l*q+c*pt,s[8]=a*P+o*k+l*H+c*yt,s[12]=a*b+o*O+l*tt+c*gt,s[1]=h*w+u*M+d*V+f*G,s[5]=h*C+u*L+d*q+f*pt,s[9]=h*P+u*k+d*H+f*yt,s[13]=h*b+u*O+d*tt+f*gt,s[2]=m*w+_*M+g*V+p*G,s[6]=m*C+_*L+g*q+p*pt,s[10]=m*P+_*k+g*H+p*yt,s[14]=m*b+_*O+g*tt+p*gt,s[3]=v*w+x*M+y*V+I*G,s[7]=v*C+x*L+y*q+I*pt,s[11]=v*P+x*k+y*H+I*yt,s[15]=v*b+x*O+y*tt+I*gt,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],d=t[10],f=t[14],m=t[3],_=t[7],g=t[11],p=t[15];return m*(+s*l*u-i*c*u-s*o*d+n*c*d+i*o*f-n*l*f)+_*(+e*l*f-e*c*d+s*a*d-i*a*f+i*c*h-s*l*h)+g*(+e*c*u-e*o*f-s*a*u+n*a*f+s*o*h-n*c*h)+p*(-i*o*h-e*l*u+e*o*d+i*a*u-n*a*d+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],f=t[11],m=t[12],_=t[13],g=t[14],p=t[15],v=u*g*c-_*d*c+_*l*f-o*g*f-u*l*p+o*d*p,x=m*d*c-h*g*c-m*l*f+a*g*f+h*l*p-a*d*p,y=h*_*c-m*u*c+m*o*f-a*_*f-h*o*p+a*u*p,I=m*u*l-h*_*l-m*o*d+a*_*d+h*o*g-a*u*g,w=e*v+n*x+i*y+s*I;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/w;return t[0]=v*C,t[1]=(_*d*s-u*g*s-_*i*f+n*g*f+u*i*p-n*d*p)*C,t[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*p+n*l*p)*C,t[3]=(u*l*s-o*d*s-u*i*c+n*d*c+o*i*f-n*l*f)*C,t[4]=x*C,t[5]=(h*g*s-m*d*s+m*i*f-e*g*f-h*i*p+e*d*p)*C,t[6]=(m*l*s-a*g*s-m*i*c+e*g*c+a*i*p-e*l*p)*C,t[7]=(a*d*s-h*l*s+h*i*c-e*d*c-a*i*f+e*l*f)*C,t[8]=y*C,t[9]=(m*u*s-h*_*s-m*n*f+e*_*f+h*n*p-e*u*p)*C,t[10]=(a*_*s-m*o*s+m*n*c-e*_*c-a*n*p+e*o*p)*C,t[11]=(h*o*s-a*u*s-h*n*c+e*u*c+a*n*f-e*o*f)*C,t[12]=I*C,t[13]=(h*_*i-m*u*i+m*n*d-e*_*d-h*n*g+e*u*g)*C,t[14]=(m*o*i-a*_*i-m*n*l+e*_*l+a*n*g-e*o*g)*C,t[15]=(a*u*i-h*o*i+h*n*l-e*u*l-a*n*d+e*o*d)*C,this}scale(t){const e=this.elements,n=t.x,i=t.y,s=t.z;return e[0]*=n,e[4]*=i,e[8]*=s,e[1]*=n,e[5]*=i,e[9]*=s,e[2]*=n,e[6]*=i,e[10]*=s,e[3]*=n,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),s=1-n,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,s,a){return this.set(1,n,s,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,u=o+o,d=s*c,f=s*h,m=s*u,_=a*h,g=a*u,p=o*u,v=l*c,x=l*h,y=l*u,I=n.x,w=n.y,C=n.z;return i[0]=(1-(_+p))*I,i[1]=(f+y)*I,i[2]=(m-x)*I,i[3]=0,i[4]=(f-y)*w,i[5]=(1-(d+p))*w,i[6]=(g+v)*w,i[7]=0,i[8]=(m+x)*C,i[9]=(g-v)*C,i[10]=(1-(d+_))*C,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let s=Di.set(i[0],i[1],i[2]).length();const a=Di.set(i[4],i[5],i[6]).length(),o=Di.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),t.x=i[12],t.y=i[13],t.z=i[14],tn.copy(this);const c=1/s,h=1/a,u=1/o;return tn.elements[0]*=c,tn.elements[1]*=c,tn.elements[2]*=c,tn.elements[4]*=h,tn.elements[5]*=h,tn.elements[6]*=h,tn.elements[8]*=u,tn.elements[9]*=u,tn.elements[10]*=u,e.setFromRotationMatrix(tn),n.x=s,n.y=a,n.z=o,this}makePerspective(t,e,n,i,s,a,o=dn){const l=this.elements,c=2*s/(e-t),h=2*s/(n-i),u=(e+t)/(e-t),d=(n+i)/(n-i);let f,m;if(o===dn)f=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(o===Ys)f=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,i,s,a,o=dn){const l=this.elements,c=1/(e-t),h=1/(n-i),u=1/(a-s),d=(e+t)*c,f=(n+i)*h;let m,_;if(o===dn)m=(a+s)*u,_=-2*u;else if(o===Ys)m=s*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Di=new T,tn=new Rt,Mp=new T(0,0,0),Sp=new T(1,1,1),zn=new T,Mr=new T,Ge=new T,Cc=new Rt,Rc=new ze;class Ye{constructor(t=0,e=0,n=0,i=Ye.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(e){case"XYZ":this._y=Math.asin(he(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-he(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(he(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-he(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(he(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-he(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cc.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cc,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Rc.setFromEuler(this),this.setFromQuaternion(Rc,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ye.DEFAULT_ORDER="XYZ";class Qa{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let e=0;e1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.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())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,n,i,s){en.subVectors(i,e),Mn.subVectors(n,e),Fo.subVectors(t,e);const a=en.dot(en),o=en.dot(Mn),l=en.dot(Fo),c=Mn.dot(Mn),h=Mn.dot(Fo),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const d=1/u,f=(c*l-o*h)*d,m=(a*h-o*l)*d;return s.set(1-f-m,m,f)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Sn)===null?!1:Sn.x>=0&&Sn.y>=0&&Sn.x+Sn.y<=1}static getInterpolation(t,e,n,i,s,a,o,l){return this.getBarycoord(t,e,n,i,Sn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Sn.x),l.addScaledVector(a,Sn.y),l.addScaledVector(o,Sn.z),l)}static isFrontFacing(t,e,n,i){return en.subVectors(n,e),Mn.subVectors(t,e),en.cross(Mn).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return en.subVectors(this.c,this.b),Mn.subVectors(this.a,this.b),en.cross(Mn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Xe.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Xe.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,s){return Xe.getInterpolation(t,this.a,this.b,this.c,e,n,i,s)}containsPoint(t){return Xe.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Xe.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,s=this.c;let a,o;Fi.subVectors(i,n),Bi.subVectors(s,n),Bo.subVectors(t,n);const l=Fi.dot(Bo),c=Bi.dot(Bo);if(l<=0&&c<=0)return e.copy(n);zo.subVectors(t,i);const h=Fi.dot(zo),u=Bi.dot(zo);if(h>=0&&u<=h)return e.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(Fi,a);ko.subVectors(t,s);const f=Fi.dot(ko),m=Bi.dot(ko);if(m>=0&&f<=m)return e.copy(s);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),e.copy(n).addScaledVector(Bi,o);const g=h*m-f*u;if(g<=0&&u-h>=0&&f-m>=0)return Nc.subVectors(s,i),o=(u-h)/(u-h+(f-m)),e.copy(i).addScaledVector(Nc,o);const p=1/(g+_+d);return a=_*p,o=d*p,e.copy(n).addScaledVector(Fi,a).addScaledVector(Bi,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const id={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},kn={h:0,s:0,l:0},br={h:0,s:0,l:0};function Vo(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}class ft{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=$e){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Kt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=Kt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Kt.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=Kt.workingColorSpace){if(t=Hl(t,1),e=he(e,0,1),n=he(n,0,1),e===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+e):n+e-n*e,a=2*n-s;this.r=Vo(a,s,t+1/3),this.g=Vo(a,s,t),this.b=Vo(a,s,t-1/3)}return Kt.toWorkingColorSpace(this,i),this}setStyle(t,e=$e){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=$e){const n=id[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ns(t.r),this.g=ns(t.g),this.b=ns(t.b),this}copyLinearToSRGB(t){return this.r=Co(t.r),this.g=Co(t.g),this.b=Co(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=$e){return Kt.fromWorkingColorSpace(Ee.copy(this),t),Math.round(he(Ee.r*255,0,255))*65536+Math.round(he(Ee.g*255,0,255))*256+Math.round(he(Ee.b*255,0,255))}getHexString(t=$e){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Kt.workingColorSpace){Kt.fromWorkingColorSpace(Ee.copy(this),e);const n=Ee.r,i=Ee.g,s=Ee.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(i-s)/u+(i0!=t>0&&this.version++,this._alphaTest=t}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,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!==void 0&&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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),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(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/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!==xi&&(n.blending=this.blending),this.side!==Rn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ca&&(n.blendSrc=this.blendSrc),this.blendDst!==ha&&(n.blendDst=this.blendDst),this.blendEquation!==Xn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Os&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==xl&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ui&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ui&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ui&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),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.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),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=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(e){const s=i(t.textures),a=i(t.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const i=e.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Jn extends Re{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ft(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ye,this.combine=ir,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const wn=Cp();function Cp(){const r=new ArrayBuffer(4),t=new Float32Array(r),e=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;!(c&8388608);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function Fe(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=he(r,-65504,65504),wn.floatView[0]=r;const t=wn.uint32View[0],e=t>>23&511;return wn.baseTable[e]+((t&8388607)>>wn.shiftTable[e])}function ws(r){const t=r>>10;return wn.uint32View[0]=wn.mantissaTable[wn.offsetTable[t]+(r&1023)]+wn.exponentTable[t],wn.floatView[0]}const Rp={toHalfFloat:Fe,fromHalfFloat:ws},me=new T,Ar=new Z;class ie{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=qs,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Be,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return Gl("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,s=this.itemSize;i0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u0&&(i[l]=h,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const i=t.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(e))}const s=t.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,f=u.length;d0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s(t.far-t.near)**2))&&(Oc.copy(s).invert(),ei.copy(t.ray).applyMatrix4(Oc),!(n.boundingBox!==null&&ei.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,ei)))}_computeIntersections(t,e,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],v=Math.max(g.start,f.start),x=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let y=v,I=x;ye.far?null:{distance:c,point:Ir.clone(),object:r}}function Lr(r,t,e,n,i,s,a,o,l,c){r.getVertexPosition(o,ki),r.getVertexPosition(l,Vi),r.getVertexPosition(c,Hi);const h=Fp(r,t,e,n,ki,Vi,Hi,Pr);if(h){i&&(Tr.fromBufferAttribute(i,o),Cr.fromBufferAttribute(i,l),Rr.fromBufferAttribute(i,c),h.uv=Xe.getInterpolation(Pr,ki,Vi,Hi,Tr,Cr,Rr,new Z)),s&&(Tr.fromBufferAttribute(s,o),Cr.fromBufferAttribute(s,l),Rr.fromBufferAttribute(s,c),h.uv1=Xe.getInterpolation(Pr,ki,Vi,Hi,Tr,Cr,Rr,new Z)),a&&(Bc.fromBufferAttribute(a,o),zc.fromBufferAttribute(a,l),kc.fromBufferAttribute(a,c),h.normal=Xe.getInterpolation(Pr,ki,Vi,Hi,Bc,zc,kc,new T),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new T,materialIndex:0};Xe.getNormal(ki,Vi,Hi,u.normal),h.face=u}return h}class Ei extends Ht{constructor(t=1,e=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,f=0;m("z","y","x",-1,-1,n,e,t,a,s,0),m("z","y","x",1,-1,n,e,-t,a,s,1),m("x","z","y",1,1,t,n,e,i,a,2),m("x","z","y",1,-1,t,n,-e,i,a,3),m("x","y","z",1,-1,t,e,n,i,s,4),m("x","y","z",-1,-1,t,e,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new bt(c,3)),this.setAttribute("normal",new bt(h,3)),this.setAttribute("uv",new bt(u,2));function m(_,g,p,v,x,y,I,w,C,P,b){const M=y/C,L=I/P,k=y/2,O=I/2,V=w/2,q=C+1,H=P+1;let tt=0,G=0;const pt=new T;for(let yt=0;yt0?1:-1,h.push(pt.x,pt.y,pt.z),u.push(Gt/C),u.push(1-yt/P),tt+=1}}for(let yt=0;yt0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class ja extends Zt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Rt,this.projectionMatrix=new Rt,this.projectionMatrixInverse=new Rt,this.coordinateSystem=dn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Vn=new T,Vc=new Z,Hc=new Z;class Ae extends ja{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=ss*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(yi*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return ss*2*Math.atan(Math.tan(yi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Vn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Vn.x,Vn.y).multiplyScalar(-t/Vn.z),Vn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Vn.x,Vn.y).multiplyScalar(-t/Vn.z)}getViewSize(t,e){return this.getViewBounds(t,Vc,Hc),e.subVectors(Hc,Vc)}setViewOffset(t,e,n,i,s,a){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=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 t=this.near;let e=t*Math.tan(yi*.5*this.fov)/this.zoom,n=2*e,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,e-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Gi=-90,Wi=1;class ad extends Zt{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ae(Gi,Wi,t,e);i.layers=this.layers,this.add(i);const s=new Ae(Gi,Wi,t,e);s.layers=this.layers,this.add(s);const a=new Ae(Gi,Wi,t,e);a.layers=this.layers,this.add(a);const o=new Ae(Gi,Wi,t,e);o.layers=this.layers,this.add(o);const l=new Ae(Gi,Wi,t,e);l.layers=this.layers,this.add(l);const c=new Ae(Gi,Wi,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,s,a,o,l]=e;for(const c of e)this.remove(c);if(t===dn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Ys)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=t.getRenderTarget(),d=t.getActiveCubeFace(),f=t.getActiveMipmapLevel(),m=t.xr.enabled;t.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,s),t.setRenderTarget(n,1,i),t.render(e,a),t.setRenderTarget(n,2,i),t.render(e,o),t.setRenderTarget(n,3,i),t.render(e,l),t.setRenderTarget(n,4,i),t.render(e,c),n.texture.generateMipmaps=_,t.setRenderTarget(n,5,i),t.render(e,h),t.setRenderTarget(u,d,f),t.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class ar extends ue{constructor(t,e,n,i,s,a,o,l,c,h){t=t!==void 0?t:[],e=e!==void 0?e:Pn,super(t,e,n,i,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class od extends sn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new ar(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:ge}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ei(5,5,5),s=new rn({name:"CubemapFromEquirect",uniforms:rs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:De,blending:Tn});s.uniforms.tEquirect.value=e;const a=new _e(i,s),o=e.minFilter;return e.minFilter===un&&(e.minFilter=ge),new ad(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,i){const s=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,i);t.setRenderTarget(s)}}const Wo=new T,Vp=new T,Hp=new Bt;class Wn{constructor(t=new T(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Wo.subVectors(n,e).cross(Vp.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Wo),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const s=-(t.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Hp.getNormalMatrix(t),i=this.coplanarPoint(Wo).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ni=new Ce,Ur=new T;class or{constructor(t=new Wn,e=new Wn,n=new Wn,i=new Wn,s=new Wn,a=new Wn){this.planes=[t,e,n,i,s,a]}set(t,e,n,i,s,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=dn){const n=this.planes,i=t.elements,s=i[0],a=i[1],o=i[2],l=i[3],c=i[4],h=i[5],u=i[6],d=i[7],f=i[8],m=i[9],_=i[10],g=i[11],p=i[12],v=i[13],x=i[14],y=i[15];if(n[0].setComponents(l-s,d-c,g-f,y-p).normalize(),n[1].setComponents(l+s,d+c,g+f,y+p).normalize(),n[2].setComponents(l+a,d+h,g+m,y+v).normalize(),n[3].setComponents(l-a,d-h,g-m,y-v).normalize(),n[4].setComponents(l-o,d-u,g-_,y-x).normalize(),e===dn)n[5].setComponents(l+o,d+u,g+_,y+x).normalize();else if(e===Ys)n[5].setComponents(o,u,_,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),ni.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),ni.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ni)}intersectsSprite(t){return ni.center.set(0,0,0),ni.radius=.7071067811865476,ni.applyMatrix4(t.matrixWorld),this.intersectsSphere(ni)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(n)0?t.max.x:t.min.x,Ur.y=i.normal.y>0?t.max.y:t.min.y,Ur.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Ur)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function ld(){let r=null,t=!1,e=null,n=null;function i(s,a){e(s,a),n=r.requestAnimationFrame(i)}return{start:function(){t!==!0&&e!==null&&(n=r.requestAnimationFrame(i),t=!0)},stop:function(){r.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(s){e=s},setContext:function(s){r=s}}}function Gp(r){const t=new WeakMap;function e(o,l){const c=o.array,h=o.usage,u=c.byteLength,d=r.createBuffer();r.bindBuffer(l,d),r.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l._updateRange,d=l.updateRanges;if(r.bindBuffer(c,o),u.count===-1&&d.length===0&&r.bufferSubData(c,0,h),d.length!==0){for(let f=0,m=d.length;f 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,am=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,om=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,lm=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,cm=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,hm=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,um=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,dm=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,fm=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); + return dot( weights, rgb ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,pm=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,mm=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,gm=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,_m=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,xm=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,vm=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,ym="gl_FragColor = linearToOutputTexel( gl_FragColor );",Mm=` +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +} +vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 LinearTosRGB( in vec4 value ) { + return sRGBTransferOETF( value ); +}`,Sm=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,bm=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,Am=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,wm=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,Em=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,Tm=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,Cm=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,Rm=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,Pm=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,Im=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,Lm=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,Um=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,Dm=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Nm=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,Om=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,Fm=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Bm=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,zm=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,km=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Vm=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,Hm=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,Gm=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,Wm=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,Xm=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,qm=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,Ym=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,Zm=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,Jm=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,$m=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + 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 ); + + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,Km=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,Qm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,jm=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,tg=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,eg=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,ng=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,ig=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,sg=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,rg=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,ag=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,og=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,lg=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,cg=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,hg=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,ug=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,dg=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,fg=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,pg=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,mg=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,gg=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,_g=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,xg=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); +const float ShiftRight8 = 1. / 256.; +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} +vec2 packDepthToRG( in highp float v ) { + return packDepthToRGBA( v ).yx; +} +float unpackRGToDepth( const in highp vec2 v ) { + return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); +} +vec4 pack2HalfToRGBA( vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,vg=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,yg=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,Mg=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,Sg=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,bg=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,Ag=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,wg=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,Eg=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,Tg=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,Cg=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,Rg=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,Pg=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,Ig=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,Lg=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,Ug=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,Dg=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,Ng=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,Og=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 OptimizedCineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,Fg=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,Bg=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + + #else + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,zg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,kg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,Vg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,Hg=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const Gg=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,Wg=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,Xg=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,qg=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,Yg=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,Zg=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,Jg=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,$g=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #endif +}`,Kg=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,Qg=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,jg=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,t_=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,e_=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,n_=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,i_=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,s_=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,r_=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,a_=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,o_=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,l_=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,c_=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,h_=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,u_=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,d_=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,f_=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,p_=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,m_=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,g_=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,__=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,x_=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,v_=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,y_=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,M_=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,S_=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,kt={alphahash_fragment:Wp,alphahash_pars_fragment:Xp,alphamap_fragment:qp,alphamap_pars_fragment:Yp,alphatest_fragment:Zp,alphatest_pars_fragment:Jp,aomap_fragment:$p,aomap_pars_fragment:Kp,batching_pars_vertex:Qp,batching_vertex:jp,begin_vertex:tm,beginnormal_vertex:em,bsdfs:nm,iridescence_fragment:im,bumpmap_pars_fragment:sm,clipping_planes_fragment:rm,clipping_planes_pars_fragment:am,clipping_planes_pars_vertex:om,clipping_planes_vertex:lm,color_fragment:cm,color_pars_fragment:hm,color_pars_vertex:um,color_vertex:dm,common:fm,cube_uv_reflection_fragment:pm,defaultnormal_vertex:mm,displacementmap_pars_vertex:gm,displacementmap_vertex:_m,emissivemap_fragment:xm,emissivemap_pars_fragment:vm,colorspace_fragment:ym,colorspace_pars_fragment:Mm,envmap_fragment:Sm,envmap_common_pars_fragment:bm,envmap_pars_fragment:Am,envmap_pars_vertex:wm,envmap_physical_pars_fragment:Om,envmap_vertex:Em,fog_vertex:Tm,fog_pars_vertex:Cm,fog_fragment:Rm,fog_pars_fragment:Pm,gradientmap_pars_fragment:Im,lightmap_pars_fragment:Lm,lights_lambert_fragment:Um,lights_lambert_pars_fragment:Dm,lights_pars_begin:Nm,lights_toon_fragment:Fm,lights_toon_pars_fragment:Bm,lights_phong_fragment:zm,lights_phong_pars_fragment:km,lights_physical_fragment:Vm,lights_physical_pars_fragment:Hm,lights_fragment_begin:Gm,lights_fragment_maps:Wm,lights_fragment_end:Xm,logdepthbuf_fragment:qm,logdepthbuf_pars_fragment:Ym,logdepthbuf_pars_vertex:Zm,logdepthbuf_vertex:Jm,map_fragment:$m,map_pars_fragment:Km,map_particle_fragment:Qm,map_particle_pars_fragment:jm,metalnessmap_fragment:tg,metalnessmap_pars_fragment:eg,morphinstance_vertex:ng,morphcolor_vertex:ig,morphnormal_vertex:sg,morphtarget_pars_vertex:rg,morphtarget_vertex:ag,normal_fragment_begin:og,normal_fragment_maps:lg,normal_pars_fragment:cg,normal_pars_vertex:hg,normal_vertex:ug,normalmap_pars_fragment:dg,clearcoat_normal_fragment_begin:fg,clearcoat_normal_fragment_maps:pg,clearcoat_pars_fragment:mg,iridescence_pars_fragment:gg,opaque_fragment:_g,packing:xg,premultiplied_alpha_fragment:vg,project_vertex:yg,dithering_fragment:Mg,dithering_pars_fragment:Sg,roughnessmap_fragment:bg,roughnessmap_pars_fragment:Ag,shadowmap_pars_fragment:wg,shadowmap_pars_vertex:Eg,shadowmap_vertex:Tg,shadowmask_pars_fragment:Cg,skinbase_vertex:Rg,skinning_pars_vertex:Pg,skinning_vertex:Ig,skinnormal_vertex:Lg,specularmap_fragment:Ug,specularmap_pars_fragment:Dg,tonemapping_fragment:Ng,tonemapping_pars_fragment:Og,transmission_fragment:Fg,transmission_pars_fragment:Bg,uv_pars_fragment:zg,uv_pars_vertex:kg,uv_vertex:Vg,worldpos_vertex:Hg,background_vert:Gg,background_frag:Wg,backgroundCube_vert:Xg,backgroundCube_frag:qg,cube_vert:Yg,cube_frag:Zg,depth_vert:Jg,depth_frag:$g,distanceRGBA_vert:Kg,distanceRGBA_frag:Qg,equirect_vert:jg,equirect_frag:t_,linedashed_vert:e_,linedashed_frag:n_,meshbasic_vert:i_,meshbasic_frag:s_,meshlambert_vert:r_,meshlambert_frag:a_,meshmatcap_vert:o_,meshmatcap_frag:l_,meshnormal_vert:c_,meshnormal_frag:h_,meshphong_vert:u_,meshphong_frag:d_,meshphysical_vert:f_,meshphysical_frag:p_,meshtoon_vert:m_,meshtoon_frag:g_,points_vert:__,points_frag:x_,shadow_vert:v_,shadow_frag:y_,sprite_vert:M_,sprite_frag:S_},ot={common:{diffuse:{value:new ft(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Bt},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Bt}},envmap:{envMap:{value:null},envMapRotation:{value:new Bt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Bt},normalScale:{value:new Z(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ft(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ft(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0},uvTransform:{value:new Bt}},sprite:{diffuse:{value:new ft(16777215)},opacity:{value:1},center:{value:new Z(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Bt},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0}}},nn={basic:{uniforms:Ie([ot.common,ot.specularmap,ot.envmap,ot.aomap,ot.lightmap,ot.fog]),vertexShader:kt.meshbasic_vert,fragmentShader:kt.meshbasic_frag},lambert:{uniforms:Ie([ot.common,ot.specularmap,ot.envmap,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.fog,ot.lights,{emissive:{value:new ft(0)}}]),vertexShader:kt.meshlambert_vert,fragmentShader:kt.meshlambert_frag},phong:{uniforms:Ie([ot.common,ot.specularmap,ot.envmap,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.fog,ot.lights,{emissive:{value:new ft(0)},specular:{value:new ft(1118481)},shininess:{value:30}}]),vertexShader:kt.meshphong_vert,fragmentShader:kt.meshphong_frag},standard:{uniforms:Ie([ot.common,ot.envmap,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.roughnessmap,ot.metalnessmap,ot.fog,ot.lights,{emissive:{value:new ft(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag},toon:{uniforms:Ie([ot.common,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.gradientmap,ot.fog,ot.lights,{emissive:{value:new ft(0)}}]),vertexShader:kt.meshtoon_vert,fragmentShader:kt.meshtoon_frag},matcap:{uniforms:Ie([ot.common,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.fog,{matcap:{value:null}}]),vertexShader:kt.meshmatcap_vert,fragmentShader:kt.meshmatcap_frag},points:{uniforms:Ie([ot.points,ot.fog]),vertexShader:kt.points_vert,fragmentShader:kt.points_frag},dashed:{uniforms:Ie([ot.common,ot.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kt.linedashed_vert,fragmentShader:kt.linedashed_frag},depth:{uniforms:Ie([ot.common,ot.displacementmap]),vertexShader:kt.depth_vert,fragmentShader:kt.depth_frag},normal:{uniforms:Ie([ot.common,ot.bumpmap,ot.normalmap,ot.displacementmap,{opacity:{value:1}}]),vertexShader:kt.meshnormal_vert,fragmentShader:kt.meshnormal_frag},sprite:{uniforms:Ie([ot.sprite,ot.fog]),vertexShader:kt.sprite_vert,fragmentShader:kt.sprite_frag},background:{uniforms:{uvTransform:{value:new Bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kt.background_vert,fragmentShader:kt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Bt}},vertexShader:kt.backgroundCube_vert,fragmentShader:kt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kt.cube_vert,fragmentShader:kt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kt.equirect_vert,fragmentShader:kt.equirect_frag},distanceRGBA:{uniforms:Ie([ot.common,ot.displacementmap,{referencePosition:{value:new T},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kt.distanceRGBA_vert,fragmentShader:kt.distanceRGBA_frag},shadow:{uniforms:Ie([ot.lights,ot.fog,{color:{value:new ft(0)},opacity:{value:1}}]),vertexShader:kt.shadow_vert,fragmentShader:kt.shadow_frag}};nn.physical={uniforms:Ie([nn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Bt},clearcoatNormalScale:{value:new Z(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Bt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Bt},sheen:{value:0},sheenColor:{value:new ft(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Bt},transmissionSamplerSize:{value:new Z},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Bt},attenuationDistance:{value:0},attenuationColor:{value:new ft(0)},specularColor:{value:new ft(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Bt},anisotropyVector:{value:new Z},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Bt}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag};const Dr={r:0,b:0,g:0},ii=new Ye,b_=new Rt;function A_(r,t,e,n,i,s,a){const o=new ft(0);let l=s===!0?0:1,c,h,u=null,d=0,f=null;function m(v){let x=v.isScene===!0?v.background:null;return x&&x.isTexture&&(x=(v.backgroundBlurriness>0?e:t).get(x)),x}function _(v){let x=!1;const y=m(v);y===null?p(o,l):y&&y.isColor&&(p(y,1),x=!0);const I=r.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,a):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function g(v,x){const y=m(x);y&&(y.isCubeTexture||y.mapping===os)?(h===void 0&&(h=new _e(new Ei(1,1,1),new rn({name:"BackgroundCubeMaterial",uniforms:rs(nn.backgroundCube.uniforms),vertexShader:nn.backgroundCube.vertexShader,fragmentShader:nn.backgroundCube.fragmentShader,side:De,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(I,w,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),ii.copy(x.backgroundRotation),ii.x*=-1,ii.y*=-1,ii.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(ii.y*=-1,ii.z*=-1),h.material.uniforms.envMap.value=y,h.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(b_.makeRotationFromEuler(ii)),h.material.toneMapped=Kt.getTransfer(y.colorSpace)!==se,(u!==y||d!==y.version||f!==r.toneMapping)&&(h.material.needsUpdate=!0,u=y,d=y.version,f=r.toneMapping),h.layers.enableAll(),v.unshift(h,h.geometry,h.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new _e(new hs(2,2),new rn({name:"BackgroundMaterial",uniforms:rs(nn.background.uniforms),vertexShader:nn.background.vertexShader,fragmentShader:nn.background.fragmentShader,side:Rn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=Kt.getTransfer(y.colorSpace)!==se,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(u!==y||d!==y.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=y,d=y.version,f=r.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,x){v.getRGB(Dr,sd(r)),n.buffers.color.setClear(Dr.r,Dr.g,Dr.b,x,a)}return{getClearColor:function(){return o},setClearColor:function(v,x=1){o.set(v),l=x,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,p(o,l)},render:_,addToRenderList:g}}function w_(r,t){const e=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(M,L,k,O,V){let q=!1;const H=u(O,k,L);s!==H&&(s=H,c(s.object)),q=f(M,O,k,V),q&&m(M,O,k,V),V!==null&&t.update(V,r.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,y(M,L,k,O),V!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(V).buffer))}function l(){return r.createVertexArray()}function c(M){return r.bindVertexArray(M)}function h(M){return r.deleteVertexArray(M)}function u(M,L,k){const O=k.wireframe===!0;let V=n[M.id];V===void 0&&(V={},n[M.id]=V);let q=V[L.id];q===void 0&&(q={},V[L.id]=q);let H=q[O];return H===void 0&&(H=d(l()),q[O]=H),H}function d(M){const L=[],k=[],O=[];for(let V=0;V=0){const yt=V[G];let gt=q[G];if(gt===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(gt=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(gt=M.instanceColor)),yt===void 0||yt.attribute!==gt||gt&&yt.data!==gt.data)return!0;H++}return s.attributesNum!==H||s.index!==O}function m(M,L,k,O){const V={},q=L.attributes;let H=0;const tt=k.getAttributes();for(const G in tt)if(tt[G].location>=0){let yt=q[G];yt===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(yt=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(yt=M.instanceColor));const gt={};gt.attribute=yt,yt&&yt.data&&(gt.data=yt.data),V[G]=gt,H++}s.attributes=V,s.attributesNum=H,s.index=O}function _(){const M=s.newAttributes;for(let L=0,k=M.length;L=0){let pt=V[tt];if(pt===void 0&&(tt==="instanceMatrix"&&M.instanceMatrix&&(pt=M.instanceMatrix),tt==="instanceColor"&&M.instanceColor&&(pt=M.instanceColor)),pt!==void 0){const yt=pt.normalized,gt=pt.itemSize,Gt=t.get(pt);if(Gt===void 0)continue;const $t=Gt.buffer,W=Gt.type,et=Gt.bytesPerElement,xt=W===r.INT||W===r.UNSIGNED_INT||pt.gpuType===Ga;if(pt.isInterleavedBufferAttribute){const ct=pt.data,Lt=ct.stride,Vt=pt.offset;if(ct.isInstancedInterleavedBuffer){for(let Ut=0;Ut0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=e.logarithmicDepthBuffer===!0,d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_TEXTURE_SIZE),_=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),p=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=f>0,I=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:p,maxVaryings:v,maxFragmentUniforms:x,vertexTextures:y,maxSamples:I}}function C_(r){const t=this;let e=null,n=0,i=!1,s=!1;const a=new Wn,o=new Bt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){e=h(u,d,0)},this.setState=function(u,d,f){const m=u.clippingPlanes,_=u.clipIntersection,g=u.clipShadows,p=r.get(u);if(!i||m===null||m.length===0||s&&!g)s?h(null):c();else{const v=s?0:n,x=v*4;let y=p.clippingState||null;l.value=y,y=h(m,d,x,f);for(let I=0;I!==x;++I)y[I]=e[I];p.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(u,d,f,m){const _=u!==null?u.length:0;let g=null;if(_!==0){if(g=l.value,m!==!0||g===null){const p=f+_*4,v=d.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length0){const c=new od(l.height);return c.fromEquirectangularTexture(r,a),t.set(a,c),a.addEventListener("dispose",i),e(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function s(){t=new WeakMap}return{get:n,dispose:s}}class to extends ja{constructor(t=-1,e=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,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=t,this.view.fullHeight=e,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 t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-t,a=n+t,o=i+e,l=i-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}const ji=4,Gc=[.125,.215,.35,.446,.526,.582],fi=20,Xo=new to,Wc=new ft;let qo=null,Yo=0,Zo=0,Jo=!1;const di=(1+Math.sqrt(5))/2,Xi=1/di,Xc=[new T(-di,Xi,0),new T(di,Xi,0),new T(-Xi,0,di),new T(Xi,0,di),new T(0,di,-Xi),new T(0,di,Xi),new T(-1,1,-1),new T(1,1,-1),new T(-1,1,1),new T(1,1,1)];class yl{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){qo=this._renderer.getRenderTarget(),Yo=this._renderer.getActiveCubeFace(),Zo=this._renderer.getActiveMipmapLevel(),Jo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,n,i,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Zc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Yc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?x:0,x,x),h.setRenderTarget(i),_&&h.render(m,o),h.render(t,o)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=d,h.autoClear=u,t.background=g}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===Pn||t.mapping===qn;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Zc()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Yc());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new _e(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=t;const l=this._cubeSize;Nr(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,Xo)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sfi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${fi}`);const p=[];let v=0;for(let C=0;Cx-ji?i-x+ji:0),w=4*(this._cubeSize-y);Nr(e,I,w,3*y,2*y),l.setRenderTarget(e),l.render(u,Xo)}}function P_(r){const t=[],e=[],n=[];let i=r;const s=r-ji+1+Gc.length;for(let a=0;ar-ji?l=Gc[a-r+ji-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,m=6,_=3,g=2,p=1,v=new Float32Array(_*m*f),x=new Float32Array(g*m*f),y=new Float32Array(p*m*f);for(let w=0;w2?0:-1,b=[C,P,0,C+2/3,P,0,C+2/3,P+1,0,C,P,0,C+2/3,P+1,0,C,P+1,0];v.set(b,_*m*w),x.set(d,g*m*w);const M=[w,w,w,w,w,w];y.set(M,p*m*w)}const I=new Ht;I.setAttribute("position",new ie(v,_)),I.setAttribute("uv",new ie(x,g)),I.setAttribute("faceIndex",new ie(y,p)),t.push(I),i>ji&&i--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function qc(r,t,e){const n=new sn(r,t,e);return n.texture.mapping=os,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Nr(r,t,e,n,i){r.viewport.set(t,e,n,i),r.scissor.set(t,e,n,i)}function I_(r,t,e){const n=new Float32Array(fi),i=new T(0,1,0);return new rn({name:"SphericalGaussianBlur",defines:{n:fi,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,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:Yl(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Tn,depthTest:!1,depthWrite:!1})}function Yc(){return new rn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Yl(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Tn,depthTest:!1,depthWrite:!1})}function Zc(){return new rn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Yl(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Tn,depthTest:!1,depthWrite:!1})}function Yl(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function L_(r){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Fs||l===Bs,h=l===Pn||l===qn;if(c||h){let u=t.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return e===null&&(e=new yl(r)),u=c?e.fromEquirectangular(o,u):e.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),u.texture;if(u!==void 0)return u.texture;{const f=o.image;return c&&f&&f.height>0||h&&f&&i(f)?(e===null&&(e=new yl(r)),u=c?e.fromEquirectangular(o):e.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function i(o){let l=0;const c=6;for(let h=0;ht.maxTextureSize&&(I=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);const w=new Float32Array(y*I*4*u),C=new Ka(w,y,I,u);C.type=Be,C.needsUpdate=!0;const P=x*4;for(let M=0;M0)return r;const i=t*e;let s=$c[i];if(s===void 0&&(s=new Float32Array(i),$c[i]=s),t!==0){n.toArray(s,0);for(let a=1,o=0;a!==t;++a)o+=e,r[a].toArray(s,o)}return s}function xe(r,t){if(r.length!==t.length)return!1;for(let e=0,n=r.length;e":" "} ${o}: ${e[a]}`)}return n.join(` +`)}function L0(r){const t=Kt.getPrimaries(Kt.workingColorSpace),e=Kt.getPrimaries(r);let n;switch(t===e?n="":t===Xs&&e===Ws?n="LinearDisplayP3ToLinearSRGB":t===Ws&&e===Xs&&(n="LinearSRGBToLinearDisplayP3"),r){case Un:case rr:return[n,"LinearTransferOETF"];case $e:case $a:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function ih(r,t,e){const n=r.getShaderParameter(t,r.COMPILE_STATUS),i=r.getShaderInfoLog(t).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return e.toUpperCase()+` + +`+i+` + +`+I0(r.getShaderSource(t),a)}else return i}function U0(r,t){const e=L0(t);return`vec4 ${r}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function D0(r,t){let e;switch(t){case Lu:e="Linear";break;case Uu:e="Reinhard";break;case Du:e="OptimizedCineon";break;case Nu:e="ACESFilmic";break;case Fu:e="AgX";break;case Bu:e="Neutral";break;case Ou:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}function N0(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Es).join(` +`)}function O0(r){const t=[];for(const e in r){const n=r[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` +`)}function F0(r,t){const e={},n=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Ml(r){return r.replace(B0,k0)}const z0=new Map;function k0(r,t){let e=kt[t];if(e===void 0){const n=z0.get(t);if(n!==void 0)e=kt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return Ml(e)}const V0=/#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 ah(r){return r.replace(V0,H0)}function H0(r,t,e,n){let i="";for(let s=parseInt(t);s0&&(g+=` +`),p=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(Es).join(` +`),p.length>0&&(p+=` +`)):(g=[oh(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Es).join(` +`),p=[oh(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Cn?"#define TONE_MAPPING":"",e.toneMapping!==Cn?kt.tonemapping_pars_fragment:"",e.toneMapping!==Cn?D0("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",kt.colorspace_pars_fragment,U0("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` +`].filter(Es).join(` +`)),a=Ml(a),a=sh(a,e),a=rh(a,e),o=Ml(o),o=sh(o,e),o=rh(o,e),a=ah(a),o=ah(o),e.isRawShaderMaterial!==!0&&(v=`#version 300 es +`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+g,p=["#define varying in",e.glslVersion===vl?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===vl?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+p);const x=v+g+a,y=v+p+o,I=nh(i,i.VERTEX_SHADER,x),w=nh(i,i.FRAGMENT_SHADER,y);i.attachShader(_,I),i.attachShader(_,w),e.index0AttributeName!==void 0?i.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function C(L){if(r.debug.checkShaderErrors){const k=i.getProgramInfoLog(_).trim(),O=i.getShaderInfoLog(I).trim(),V=i.getShaderInfoLog(w).trim();let q=!0,H=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(q=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,I,w);else{const tt=ih(i,I,"vertex"),G=ih(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+` + +Material Name: `+L.name+` +Material Type: `+L.type+` + +Program Info Log: `+k+` +`+tt+` +`+G)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(O===""||V==="")&&(H=!1);H&&(L.diagnostics={runnable:q,programLog:k,vertexShader:{log:O,prefix:g},fragmentShader:{log:V,prefix:p}})}i.deleteShader(I),i.deleteShader(w),P=new la(i,_),b=F0(i,_)}let P;this.getUniforms=function(){return P===void 0&&C(this),P};let b;this.getAttributes=function(){return b===void 0&&C(this),b};let M=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(_,R0)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=P0++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=I,this.fragmentShader=w,this}let J0=0;class $0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new K0(t),e.set(t,n)),n}}class K0{constructor(t){this.id=J0++,this.code=t,this.usedTimes=0}}function Q0(r,t,e,n,i,s,a){const o=new Qa,l=new $0,c=new Set,h=[],u=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={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 _(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,M,L,k,O){const V=k.fog,q=O.geometry,H=b.isMeshStandardMaterial?k.environment:null,tt=(b.isMeshStandardMaterial?e:t).get(b.envMap||H),G=tt&&tt.mapping===os?tt.image.height:null,pt=m[b.type];b.precision!==null&&(f=i.getMaxPrecision(b.precision),f!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",f,"instead."));const yt=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,gt=yt!==void 0?yt.length:0;let Gt=0;q.morphAttributes.position!==void 0&&(Gt=1),q.morphAttributes.normal!==void 0&&(Gt=2),q.morphAttributes.color!==void 0&&(Gt=3);let $t,W,et,xt;if(pt){const Qt=nn[pt];$t=Qt.vertexShader,W=Qt.fragmentShader}else $t=b.vertexShader,W=b.fragmentShader,l.update(b),et=l.getVertexShaderID(b),xt=l.getFragmentShaderID(b);const ct=r.getRenderTarget(),Lt=O.isInstancedMesh===!0,Vt=O.isBatchedMesh===!0,Ut=!!b.map,Jt=!!b.matcap,E=!!tt,it=!!b.aoMap,j=!!b.lightMap,ht=!!b.bumpMap,X=!!b.normalMap,Tt=!!b.displacementMap,ut=!!b.emissiveMap,vt=!!b.metalnessMap,R=!!b.roughnessMap,S=b.anisotropy>0,B=b.clearcoat>0,Q=b.dispersion>0,K=b.iridescence>0,$=b.sheen>0,Et=b.transmission>0,lt=S&&!!b.anisotropyMap,_t=B&&!!b.clearcoatMap,Ft=B&&!!b.clearcoatNormalMap,nt=B&&!!b.clearcoatRoughnessMap,mt=K&&!!b.iridescenceMap,Xt=K&&!!b.iridescenceThicknessMap,Nt=$&&!!b.sheenColorMap,Mt=$&&!!b.sheenRoughnessMap,Ot=!!b.specularMap,Wt=!!b.specularColorMap,re=!!b.specularIntensityMap,U=Et&&!!b.transmissionMap,st=Et&&!!b.thicknessMap,Y=!!b.gradientMap,J=!!b.alphaMap,at=b.alphaTest>0,Pt=!!b.alphaHash,qt=!!b.extensions;let fe=Cn;b.toneMapped&&(ct===null||ct.isXRRenderTarget===!0)&&(fe=r.toneMapping);const Se={shaderID:pt,shaderType:b.type,shaderName:b.name,vertexShader:$t,fragmentShader:W,defines:b.defines,customVertexShaderID:et,customFragmentShaderID:xt,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:f,batching:Vt,batchingColor:Vt&&O._colorsTexture!==null,instancing:Lt,instancingColor:Lt&&O.instanceColor!==null,instancingMorph:Lt&&O.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ct===null?r.outputColorSpace:ct.isXRRenderTarget===!0?ct.texture.colorSpace:Un,alphaToCoverage:!!b.alphaToCoverage,map:Ut,matcap:Jt,envMap:E,envMapMode:E&&tt.mapping,envMapCubeUVHeight:G,aoMap:it,lightMap:j,bumpMap:ht,normalMap:X,displacementMap:d&&Tt,emissiveMap:ut,normalMapObjectSpace:X&&b.normalMapType===Xu,normalMapTangentSpace:X&&b.normalMapType===Zn,metalnessMap:vt,roughnessMap:R,anisotropy:S,anisotropyMap:lt,clearcoat:B,clearcoatMap:_t,clearcoatNormalMap:Ft,clearcoatRoughnessMap:nt,dispersion:Q,iridescence:K,iridescenceMap:mt,iridescenceThicknessMap:Xt,sheen:$,sheenColorMap:Nt,sheenRoughnessMap:Mt,specularMap:Ot,specularColorMap:Wt,specularIntensityMap:re,transmission:Et,transmissionMap:U,thicknessMap:st,gradientMap:Y,opaque:b.transparent===!1&&b.blending===xi&&b.alphaToCoverage===!1,alphaMap:J,alphaTest:at,alphaHash:Pt,combine:b.combine,mapUv:Ut&&_(b.map.channel),aoMapUv:it&&_(b.aoMap.channel),lightMapUv:j&&_(b.lightMap.channel),bumpMapUv:ht&&_(b.bumpMap.channel),normalMapUv:X&&_(b.normalMap.channel),displacementMapUv:Tt&&_(b.displacementMap.channel),emissiveMapUv:ut&&_(b.emissiveMap.channel),metalnessMapUv:vt&&_(b.metalnessMap.channel),roughnessMapUv:R&&_(b.roughnessMap.channel),anisotropyMapUv:lt&&_(b.anisotropyMap.channel),clearcoatMapUv:_t&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:Ft&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:mt&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:Xt&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:Nt&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:Mt&&_(b.sheenRoughnessMap.channel),specularMapUv:Ot&&_(b.specularMap.channel),specularColorMapUv:Wt&&_(b.specularColorMap.channel),specularIntensityMapUv:re&&_(b.specularIntensityMap.channel),transmissionMapUv:U&&_(b.transmissionMap.channel),thicknessMapUv:st&&_(b.thicknessMap.channel),alphaMapUv:J&&_(b.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(X||S),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!q.attributes.uv&&(Ut||J),fog:!!V,useFog:b.fog===!0,fogExp2:!!V&&V.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:O.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:gt,morphTextureStride:Gt,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&L.length>0,shadowMapType:r.shadowMap.type,toneMapping:fe,decodeVideoTexture:Ut&&b.map.isVideoTexture===!0&&Kt.getTransfer(b.map.colorSpace)===se,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===hn,flipSided:b.side===De,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:qt&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(qt&&b.extensions.multiDraw===!0||Vt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return Se.vertexUv1s=c.has(1),Se.vertexUv2s=c.has(2),Se.vertexUv3s=c.has(3),c.clear(),Se}function p(b){const M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(const L in b.defines)M.push(L),M.push(b.defines[L]);return b.isRawShaderMaterial===!1&&(v(M,b),x(M,b),M.push(r.outputColorSpace)),M.push(b.customProgramCacheKey),M.join()}function v(b,M){b.push(M.precision),b.push(M.outputColorSpace),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.mapUv),b.push(M.alphaMapUv),b.push(M.lightMapUv),b.push(M.aoMapUv),b.push(M.bumpMapUv),b.push(M.normalMapUv),b.push(M.displacementMapUv),b.push(M.emissiveMapUv),b.push(M.metalnessMapUv),b.push(M.roughnessMapUv),b.push(M.anisotropyMapUv),b.push(M.clearcoatMapUv),b.push(M.clearcoatNormalMapUv),b.push(M.clearcoatRoughnessMapUv),b.push(M.iridescenceMapUv),b.push(M.iridescenceThicknessMapUv),b.push(M.sheenColorMapUv),b.push(M.sheenRoughnessMapUv),b.push(M.specularMapUv),b.push(M.specularColorMapUv),b.push(M.specularIntensityMapUv),b.push(M.transmissionMapUv),b.push(M.thicknessMapUv),b.push(M.combine),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.numLightProbes),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function x(b,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),M.dispersion&&o.enable(20),M.batchingColor&&o.enable(21),b.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.skinning&&o.enable(4),M.morphTargets&&o.enable(5),M.morphNormals&&o.enable(6),M.morphColors&&o.enable(7),M.premultipliedAlpha&&o.enable(8),M.shadowMapEnabled&&o.enable(9),M.doubleSided&&o.enable(10),M.flipSided&&o.enable(11),M.useDepthPacking&&o.enable(12),M.dithering&&o.enable(13),M.transmission&&o.enable(14),M.sheen&&o.enable(15),M.opaque&&o.enable(16),M.pointsUvs&&o.enable(17),M.decodeVideoTexture&&o.enable(18),M.alphaToCoverage&&o.enable(19),b.push(o.mask)}function y(b){const M=m[b.type];let L;if(M){const k=nn[M];L=rd.clone(k.uniforms)}else L=b.uniforms;return L}function I(b,M){let L;for(let k=0,O=h.length;k0?n.push(p):f.transparent===!0?i.push(p):e.push(p)}function l(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):e.unshift(p)}function c(u,d){e.length>1&&e.sort(u||tx),n.length>1&&n.sort(d||lh),i.length>1&&i.sort(d||lh)}function h(){for(let u=t,d=r.length;u=s.length?(a=new ch,s.push(a)):a=s[i],a}function e(){r=new WeakMap}return{get:t,dispose:e}}function nx(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new T,color:new ft};break;case"SpotLight":e={position:new T,direction:new T,color:new ft,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new T,color:new ft,distance:0,decay:0};break;case"HemisphereLight":e={direction:new T,skyColor:new ft,groundColor:new ft};break;case"RectAreaLight":e={color:new ft,position:new T,halfWidth:new T,halfHeight:new T};break}return r[t.id]=e,e}}}function ix(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}let sx=0;function rx(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function ax(r){const t=new nx,e=ix(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new T);const i=new T,s=new Rt,a=new Rt;function o(c){let h=0,u=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,v=0,x=0,y=0,I=0,w=0,C=0;c.sort(rx);for(let b=0,M=c.length;b0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ot.LTC_FLOAT_1,n.rectAreaLTC2=ot.LTC_FLOAT_2):(n.rectAreaLTC1=ot.LTC_HALF_1,n.rectAreaLTC2=ot.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const P=n.hash;(P.directionalLength!==f||P.pointLength!==m||P.spotLength!==_||P.rectAreaLength!==g||P.hemiLength!==p||P.numDirectionalShadows!==v||P.numPointShadows!==x||P.numSpotShadows!==y||P.numSpotMaps!==I||P.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=y+I-w,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=C,P.directionalLength=f,P.pointLength=m,P.spotLength=_,P.rectAreaLength=g,P.hemiLength=p,P.numDirectionalShadows=v,P.numPointShadows=x,P.numSpotShadows=y,P.numSpotMaps=I,P.numLightProbes=C,n.version=sx++)}function l(c,h){let u=0,d=0,f=0,m=0,_=0;const g=h.matrixWorldInverse;for(let p=0,v=c.length;p=a.length?(o=new hh(r),a.push(o)):o=a[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}class Jl extends Re{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Gu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class $l extends Re{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const lx=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,cx=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function hx(r,t,e){let n=new or;const i=new Z,s=new Z,a=new ne,o=new Jl({depthPacking:Wu}),l=new $l,c={},h=e.maxTextureSize,u={[Rn]:De,[De]:Rn,[hn]:hn},d=new rn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Z},radius:{value:4}},vertexShader:lx,fragmentShader:cx}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Ht;m.setAttribute("position",new ie(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new _e(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Rl;let p=this.type;this.render=function(w,C,P){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;const b=r.getRenderTarget(),M=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),k=r.state;k.setBlending(Tn),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const O=p!==cn&&this.type===cn,V=p===cn&&this.type!==cn;for(let q=0,H=w.length;qh||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/pt.x),i.x=s.x*pt.x,G.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/pt.y),i.y=s.y*pt.y,G.mapSize.y=s.y)),G.map===null||O===!0||V===!0){const gt=this.type!==cn?{minFilter:Me,magFilter:Me}:{};G.map!==null&&G.map.dispose(),G.map=new sn(i.x,i.y,gt),G.map.texture.name=tt.name+".shadowMap",G.camera.updateProjectionMatrix()}r.setRenderTarget(G.map),r.clear();const yt=G.getViewportCount();for(let gt=0;gt0||C.map&&C.alphaTest>0){const k=M.uuid,O=C.uuid;let V=c[k];V===void 0&&(V={},c[k]=V);let q=V[O];q===void 0&&(q=M.clone(),V[O]=q,C.addEventListener("dispose",I)),M=q}if(M.visible=C.visible,M.wireframe=C.wireframe,b===cn?M.side=C.shadowSide!==null?C.shadowSide:C.side:M.side=C.shadowSide!==null?C.shadowSide:u[C.side],M.alphaMap=C.alphaMap,M.alphaTest=C.alphaTest,M.map=C.map,M.clipShadows=C.clipShadows,M.clippingPlanes=C.clippingPlanes,M.clipIntersection=C.clipIntersection,M.displacementMap=C.displacementMap,M.displacementScale=C.displacementScale,M.displacementBias=C.displacementBias,M.wireframeLinewidth=C.wireframeLinewidth,M.linewidth=C.linewidth,P.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const k=r.properties.get(M);k.light=P}return M}function y(w,C,P,b,M){if(w.visible===!1)return;if(w.layers.test(C.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&M===cn)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,w.matrixWorld);const O=t.update(w),V=w.material;if(Array.isArray(V)){const q=O.groups;for(let H=0,tt=q.length;H=1):tt.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(tt)[1]),q=H>=2);let G=null,pt={};const yt=r.getParameter(r.SCISSOR_BOX),gt=r.getParameter(r.VIEWPORT),Gt=new ne().fromArray(yt),$t=new ne().fromArray(gt);function W(U,st,Y,J){const at=new Uint8Array(4),Pt=r.createTexture();r.bindTexture(U,Pt),r.texParameteri(U,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(U,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let qt=0;qtt?(r.repeat.x=1,r.repeat.y=e/t,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=t/e,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function fx(r,t){const e=r.image&&r.image.width?r.image.width/r.image.height:1;return e>t?(r.repeat.x=t/e,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=e/t,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function px(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Sl(r,t,e,n){const i=mx(n);switch(e){case Dl:return r*t;case Ol:return r*t;case Fl:return r*t*2;case qa:return r*t/i.components*i.byteLength;case sr:return r*t/i.components*i.byteLength;case Bl:return r*t*2/i.components*i.byteLength;case Ya:return r*t*2/i.components*i.byteLength;case Nl:return r*t*3/i.components*i.byteLength;case Ue:return r*t*4/i.components*i.byteLength;case Za:return r*t*4/i.components*i.byteLength;case Cs:case Rs:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case Ps:case Is:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case da:case pa:return Math.max(r,16)*Math.max(t,8)/4;case ua:case fa:return Math.max(r,8)*Math.max(t,8)/2;case ma:case ga:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case _a:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case xa:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case va:return Math.floor((r+4)/5)*Math.floor((t+3)/4)*16;case ya:return Math.floor((r+4)/5)*Math.floor((t+4)/5)*16;case Ma:return Math.floor((r+5)/6)*Math.floor((t+4)/5)*16;case Sa:return Math.floor((r+5)/6)*Math.floor((t+5)/6)*16;case ba:return Math.floor((r+7)/8)*Math.floor((t+4)/5)*16;case Aa:return Math.floor((r+7)/8)*Math.floor((t+5)/6)*16;case wa:return Math.floor((r+7)/8)*Math.floor((t+7)/8)*16;case Ea:return Math.floor((r+9)/10)*Math.floor((t+4)/5)*16;case Ta:return Math.floor((r+9)/10)*Math.floor((t+5)/6)*16;case Ca:return Math.floor((r+9)/10)*Math.floor((t+7)/8)*16;case Ra:return Math.floor((r+9)/10)*Math.floor((t+9)/10)*16;case Pa:return Math.floor((r+11)/12)*Math.floor((t+9)/10)*16;case Ia:return Math.floor((r+11)/12)*Math.floor((t+11)/12)*16;case Ls:case La:case Ua:return Math.ceil(r/4)*Math.ceil(t/4)*16;case zl:case Da:return Math.ceil(r/4)*Math.ceil(t/4)*8;case Na:case Oa:return Math.ceil(r/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function mx(r){switch(r){case mn:case Il:return{byteLength:1,components:1};case is:case Ll:case ls:return{byteLength:2,components:1};case Wa:case Xa:return{byteLength:2,components:4};case In:case Ga:case Be:return{byteLength:4,components:1};case Ul:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}const gx={contain:dx,cover:fx,fill:px,getByteLength:Sl};function _x(r,t,e,n,i,s,a){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Z,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(R,S){return f?new OffscreenCanvas(R,S):Zs("canvas")}function _(R,S,B){let Q=1;const K=vt(R);if((K.width>B||K.height>B)&&(Q=B/Math.max(K.width,K.height)),Q<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const $=Math.floor(Q*K.width),Et=Math.floor(Q*K.height);u===void 0&&(u=m($,Et));const lt=S?m($,Et):u;return lt.width=$,lt.height=Et,lt.getContext("2d").drawImage(R,0,0,$,Et),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+$+"x"+Et+")."),lt}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),R;return R}function g(R){return R.generateMipmaps&&R.minFilter!==Me&&R.minFilter!==ge}function p(R){r.generateMipmap(R)}function v(R,S,B,Q,K=!1){if(R!==null){if(r[R]!==void 0)return r[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let $=S;if(S===r.RED&&(B===r.FLOAT&&($=r.R32F),B===r.HALF_FLOAT&&($=r.R16F),B===r.UNSIGNED_BYTE&&($=r.R8)),S===r.RED_INTEGER&&(B===r.UNSIGNED_BYTE&&($=r.R8UI),B===r.UNSIGNED_SHORT&&($=r.R16UI),B===r.UNSIGNED_INT&&($=r.R32UI),B===r.BYTE&&($=r.R8I),B===r.SHORT&&($=r.R16I),B===r.INT&&($=r.R32I)),S===r.RG&&(B===r.FLOAT&&($=r.RG32F),B===r.HALF_FLOAT&&($=r.RG16F),B===r.UNSIGNED_BYTE&&($=r.RG8)),S===r.RG_INTEGER&&(B===r.UNSIGNED_BYTE&&($=r.RG8UI),B===r.UNSIGNED_SHORT&&($=r.RG16UI),B===r.UNSIGNED_INT&&($=r.RG32UI),B===r.BYTE&&($=r.RG8I),B===r.SHORT&&($=r.RG16I),B===r.INT&&($=r.RG32I)),S===r.RGB&&B===r.UNSIGNED_INT_5_9_9_9_REV&&($=r.RGB9_E5),S===r.RGBA){const Et=K?Gs:Kt.getTransfer(Q);B===r.FLOAT&&($=r.RGBA32F),B===r.HALF_FLOAT&&($=r.RGBA16F),B===r.UNSIGNED_BYTE&&($=Et===se?r.SRGB8_ALPHA8:r.RGBA8),B===r.UNSIGNED_SHORT_4_4_4_4&&($=r.RGBA4),B===r.UNSIGNED_SHORT_5_5_5_1&&($=r.RGB5_A1)}return($===r.R16F||$===r.R32F||$===r.RG16F||$===r.RG32F||$===r.RGBA16F||$===r.RGBA32F)&&t.get("EXT_color_buffer_float"),$}function x(R,S){let B;return R?S===null||S===In||S===Si?B=r.DEPTH24_STENCIL8:S===Be?B=r.DEPTH32F_STENCIL8:S===is&&(B=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===In||S===Si?B=r.DEPTH_COMPONENT24:S===Be?B=r.DEPTH_COMPONENT32F:S===is&&(B=r.DEPTH_COMPONENT16),B}function y(R,S){return g(R)===!0||R.isFramebufferTexture&&R.minFilter!==Me&&R.minFilter!==ge?Math.log2(Math.max(S.width,S.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?S.mipmaps.length:1}function I(R){const S=R.target;S.removeEventListener("dispose",I),C(S),S.isVideoTexture&&h.delete(S)}function w(R){const S=R.target;S.removeEventListener("dispose",w),b(S)}function C(R){const S=n.get(R);if(S.__webglInit===void 0)return;const B=R.source,Q=d.get(B);if(Q){const K=Q[S.__cacheKey];K.usedTimes--,K.usedTimes===0&&P(R),Object.keys(Q).length===0&&d.delete(B)}n.remove(R)}function P(R){const S=n.get(R);r.deleteTexture(S.__webglTexture);const B=R.source,Q=d.get(B);delete Q[S.__cacheKey],a.memory.textures--}function b(R){const S=n.get(R);if(R.depthTexture&&R.depthTexture.dispose(),R.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(S.__webglFramebuffer[Q]))for(let K=0;K=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),M+=1,R}function O(R){const S=[];return S.push(R.wrapS),S.push(R.wrapT),S.push(R.wrapR||0),S.push(R.magFilter),S.push(R.minFilter),S.push(R.anisotropy),S.push(R.internalFormat),S.push(R.format),S.push(R.type),S.push(R.generateMipmaps),S.push(R.premultiplyAlpha),S.push(R.flipY),S.push(R.unpackAlignment),S.push(R.colorSpace),S.join()}function V(R,S){const B=n.get(R);if(R.isVideoTexture&&Tt(R),R.isRenderTargetTexture===!1&&R.version>0&&B.__version!==R.version){const Q=R.image;if(Q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{$t(B,R,S);return}}e.bindTexture(r.TEXTURE_2D,B.__webglTexture,r.TEXTURE0+S)}function q(R,S){const B=n.get(R);if(R.version>0&&B.__version!==R.version){$t(B,R,S);return}e.bindTexture(r.TEXTURE_2D_ARRAY,B.__webglTexture,r.TEXTURE0+S)}function H(R,S){const B=n.get(R);if(R.version>0&&B.__version!==R.version){$t(B,R,S);return}e.bindTexture(r.TEXTURE_3D,B.__webglTexture,r.TEXTURE0+S)}function tt(R,S){const B=n.get(R);if(R.version>0&&B.__version!==R.version){W(B,R,S);return}e.bindTexture(r.TEXTURE_CUBE_MAP,B.__webglTexture,r.TEXTURE0+S)}const G={[zs]:r.REPEAT,[Ke]:r.CLAMP_TO_EDGE,[ks]:r.MIRRORED_REPEAT},pt={[Me]:r.NEAREST,[Pl]:r.NEAREST_MIPMAP_NEAREST,[Ki]:r.NEAREST_MIPMAP_LINEAR,[ge]:r.LINEAR,[Ts]:r.LINEAR_MIPMAP_NEAREST,[un]:r.LINEAR_MIPMAP_LINEAR},yt={[qu]:r.NEVER,[Qu]:r.ALWAYS,[Yu]:r.LESS,[Vl]:r.LEQUAL,[Zu]:r.EQUAL,[Ku]:r.GEQUAL,[Ju]:r.GREATER,[$u]:r.NOTEQUAL};function gt(R,S){if(S.type===Be&&t.has("OES_texture_float_linear")===!1&&(S.magFilter===ge||S.magFilter===Ts||S.magFilter===Ki||S.magFilter===un||S.minFilter===ge||S.minFilter===Ts||S.minFilter===Ki||S.minFilter===un)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(R,r.TEXTURE_WRAP_S,G[S.wrapS]),r.texParameteri(R,r.TEXTURE_WRAP_T,G[S.wrapT]),(R===r.TEXTURE_3D||R===r.TEXTURE_2D_ARRAY)&&r.texParameteri(R,r.TEXTURE_WRAP_R,G[S.wrapR]),r.texParameteri(R,r.TEXTURE_MAG_FILTER,pt[S.magFilter]),r.texParameteri(R,r.TEXTURE_MIN_FILTER,pt[S.minFilter]),S.compareFunction&&(r.texParameteri(R,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(R,r.TEXTURE_COMPARE_FUNC,yt[S.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Me||S.minFilter!==Ki&&S.minFilter!==un||S.type===Be&&t.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const B=t.get("EXT_texture_filter_anisotropic");r.texParameterf(R,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function Gt(R,S){let B=!1;R.__webglInit===void 0&&(R.__webglInit=!0,S.addEventListener("dispose",I));const Q=S.source;let K=d.get(Q);K===void 0&&(K={},d.set(Q,K));const $=O(S);if($!==R.__cacheKey){K[$]===void 0&&(K[$]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,B=!0),K[$].usedTimes++;const Et=K[R.__cacheKey];Et!==void 0&&(K[R.__cacheKey].usedTimes--,Et.usedTimes===0&&P(S)),R.__cacheKey=$,R.__webglTexture=K[$].texture}return B}function $t(R,S,B){let Q=r.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Q=r.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Q=r.TEXTURE_3D);const K=Gt(R,S),$=S.source;e.bindTexture(Q,R.__webglTexture,r.TEXTURE0+B);const Et=n.get($);if($.version!==Et.__version||K===!0){e.activeTexture(r.TEXTURE0+B);const lt=Kt.getPrimaries(Kt.workingColorSpace),_t=S.colorSpace===An?null:Kt.getPrimaries(S.colorSpace),Ft=S.colorSpace===An||lt===_t?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,S.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,S.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ft);let nt=_(S.image,!1,i.maxTextureSize);nt=ut(S,nt);const mt=s.convert(S.format,S.colorSpace),Xt=s.convert(S.type);let Nt=v(S.internalFormat,mt,Xt,S.colorSpace,S.isVideoTexture);gt(Q,S);let Mt;const Ot=S.mipmaps,Wt=S.isVideoTexture!==!0,re=Et.__version===void 0||K===!0,U=$.dataReady,st=y(S,nt);if(S.isDepthTexture)Nt=x(S.format===bi,S.type),re&&(Wt?e.texStorage2D(r.TEXTURE_2D,1,Nt,nt.width,nt.height):e.texImage2D(r.TEXTURE_2D,0,Nt,nt.width,nt.height,0,mt,Xt,null));else if(S.isDataTexture)if(Ot.length>0){Wt&&re&&e.texStorage2D(r.TEXTURE_2D,st,Nt,Ot[0].width,Ot[0].height);for(let Y=0,J=Ot.length;Y0){const at=Sl(Mt.width,Mt.height,S.format,S.type);for(const Pt of S.layerUpdates){const qt=Mt.data.subarray(Pt*at/Mt.data.BYTES_PER_ELEMENT,(Pt+1)*at/Mt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Y,0,0,Pt,Mt.width,Mt.height,1,mt,qt,0,0)}S.clearLayerUpdates()}else e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Y,0,0,0,Mt.width,Mt.height,nt.depth,mt,Mt.data,0,0)}else e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Y,Nt,Mt.width,Mt.height,nt.depth,0,Mt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Wt?U&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,Y,0,0,0,Mt.width,Mt.height,nt.depth,mt,Xt,Mt.data):e.texImage3D(r.TEXTURE_2D_ARRAY,Y,Nt,Mt.width,Mt.height,nt.depth,0,mt,Xt,Mt.data)}else{Wt&&re&&e.texStorage2D(r.TEXTURE_2D,st,Nt,Ot[0].width,Ot[0].height);for(let Y=0,J=Ot.length;Y0){const Y=Sl(nt.width,nt.height,S.format,S.type);for(const J of S.layerUpdates){const at=nt.data.subarray(J*Y/nt.data.BYTES_PER_ELEMENT,(J+1)*Y/nt.data.BYTES_PER_ELEMENT);e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,J,nt.width,nt.height,1,mt,Xt,at)}S.clearLayerUpdates()}else e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,nt.width,nt.height,nt.depth,mt,Xt,nt.data)}else e.texImage3D(r.TEXTURE_2D_ARRAY,0,Nt,nt.width,nt.height,nt.depth,0,mt,Xt,nt.data);else if(S.isData3DTexture)Wt?(re&&e.texStorage3D(r.TEXTURE_3D,st,Nt,nt.width,nt.height,nt.depth),U&&e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,nt.width,nt.height,nt.depth,mt,Xt,nt.data)):e.texImage3D(r.TEXTURE_3D,0,Nt,nt.width,nt.height,nt.depth,0,mt,Xt,nt.data);else if(S.isFramebufferTexture){if(re)if(Wt)e.texStorage2D(r.TEXTURE_2D,st,Nt,nt.width,nt.height);else{let Y=nt.width,J=nt.height;for(let at=0;at>=1,J>>=1}}else if(Ot.length>0){if(Wt&&re){const Y=vt(Ot[0]);e.texStorage2D(r.TEXTURE_2D,st,Nt,Y.width,Y.height)}for(let Y=0,J=Ot.length;Y0&&st++;const J=vt(mt[0]);e.texStorage2D(r.TEXTURE_CUBE_MAP,st,Ot,J.width,J.height)}for(let J=0;J<6;J++)if(nt){Wt?U&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,mt[J].width,mt[J].height,Nt,Mt,mt[J].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Ot,mt[J].width,mt[J].height,0,Nt,Mt,mt[J].data);for(let at=0;at>$),mt=Math.max(1,S.height>>$);K===r.TEXTURE_3D||K===r.TEXTURE_2D_ARRAY?e.texImage3D(K,$,_t,nt,mt,S.depth,0,Et,lt,null):e.texImage2D(K,$,_t,nt,mt,0,Et,lt,null)}e.bindFramebuffer(r.FRAMEBUFFER,R),X(S)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Q,K,n.get(B).__webglTexture,0,ht(S)):(K===r.TEXTURE_2D||K>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Q,K,n.get(B).__webglTexture,$),e.bindFramebuffer(r.FRAMEBUFFER,null)}function xt(R,S,B){if(r.bindRenderbuffer(r.RENDERBUFFER,R),S.depthBuffer){const Q=S.depthTexture,K=Q&&Q.isDepthTexture?Q.type:null,$=x(S.stencilBuffer,K),Et=S.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,lt=ht(S);X(S)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,lt,$,S.width,S.height):B?r.renderbufferStorageMultisample(r.RENDERBUFFER,lt,$,S.width,S.height):r.renderbufferStorage(r.RENDERBUFFER,$,S.width,S.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Et,r.RENDERBUFFER,R)}else{const Q=S.textures;for(let K=0;K1;if(Et||(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=S.version,a.memory.textures++),$){B.__webglFramebuffer=[];for(let lt=0;lt<6;lt++)if(S.mipmaps&&S.mipmaps.length>0){B.__webglFramebuffer[lt]=[];for(let _t=0;_t0){B.__webglFramebuffer=[];for(let lt=0;lt0&&X(R)===!1){B.__webglMultisampledFramebuffer=r.createFramebuffer(),B.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let lt=0;lt0)for(let _t=0;_t0)for(let _t=0;_t0){if(X(R)===!1){const S=R.textures,B=R.width,Q=R.height;let K=r.COLOR_BUFFER_BIT;const $=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Et=n.get(R),lt=S.length>1;if(lt)for(let _t=0;_t0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function Tt(R){const S=a.render.frame;h.get(R)!==S&&(h.set(R,S),R.update())}function ut(R,S){const B=R.colorSpace,Q=R.format,K=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||B!==Un&&B!==An&&(Kt.getTransfer(B)===se?(Q!==Ue||K!==mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),S}function vt(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=L,this.setTexture2D=V,this.setTexture2DArray=q,this.setTexture3D=H,this.setTextureCube=tt,this.rebindTextures=Vt,this.setupRenderTarget=Ut,this.updateRenderTargetMipmap=Jt,this.updateMultisampleRenderTarget=j,this.setupDepthRenderbuffer=Lt,this.setupFrameBufferTexture=et,this.useMultisampledRTT=X}function fd(r,t){function e(n,i=An){let s;const a=Kt.getTransfer(i);if(n===mn)return r.UNSIGNED_BYTE;if(n===Wa)return r.UNSIGNED_SHORT_4_4_4_4;if(n===Xa)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Ul)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Il)return r.BYTE;if(n===Ll)return r.SHORT;if(n===is)return r.UNSIGNED_SHORT;if(n===Ga)return r.INT;if(n===In)return r.UNSIGNED_INT;if(n===Be)return r.FLOAT;if(n===ls)return r.HALF_FLOAT;if(n===Dl)return r.ALPHA;if(n===Nl)return r.RGB;if(n===Ue)return r.RGBA;if(n===Ol)return r.LUMINANCE;if(n===Fl)return r.LUMINANCE_ALPHA;if(n===vi)return r.DEPTH_COMPONENT;if(n===bi)return r.DEPTH_STENCIL;if(n===qa)return r.RED;if(n===sr)return r.RED_INTEGER;if(n===Bl)return r.RG;if(n===Ya)return r.RG_INTEGER;if(n===Za)return r.RGBA_INTEGER;if(n===Cs||n===Rs||n===Ps||n===Is)if(a===se)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Cs)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Rs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ps)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Is)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Cs)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Rs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ps)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Is)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ua||n===da||n===fa||n===pa)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ua)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===da)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===fa)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===pa)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ma||n===ga||n===_a)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(n===ma||n===ga)return a===se?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===_a)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===xa||n===va||n===ya||n===Ma||n===Sa||n===ba||n===Aa||n===wa||n===Ea||n===Ta||n===Ca||n===Ra||n===Pa||n===Ia)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(n===xa)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===va)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ya)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ma)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Sa)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ba)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Aa)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wa)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ea)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ta)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ca)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ra)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Pa)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ia)return a===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ls||n===La||n===Ua)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(n===Ls)return a===se?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===La)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ua)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===zl||n===Da||n===Na||n===Oa)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ls)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Da)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Na)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Oa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Si?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:e}}class pd extends Ae{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class ts extends Zt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const xx={type:"move"};class Ko{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ts,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 ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new T,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new T),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new T,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new T),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const g=e.getJointPose(_,n),p=this._getHandJoint(c,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=e.getPose(t.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(xx)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new ts;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}const vx=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,yx=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class Mx{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){const i=new ue,s=t.properties.get(i);s.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new rn({vertexShader:vx,fragmentShader:yx,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new _e(new hs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Sx extends Dn{constructor(t,e){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const _=new Mx,g=e.getContextAttributes();let p=null,v=null;const x=[],y=[],I=new Z;let w=null;const C=new Ae;C.layers.enable(1),C.viewport=new ne;const P=new Ae;P.layers.enable(2),P.viewport=new ne;const b=[C,P],M=new pd;M.layers.enable(1),M.layers.enable(2);let L=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(W){let et=x[W];return et===void 0&&(et=new Ko,x[W]=et),et.getTargetRaySpace()},this.getControllerGrip=function(W){let et=x[W];return et===void 0&&(et=new Ko,x[W]=et),et.getGripSpace()},this.getHand=function(W){let et=x[W];return et===void 0&&(et=new Ko,x[W]=et),et.getHandSpace()};function O(W){const et=y.indexOf(W.inputSource);if(et===-1)return;const xt=x[et];xt!==void 0&&(xt.update(W.inputSource,W.frame,c||a),xt.dispatchEvent({type:W.type,data:W.inputSource}))}function V(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",V),i.removeEventListener("inputsourceschange",q);for(let W=0;W=0&&(y[ct]=null,x[ct].disconnect(xt))}for(let et=0;et=y.length){y.push(xt),ct=Vt;break}else if(y[Vt]===null){y[Vt]=xt,ct=Vt;break}if(ct===-1)break}const Lt=x[ct];Lt&&Lt.connect(xt)}}const H=new T,tt=new T;function G(W,et,xt){H.setFromMatrixPosition(et.matrixWorld),tt.setFromMatrixPosition(xt.matrixWorld);const ct=H.distanceTo(tt),Lt=et.projectionMatrix.elements,Vt=xt.projectionMatrix.elements,Ut=Lt[14]/(Lt[10]-1),Jt=Lt[14]/(Lt[10]+1),E=(Lt[9]+1)/Lt[5],it=(Lt[9]-1)/Lt[5],j=(Lt[8]-1)/Lt[0],ht=(Vt[8]+1)/Vt[0],X=Ut*j,Tt=Ut*ht,ut=ct/(-j+ht),vt=ut*-j;et.matrixWorld.decompose(W.position,W.quaternion,W.scale),W.translateX(vt),W.translateZ(ut),W.matrixWorld.compose(W.position,W.quaternion,W.scale),W.matrixWorldInverse.copy(W.matrixWorld).invert();const R=Ut+ut,S=Jt+ut,B=X-vt,Q=Tt+(ct-vt),K=E*Jt/S*R,$=it*Jt/S*R;W.projectionMatrix.makePerspective(B,Q,K,$,R,S),W.projectionMatrixInverse.copy(W.projectionMatrix).invert()}function pt(W,et){et===null?W.matrixWorld.copy(W.matrix):W.matrixWorld.multiplyMatrices(et.matrixWorld,W.matrix),W.matrixWorldInverse.copy(W.matrixWorld).invert()}this.updateCamera=function(W){if(i===null)return;_.texture!==null&&(W.near=_.depthNear,W.far=_.depthFar),M.near=P.near=C.near=W.near,M.far=P.far=C.far=W.far,(L!==M.near||k!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,k=M.far,C.near=L,C.far=k,P.near=L,P.far=k,C.updateProjectionMatrix(),P.updateProjectionMatrix(),W.updateProjectionMatrix());const et=W.parent,xt=M.cameras;pt(M,et);for(let ct=0;ct0&&(g.alphaTest.value=p.alphaTest);const v=t.get(p),x=v.envMap,y=v.envMapRotation;x&&(g.envMap.value=x,si.copy(y),si.x*=-1,si.y*=-1,si.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(si.y*=-1,si.z*=-1),g.envMapRotation.value.setFromMatrix4(bx.makeRotationFromEuler(si)),g.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,v,x){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=x*.5,p.map&&(g.map.value=p.map,e(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===De&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const v=t.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function wx(r,t,e,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,x){const y=x.program;n.uniformBlockBinding(v,y)}function c(v,x){let y=i[v.id];y===void 0&&(m(v),y=h(v),i[v.id]=y,v.addEventListener("dispose",g));const I=x.program;n.updateUBOMapping(v,I);const w=t.render.frame;s[v.id]!==w&&(d(v),s[v.id]=w)}function h(v){const x=u();v.__bindingPointIndex=x;const y=r.createBuffer(),I=v.__size,w=v.usage;return r.bindBuffer(r.UNIFORM_BUFFER,y),r.bufferData(r.UNIFORM_BUFFER,I,w),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,x,y),y}function u(){for(let v=0;v0&&(y+=I-w),v.__size=y,v.__cache={},this}function _(v){const x={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(x.boundary=4,x.storage=4):v.isVector2?(x.boundary=8,x.storage=8):v.isVector3||v.isColor?(x.boundary=16,x.storage=12):v.isVector4?(x.boundary=16,x.storage=16):v.isMatrix3?(x.boundary=48,x.storage=48):v.isMatrix4?(x.boundary=64,x.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),x}function g(v){const x=v.target;x.removeEventListener("dispose",g);const y=a.indexOf(x.__bindingPointIndex);a.splice(y,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function p(){for(const v in i)r.deleteBuffer(i[v]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class Ex{constructor(t={}){const{canvas:e=td(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=t;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;const f=new Uint32Array(4),m=new Int32Array(4);let _=null,g=null;const p=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=$e,this.toneMapping=Cn,this.toneMappingExposure=1;const x=this;let y=!1,I=0,w=0,C=null,P=-1,b=null;const M=new ne,L=new ne;let k=null;const O=new ft(0);let V=0,q=e.width,H=e.height,tt=1,G=null,pt=null;const yt=new ne(0,0,q,H),gt=new ne(0,0,q,H);let Gt=!1;const $t=new or;let W=!1,et=!1;const xt=new Rt,ct=new T,Lt=new ne,Vt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ut=!1;function Jt(){return C===null?tt:1}let E=n;function it(A,D){return e.getContext(A,D)}try{const A={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Va}`),e.addEventListener("webglcontextlost",Y,!1),e.addEventListener("webglcontextrestored",J,!1),e.addEventListener("webglcontextcreationerror",at,!1),E===null){const D="webgl2";if(E=it(D,A),E===null)throw it(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(A){throw console.error("THREE.WebGLRenderer: "+A.message),A}let j,ht,X,Tt,ut,vt,R,S,B,Q,K,$,Et,lt,_t,Ft,nt,mt,Xt,Nt,Mt,Ot,Wt,re;function U(){j=new U_(E),j.init(),Ot=new fd(E,j),ht=new T_(E,j,t,Ot),X=new ux(E),Tt=new O_(E),ut=new j0,vt=new _x(E,j,X,ut,ht,Ot,Tt),R=new R_(x),S=new L_(x),B=new Gp(E),Wt=new w_(E,B),Q=new D_(E,B,Tt,Wt),K=new B_(E,Q,B,Tt),Xt=new F_(E,ht,vt),Ft=new C_(ut),$=new Q0(x,R,S,j,ht,Wt,Ft),Et=new Ax(x,ut),lt=new ex,_t=new ox(j),mt=new A_(x,R,S,X,K,d,l),nt=new hx(x,K,ht),re=new wx(E,Tt,ht,X),Nt=new E_(E,j,Tt),Mt=new N_(E,j,Tt),Tt.programs=$.programs,x.capabilities=ht,x.extensions=j,x.properties=ut,x.renderLists=lt,x.shadowMap=nt,x.state=X,x.info=Tt}U();const st=new Sx(x,E);this.xr=st,this.getContext=function(){return E},this.getContextAttributes=function(){return E.getContextAttributes()},this.forceContextLoss=function(){const A=j.get("WEBGL_lose_context");A&&A.loseContext()},this.forceContextRestore=function(){const A=j.get("WEBGL_lose_context");A&&A.restoreContext()},this.getPixelRatio=function(){return tt},this.setPixelRatio=function(A){A!==void 0&&(tt=A,this.setSize(q,H,!1))},this.getSize=function(A){return A.set(q,H)},this.setSize=function(A,D,F=!0){if(st.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=A,H=D,e.width=Math.floor(A*tt),e.height=Math.floor(D*tt),F===!0&&(e.style.width=A+"px",e.style.height=D+"px"),this.setViewport(0,0,A,D)},this.getDrawingBufferSize=function(A){return A.set(q*tt,H*tt).floor()},this.setDrawingBufferSize=function(A,D,F){q=A,H=D,tt=F,e.width=Math.floor(A*F),e.height=Math.floor(D*F),this.setViewport(0,0,A,D)},this.getCurrentViewport=function(A){return A.copy(M)},this.getViewport=function(A){return A.copy(yt)},this.setViewport=function(A,D,F,z){A.isVector4?yt.set(A.x,A.y,A.z,A.w):yt.set(A,D,F,z),X.viewport(M.copy(yt).multiplyScalar(tt).round())},this.getScissor=function(A){return A.copy(gt)},this.setScissor=function(A,D,F,z){A.isVector4?gt.set(A.x,A.y,A.z,A.w):gt.set(A,D,F,z),X.scissor(L.copy(gt).multiplyScalar(tt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(A){X.setScissorTest(Gt=A)},this.setOpaqueSort=function(A){G=A},this.setTransparentSort=function(A){pt=A},this.getClearColor=function(A){return A.copy(mt.getClearColor())},this.setClearColor=function(){mt.setClearColor.apply(mt,arguments)},this.getClearAlpha=function(){return mt.getClearAlpha()},this.setClearAlpha=function(){mt.setClearAlpha.apply(mt,arguments)},this.clear=function(A=!0,D=!0,F=!0){let z=0;if(A){let N=!1;if(C!==null){const rt=C.texture.format;N=rt===Za||rt===Ya||rt===sr}if(N){const rt=C.texture.type,dt=rt===mn||rt===In||rt===is||rt===Si||rt===Wa||rt===Xa,St=mt.getClearColor(),At=mt.getClearAlpha(),It=St.r,Dt=St.g,Ct=St.b;dt?(f[0]=It,f[1]=Dt,f[2]=Ct,f[3]=At,E.clearBufferuiv(E.COLOR,0,f)):(m[0]=It,m[1]=Dt,m[2]=Ct,m[3]=At,E.clearBufferiv(E.COLOR,0,m))}else z|=E.COLOR_BUFFER_BIT}D&&(z|=E.DEPTH_BUFFER_BIT),F&&(z|=E.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),E.clear(z)},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",Y,!1),e.removeEventListener("webglcontextrestored",J,!1),e.removeEventListener("webglcontextcreationerror",at,!1),lt.dispose(),_t.dispose(),ut.dispose(),R.dispose(),S.dispose(),K.dispose(),Wt.dispose(),re.dispose(),$.dispose(),st.dispose(),st.removeEventListener("sessionstart",ln),st.removeEventListener("sessionend",gc),Qn.stop()};function Y(A){A.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function J(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const A=Tt.autoReset,D=nt.enabled,F=nt.autoUpdate,z=nt.needsUpdate,N=nt.type;U(),Tt.autoReset=A,nt.enabled=D,nt.autoUpdate=F,nt.needsUpdate=z,nt.type=N}function at(A){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",A.statusMessage)}function Pt(A){const D=A.target;D.removeEventListener("dispose",Pt),qt(D)}function qt(A){fe(A),ut.remove(A)}function fe(A){const D=ut.get(A).programs;D!==void 0&&(D.forEach(function(F){$.releaseProgram(F)}),A.isShaderMaterial&&$.releaseShaderCache(A))}this.renderBufferDirect=function(A,D,F,z,N,rt){D===null&&(D=Vt);const dt=N.isMesh&&N.matrixWorld.determinant()<0,St=uf(A,D,F,z,N);X.setMaterial(z,dt);let At=F.index,It=1;if(z.wireframe===!0){if(At=Q.getWireframeAttribute(F),At===void 0)return;It=2}const Dt=F.drawRange,Ct=F.attributes.position;let jt=Dt.start*It,oe=(Dt.start+Dt.count)*It;rt!==null&&(jt=Math.max(jt,rt.start*It),oe=Math.min(oe,(rt.start+rt.count)*It)),At!==null?(jt=Math.max(jt,0),oe=Math.min(oe,At.count)):Ct!=null&&(jt=Math.max(jt,0),oe=Math.min(oe,Ct.count));const le=oe-jt;if(le<0||le===1/0)return;Wt.setup(N,z,St,F,At);let Ve,te=Nt;if(At!==null&&(Ve=B.get(At),te=Mt,te.setIndex(Ve)),N.isMesh)z.wireframe===!0?(X.setLineWidth(z.wireframeLinewidth*Jt()),te.setMode(E.LINES)):te.setMode(E.TRIANGLES);else if(N.isLine){let wt=z.linewidth;wt===void 0&&(wt=1),X.setLineWidth(wt*Jt()),N.isLineSegments?te.setMode(E.LINES):N.isLineLoop?te.setMode(E.LINE_LOOP):te.setMode(E.LINE_STRIP)}else N.isPoints?te.setMode(E.POINTS):N.isSprite&&te.setMode(E.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)te.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if(j.get("WEBGL_multi_draw"))te.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const wt=N._multiDrawStarts,be=N._multiDrawCounts,ee=N._multiDrawCount,Qe=At?B.get(At).bytesPerElement:1,Ri=ut.get(z).currentProgram.getUniforms();for(let He=0;He{function rt(){if(z.forEach(function(dt){ut.get(dt).currentProgram.isReady()&&z.delete(dt)}),z.size===0){N(A);return}setTimeout(rt,10)}j.get("KHR_parallel_shader_compile")!==null?rt():setTimeout(rt,10)})};let Qt=null;function _n(A){Qt&&Qt(A)}function ln(){Qn.stop()}function gc(){Qn.start()}const Qn=new ld;Qn.setAnimationLoop(_n),typeof self<"u"&&Qn.setContext(self),this.setAnimationLoop=function(A){Qt=A,st.setAnimationLoop(A),A===null?Qn.stop():Qn.start()},st.addEventListener("sessionstart",ln),st.addEventListener("sessionend",gc),this.render=function(A,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(A.matrixWorldAutoUpdate===!0&&A.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),st.enabled===!0&&st.isPresenting===!0&&(st.cameraAutoUpdate===!0&&st.updateCamera(D),D=st.getCamera()),A.isScene===!0&&A.onBeforeRender(x,A,D,C),g=_t.get(A,v.length),g.init(D),v.push(g),xt.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),$t.setFromProjectionMatrix(xt),et=this.localClippingEnabled,W=Ft.init(this.clippingPlanes,et),_=lt.get(A,p.length),_.init(),p.push(_),st.enabled===!0&&st.isPresenting===!0){const rt=x.xr.getDepthSensingMesh();rt!==null&&bo(rt,D,-1/0,x.sortObjects)}bo(A,D,0,x.sortObjects),_.finish(),x.sortObjects===!0&&_.sort(G,pt),Ut=st.enabled===!1||st.isPresenting===!1||st.hasDepthSensing()===!1,Ut&&mt.addToRenderList(_,A),this.info.render.frame++,W===!0&&Ft.beginShadows();const F=g.state.shadowsArray;nt.render(F,A,D),W===!0&&Ft.endShadows(),this.info.autoReset===!0&&this.info.reset();const z=_.opaque,N=_.transmissive;if(g.setupLights(),D.isArrayCamera){const rt=D.cameras;if(N.length>0)for(let dt=0,St=rt.length;dt0&&xc(z,N,A,D),Ut&&mt.render(A),_c(_,A,D);C!==null&&(vt.updateMultisampleRenderTarget(C),vt.updateRenderTargetMipmap(C)),A.isScene===!0&&A.onAfterRender(x,A,D),Wt.resetDefaultState(),P=-1,b=null,v.pop(),v.length>0?(g=v[v.length-1],W===!0&&Ft.setGlobalState(x.clippingPlanes,g.state.camera)):g=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function bo(A,D,F,z){if(A.visible===!1)return;if(A.layers.test(D.layers)){if(A.isGroup)F=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(D);else if(A.isLight)g.pushLight(A),A.castShadow&&g.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||$t.intersectsSprite(A)){z&&Lt.setFromMatrixPosition(A.matrixWorld).applyMatrix4(xt);const dt=K.update(A),St=A.material;St.visible&&_.push(A,dt,St,F,Lt.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(!A.frustumCulled||$t.intersectsObject(A))){const dt=K.update(A),St=A.material;if(z&&(A.boundingSphere!==void 0?(A.boundingSphere===null&&A.computeBoundingSphere(),Lt.copy(A.boundingSphere.center)):(dt.boundingSphere===null&&dt.computeBoundingSphere(),Lt.copy(dt.boundingSphere.center)),Lt.applyMatrix4(A.matrixWorld).applyMatrix4(xt)),Array.isArray(St)){const At=dt.groups;for(let It=0,Dt=At.length;It0&&fr(N,D,F),rt.length>0&&fr(rt,D,F),dt.length>0&&fr(dt,D,F),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function xc(A,D,F,z){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[z.id]===void 0&&(g.state.transmissionRenderTarget[z.id]=new sn(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?ls:mn,minFilter:un,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const rt=g.state.transmissionRenderTarget[z.id],dt=z.viewport||M;rt.setSize(dt.z,dt.w);const St=x.getRenderTarget();x.setRenderTarget(rt),x.getClearColor(O),V=x.getClearAlpha(),V<1&&x.setClearColor(16777215,.5),Ut?mt.render(F):x.clear();const At=x.toneMapping;x.toneMapping=Cn;const It=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),g.setupLightsView(z),W===!0&&Ft.setGlobalState(x.clippingPlanes,z),fr(A,F,z),vt.updateMultisampleRenderTarget(rt),vt.updateRenderTargetMipmap(rt),j.has("WEBGL_multisampled_render_to_texture")===!1){let Dt=!1;for(let Ct=0,jt=D.length;Ct0),Ct=!!F.morphAttributes.position,jt=!!F.morphAttributes.normal,oe=!!F.morphAttributes.color;let le=Cn;z.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(le=x.toneMapping);const Ve=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,te=Ve!==void 0?Ve.length:0,wt=ut.get(z),be=g.state.lights;if(W===!0&&(et===!0||A!==b)){const Ze=A===b&&z.id===P;Ft.setState(z,A,Ze)}let ee=!1;z.version===wt.__version?(wt.needsLights&&wt.lightsStateVersion!==be.state.version||wt.outputColorSpace!==St||N.isBatchedMesh&&wt.batching===!1||!N.isBatchedMesh&&wt.batching===!0||N.isBatchedMesh&&wt.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&wt.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&wt.instancing===!1||!N.isInstancedMesh&&wt.instancing===!0||N.isSkinnedMesh&&wt.skinning===!1||!N.isSkinnedMesh&&wt.skinning===!0||N.isInstancedMesh&&wt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&wt.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&wt.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&wt.instancingMorph===!1&&N.morphTexture!==null||wt.envMap!==At||z.fog===!0&&wt.fog!==rt||wt.numClippingPlanes!==void 0&&(wt.numClippingPlanes!==Ft.numPlanes||wt.numIntersection!==Ft.numIntersection)||wt.vertexAlphas!==It||wt.vertexTangents!==Dt||wt.morphTargets!==Ct||wt.morphNormals!==jt||wt.morphColors!==oe||wt.toneMapping!==le||wt.morphTargetsCount!==te)&&(ee=!0):(ee=!0,wt.__version=z.version);let Qe=wt.currentProgram;ee===!0&&(Qe=pr(z,D,N));let Ri=!1,He=!1,Ao=!1;const pe=Qe.getUniforms(),Nn=wt.uniforms;if(X.useProgram(Qe.program)&&(Ri=!0,He=!0,Ao=!0),z.id!==P&&(P=z.id,He=!0),Ri||b!==A){pe.setValue(E,"projectionMatrix",A.projectionMatrix),pe.setValue(E,"viewMatrix",A.matrixWorldInverse);const Ze=pe.map.cameraPosition;Ze!==void 0&&Ze.setValue(E,ct.setFromMatrixPosition(A.matrixWorld)),ht.logarithmicDepthBuffer&&pe.setValue(E,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&pe.setValue(E,"isOrthographic",A.isOrthographicCamera===!0),b!==A&&(b=A,He=!0,Ao=!0)}if(N.isSkinnedMesh){pe.setOptional(E,N,"bindMatrix"),pe.setOptional(E,N,"bindMatrixInverse");const Ze=N.skeleton;Ze&&(Ze.boneTexture===null&&Ze.computeBoneTexture(),pe.setValue(E,"boneTexture",Ze.boneTexture,vt))}N.isBatchedMesh&&(pe.setOptional(E,N,"batchingTexture"),pe.setValue(E,"batchingTexture",N._matricesTexture,vt),pe.setOptional(E,N,"batchingIdTexture"),pe.setValue(E,"batchingIdTexture",N._indirectTexture,vt),pe.setOptional(E,N,"batchingColorTexture"),N._colorsTexture!==null&&pe.setValue(E,"batchingColorTexture",N._colorsTexture,vt));const wo=F.morphAttributes;if((wo.position!==void 0||wo.normal!==void 0||wo.color!==void 0)&&Xt.update(N,F,Qe),(He||wt.receiveShadow!==N.receiveShadow)&&(wt.receiveShadow=N.receiveShadow,pe.setValue(E,"receiveShadow",N.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(Nn.envMap.value=At,Nn.flipEnvMap.value=At.isCubeTexture&&At.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&D.environment!==null&&(Nn.envMapIntensity.value=D.environmentIntensity),He&&(pe.setValue(E,"toneMappingExposure",x.toneMappingExposure),wt.needsLights&&df(Nn,Ao),rt&&z.fog===!0&&Et.refreshFogUniforms(Nn,rt),Et.refreshMaterialUniforms(Nn,z,tt,H,g.state.transmissionRenderTarget[A.id]),la.upload(E,yc(wt),Nn,vt)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(la.upload(E,yc(wt),Nn,vt),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&pe.setValue(E,"center",N.center),pe.setValue(E,"modelViewMatrix",N.modelViewMatrix),pe.setValue(E,"normalMatrix",N.normalMatrix),pe.setValue(E,"modelMatrix",N.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const Ze=z.uniformsGroups;for(let Eo=0,pf=Ze.length;Eo0&&vt.useMultisampledRTT(A)===!1?N=ut.get(A).__webglMultisampledFramebuffer:Array.isArray(Dt)?N=Dt[F]:N=Dt,M.copy(A.viewport),L.copy(A.scissor),k=A.scissorTest}else M.copy(yt).multiplyScalar(tt).floor(),L.copy(gt).multiplyScalar(tt).floor(),k=Gt;if(X.bindFramebuffer(E.FRAMEBUFFER,N)&&z&&X.drawBuffers(A,N),X.viewport(M),X.scissor(L),X.setScissorTest(k),rt){const At=ut.get(A.texture);E.framebufferTexture2D(E.FRAMEBUFFER,E.COLOR_ATTACHMENT0,E.TEXTURE_CUBE_MAP_POSITIVE_X+D,At.__webglTexture,F)}else if(dt){const At=ut.get(A.texture),It=D||0;E.framebufferTextureLayer(E.FRAMEBUFFER,E.COLOR_ATTACHMENT0,At.__webglTexture,F||0,It)}P=-1},this.readRenderTargetPixels=function(A,D,F,z,N,rt,dt){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let St=ut.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&dt!==void 0&&(St=St[dt]),St){X.bindFramebuffer(E.FRAMEBUFFER,St);try{const At=A.texture,It=At.format,Dt=At.type;if(!ht.textureFormatReadable(It)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ht.textureTypeReadable(Dt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=A.width-z&&F>=0&&F<=A.height-N&&E.readPixels(D,F,z,N,Ot.convert(It),Ot.convert(Dt),rt)}finally{const At=C!==null?ut.get(C).__webglFramebuffer:null;X.bindFramebuffer(E.FRAMEBUFFER,At)}}},this.readRenderTargetPixelsAsync=async function(A,D,F,z,N,rt,dt){if(!(A&&A.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let St=ut.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&dt!==void 0&&(St=St[dt]),St){X.bindFramebuffer(E.FRAMEBUFFER,St);try{const At=A.texture,It=At.format,Dt=At.type;if(!ht.textureFormatReadable(It))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ht.textureTypeReadable(Dt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(D>=0&&D<=A.width-z&&F>=0&&F<=A.height-N){const Ct=E.createBuffer();E.bindBuffer(E.PIXEL_PACK_BUFFER,Ct),E.bufferData(E.PIXEL_PACK_BUFFER,rt.byteLength,E.STREAM_READ),E.readPixels(D,F,z,N,Ot.convert(It),Ot.convert(Dt),0),E.flush();const jt=E.fenceSync(E.SYNC_GPU_COMMANDS_COMPLETE,0);await pp(E,jt,4);try{E.bindBuffer(E.PIXEL_PACK_BUFFER,Ct),E.getBufferSubData(E.PIXEL_PACK_BUFFER,0,rt)}finally{E.deleteBuffer(Ct),E.deleteSync(jt)}return rt}}finally{const At=C!==null?ut.get(C).__webglFramebuffer:null;X.bindFramebuffer(E.FRAMEBUFFER,At)}}},this.copyFramebufferToTexture=function(A,D=null,F=0){A.isTexture!==!0&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),D=arguments[0]||null,A=arguments[1]);const z=Math.pow(2,-F),N=Math.floor(A.image.width*z),rt=Math.floor(A.image.height*z),dt=D!==null?D.x:0,St=D!==null?D.y:0;vt.setTexture2D(A,0),E.copyTexSubImage2D(E.TEXTURE_2D,F,0,0,dt,St,N,rt),X.unbindTexture()},this.copyTextureToTexture=function(A,D,F=null,z=null,N=0){A.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),z=arguments[0]||null,A=arguments[1],D=arguments[2],N=arguments[3]||0,F=null);let rt,dt,St,At,It,Dt;F!==null?(rt=F.max.x-F.min.x,dt=F.max.y-F.min.y,St=F.min.x,At=F.min.y):(rt=A.image.width,dt=A.image.height,St=0,At=0),z!==null?(It=z.x,Dt=z.y):(It=0,Dt=0);const Ct=Ot.convert(D.format),jt=Ot.convert(D.type);vt.setTexture2D(D,0),E.pixelStorei(E.UNPACK_FLIP_Y_WEBGL,D.flipY),E.pixelStorei(E.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),E.pixelStorei(E.UNPACK_ALIGNMENT,D.unpackAlignment);const oe=E.getParameter(E.UNPACK_ROW_LENGTH),le=E.getParameter(E.UNPACK_IMAGE_HEIGHT),Ve=E.getParameter(E.UNPACK_SKIP_PIXELS),te=E.getParameter(E.UNPACK_SKIP_ROWS),wt=E.getParameter(E.UNPACK_SKIP_IMAGES),be=A.isCompressedTexture?A.mipmaps[N]:A.image;E.pixelStorei(E.UNPACK_ROW_LENGTH,be.width),E.pixelStorei(E.UNPACK_IMAGE_HEIGHT,be.height),E.pixelStorei(E.UNPACK_SKIP_PIXELS,St),E.pixelStorei(E.UNPACK_SKIP_ROWS,At),A.isDataTexture?E.texSubImage2D(E.TEXTURE_2D,N,It,Dt,rt,dt,Ct,jt,be.data):A.isCompressedTexture?E.compressedTexSubImage2D(E.TEXTURE_2D,N,It,Dt,be.width,be.height,Ct,be.data):E.texSubImage2D(E.TEXTURE_2D,N,It,Dt,rt,dt,Ct,jt,be),E.pixelStorei(E.UNPACK_ROW_LENGTH,oe),E.pixelStorei(E.UNPACK_IMAGE_HEIGHT,le),E.pixelStorei(E.UNPACK_SKIP_PIXELS,Ve),E.pixelStorei(E.UNPACK_SKIP_ROWS,te),E.pixelStorei(E.UNPACK_SKIP_IMAGES,wt),N===0&&D.generateMipmaps&&E.generateMipmap(E.TEXTURE_2D),X.unbindTexture()},this.copyTextureToTexture3D=function(A,D,F=null,z=null,N=0){A.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),F=arguments[0]||null,z=arguments[1]||null,A=arguments[2],D=arguments[3],N=arguments[4]||0);let rt,dt,St,At,It,Dt,Ct,jt,oe;const le=A.isCompressedTexture?A.mipmaps[N]:A.image;F!==null?(rt=F.max.x-F.min.x,dt=F.max.y-F.min.y,St=F.max.z-F.min.z,At=F.min.x,It=F.min.y,Dt=F.min.z):(rt=le.width,dt=le.height,St=le.depth,At=0,It=0,Dt=0),z!==null?(Ct=z.x,jt=z.y,oe=z.z):(Ct=0,jt=0,oe=0);const Ve=Ot.convert(D.format),te=Ot.convert(D.type);let wt;if(D.isData3DTexture)vt.setTexture3D(D,0),wt=E.TEXTURE_3D;else if(D.isDataArrayTexture||D.isCompressedArrayTexture)vt.setTexture2DArray(D,0),wt=E.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}E.pixelStorei(E.UNPACK_FLIP_Y_WEBGL,D.flipY),E.pixelStorei(E.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),E.pixelStorei(E.UNPACK_ALIGNMENT,D.unpackAlignment);const be=E.getParameter(E.UNPACK_ROW_LENGTH),ee=E.getParameter(E.UNPACK_IMAGE_HEIGHT),Qe=E.getParameter(E.UNPACK_SKIP_PIXELS),Ri=E.getParameter(E.UNPACK_SKIP_ROWS),He=E.getParameter(E.UNPACK_SKIP_IMAGES);E.pixelStorei(E.UNPACK_ROW_LENGTH,le.width),E.pixelStorei(E.UNPACK_IMAGE_HEIGHT,le.height),E.pixelStorei(E.UNPACK_SKIP_PIXELS,At),E.pixelStorei(E.UNPACK_SKIP_ROWS,It),E.pixelStorei(E.UNPACK_SKIP_IMAGES,Dt),A.isDataTexture||A.isData3DTexture?E.texSubImage3D(wt,N,Ct,jt,oe,rt,dt,St,Ve,te,le.data):D.isCompressedArrayTexture?E.compressedTexSubImage3D(wt,N,Ct,jt,oe,rt,dt,St,Ve,le.data):E.texSubImage3D(wt,N,Ct,jt,oe,rt,dt,St,Ve,te,le),E.pixelStorei(E.UNPACK_ROW_LENGTH,be),E.pixelStorei(E.UNPACK_IMAGE_HEIGHT,ee),E.pixelStorei(E.UNPACK_SKIP_PIXELS,Qe),E.pixelStorei(E.UNPACK_SKIP_ROWS,Ri),E.pixelStorei(E.UNPACK_SKIP_IMAGES,He),N===0&&D.generateMipmaps&&E.generateMipmap(wt),X.unbindTexture()},this.initRenderTarget=function(A){ut.get(A).__webglFramebuffer===void 0&&vt.setupRenderTarget(A)},this.initTexture=function(A){A.isCubeTexture?vt.setTextureCube(A,0):A.isData3DTexture?vt.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?vt.setTexture2DArray(A,0):vt.setTexture2D(A,0),X.unbindTexture()},this.resetState=function(){I=0,w=0,C=null,X.reset(),Wt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return dn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===$a?"display-p3":"srgb",e.unpackColorSpace=Kt.workingColorSpace===rr?"display-p3":"srgb"}}class no{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ft(t),this.density=e}clone(){return new no(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class io{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new ft(t),this.near=e,this.far=n}clone(){return new io(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class md extends Zt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ye,this.environmentIntensity=1,this.environmentRotation=new Ye,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class so{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=qs,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=qe()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return Gl("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,s=this.stride;it.far||e.push({distance:l,point:_s.clone(),uv:Xe.getInterpolation(_s,Or,vs,Fr,uh,Qo,dh,new Z),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function Br(r,t,e,n,i,s){Ji.subVectors(r,e).addScalar(.5).multiply(n),i!==void 0?(xs.x=s*Ji.x-i*Ji.y,xs.y=i*Ji.x+s*Ji.y):xs.copy(Ji),r.copy(t),r.x+=xs.x,r.y+=xs.y,r.applyMatrix4(gd)}const zr=new T,fh=new T;class xd extends Zt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,i=e.length;n0){let n,i;for(n=1,i=e.length;n0){zr.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(zr);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){zr.setFromMatrixPosition(t.matrixWorld),fh.setFromMatrixPosition(this.matrixWorld);const n=zr.distanceTo(fh)/t.zoom;e[0].object.visible=!0;let i,s;for(i=1,s=e.length;i=a)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const a=i[this.index];s.push(a),this.index++,a.start=t.start,a.count=t.count,a.z=e,a.index=n}reset(){this.list.length=0,this.index=0}}const Hn=new Rt,el=new Rt,Ux=new Rt,Dx=new ft(1,1,1),Sh=new Rt,nl=new or,Hr=new Ne,ri=new Ce,Ss=new T,bh=new T,Nx=new T,il=new Lx,Te=new _e,Gr=[];function Ox(r,t,e=0){const n=t.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==t.array.constructor){const i=r.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new ie(s,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(!t.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),s=e.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ne);const t=this._geometryCount,e=this.boundingBox,n=this._drawInfo;e.makeEmpty();for(let i=0;i=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:t});const e=this._drawInfo.length-1,n=this._matricesTexture,i=n.image.data;Ux.toArray(i,e*16),n.needsUpdate=!0;const s=this._colorsTexture;return s&&(Dx.toArray(s.image.data,e*4),s.needsUpdate=!0),e}addGeometry(t,e=-1,n=-1){if(this._initializeGeometry(t),this._validateGeometry(t),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const a=this._reservedRanges,o=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=a[a.length-1]),e===-1?i.vertexCount=t.getAttribute("position").count:i.vertexCount=e,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=t.getIndex(),h=c!==null;if(h&&(n===-1?i.indexCount=c.count:i.indexCount=n,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const u=this._geometryCount;return this._geometryCount++,a.push(i),o.push({start:h?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Ne,sphereInitialized:!1,sphere:new Ce}),this.setGeometryAt(u,t),u}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=e.getIndex(),o=this._reservedRanges[t];if(i&&a.count>o.indexCount||e.attributes.position.count>o.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.vertexCount;for(const f in n.attributes){const m=e.getAttribute(f),_=n.getAttribute(f);Ox(m,_,l);const g=m.itemSize;for(let p=m.count,v=c;p=this._geometryCount)return null;const n=this._bounds[t],i=n.box,s=this.geometry;if(n.boxInitialized===!1){i.makeEmpty();const a=s.index,o=s.attributes.position,l=this._drawRanges[t];for(let c=l.start,h=l.start+l.count;c=this._geometryCount)return null;const n=this._bounds[t],i=n.sphere,s=this.geometry;if(n.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(t,Hr),Hr.getCenter(i.center);const a=s.index,o=s.attributes.position,l=this._drawRanges[t];let c=0;for(let h=l.start,u=l.start+l.count;h=n.length||n[t].active===!1?this:(e.toArray(s,t*16),i.needsUpdate=!0,this)}getMatrixAt(t,e){const n=this._drawInfo,i=this._matricesTexture.image.data;return t>=n.length||n[t].active===!1?null:e.fromArray(i,t*16)}setColorAt(t,e){this._colorsTexture===null&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return t>=s.length||s[t].active===!1?this:(e.toArray(i,t*4),n.needsUpdate=!0,this)}getColorAt(t,e){const n=this._colorsTexture.image.data,i=this._drawInfo;return t>=i.length||i[t].active===!1?null:e.fromArray(n,t*4)}setVisibleAt(t,e){const n=this._drawInfo;return t>=n.length||n[t].active===!1||n[t].visible===e?this:(n[t].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(t){const e=this._drawInfo;return t>=e.length||e[t].active===!1?!1:e[t].visible}raycast(t,e){const n=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,a=this.geometry;Te.material=this.material,Te.geometry.index=a.index,Te.geometry.attributes=a.attributes,Te.geometry.boundingBox===null&&(Te.geometry.boundingBox=new Ne),Te.geometry.boundingSphere===null&&(Te.geometry.boundingSphere=new Ce);for(let o=0,l=n.length;o({...e})),this._reservedRanges=t._reservedRanges.map(e=>({...e})),this._drawInfo=t._drawInfo.map(e=>({...e})),this._bounds=t._bounds.map(e=>({boxInitialized:e.boxInitialized,box:e.box.clone(),sphereInitialized:e.sphereInitialized,sphere:e.sphere.clone()})),this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this._colorsTexture!==null&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(t,e,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,u=this._drawRanges,d=this.perObjectFrustumCulled,f=this._indirectTexture,m=f.image.data;d&&(Sh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),nl.setFromProjectionMatrix(Sh,t.coordinateSystem));let _=0;if(this.sortObjects){el.copy(this.matrixWorld).invert(),Ss.setFromMatrixPosition(n.matrixWorld).applyMatrix4(el),bh.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(el);for(let v=0,x=l.length;v0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;sn)return;sl.applyMatrix4(r.matrixWorld);const l=t.ray.origin.distanceTo(sl);if(!(lt.far))return{distance:l,point:wh.clone().applyMatrix4(r.matrixWorld),index:i,face:null,faceIndex:null,object:r}}const Eh=new T,Th=new T;class gn extends Yn{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[];for(let i=0,s=e.count;i0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,object:a})}}class Fx extends ue{constructor(t,e,n,i,s,a,o,l,c){super(t,e,n,i,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:ge,this.magFilter=s!==void 0?s:ge,this.generateMipmaps=!1;const h=this;function u(){h.needsUpdate=!0,t.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class Bx extends ue{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Me,this.minFilter=Me,this.generateMipmaps=!1,this.needsUpdate=!0}}class ao extends ue{constructor(t,e,n,i,s,a,o,l,c,h,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class zx extends ao{constructor(t,e,n,i,s,a){super(t,e,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Ke,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class kx extends ao{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,Pn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class Vx extends ue{constructor(t,e,n,i,s,a,o,l,c){super(t,e,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class an{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),s=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),s+=n.distanceTo(i),e.push(s),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const s=n.length;let a;e?a=e:a=t*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(s-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=e||(a.isVector2?new Z:new T);return l.copy(o).sub(a).normalize(),l}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new T,i=[],s=[],a=[],o=new T,l=new Rt;for(let f=0;f<=t;f++){const m=f/t;i[f]=this.getTangentAt(m,new T)}s[0]=new T,a[0]=new T;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=t;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(he(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,m))}a[f].crossVectors(i[f],s[f])}if(e===!0){let f=Math.acos(he(s[0].dot(s[t]),-1,1));f/=t,i[0].dot(o.crossVectors(s[0],s[t]))>0&&(f=-f);for(let m=1;m<=t;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],f*m)),a[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class oo extends an{constructor(t=0,e=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(t,e=new Z){const n=e,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%s]:(Zr.subVectors(i[0],i[1]).add(i[0]),c=Zr);const u=i[o%s],d=i[(o+1)%s];if(this.closed||o+2i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(Ph(o,l.x,c.x,h.x,u.x),Ph(o,l.y,c.y,h.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=n){const a=i[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class lr extends Ht{constructor(t=[new Z(0,-.5),new Z(.5,0),new Z(0,.5)],e=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=he(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/e,u=new T,d=new Z,f=new T,m=new T,_=new T;let g=0,p=0;for(let v=0;v<=t.length-1;v++)switch(v){case 0:g=t[v+1].x-t[v].x,p=t[v+1].y-t[v].y,f.x=p*1,f.y=-g,f.z=p*0,_.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case t.length-1:l.push(_.x,_.y,_.z);break;default:g=t[v+1].x-t[v].x,p=t[v+1].y-t[v].y,f.x=p*1,f.y=-g,f.z=p*0,m.copy(f),f.x+=_.x,f.y+=_.y,f.z+=_.z,f.normalize(),l.push(f.x,f.y,f.z),_.copy(m)}for(let v=0;v<=e;v++){const x=n+v*h*i,y=Math.sin(x),I=Math.cos(x);for(let w=0;w<=t.length-1;w++){u.x=t[w].x*y,u.y=t[w].y,u.z=t[w].x*I,a.push(u.x,u.y,u.z),d.x=v/e,d.y=w/(t.length-1),o.push(d.x,d.y);const C=l[3*w+0]*y,P=l[3*w+1],b=l[3*w+0]*I;c.push(C,P,b)}}for(let v=0;v0&&x(!0),e>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new bt(u,3)),this.setAttribute("normal",new bt(d,3)),this.setAttribute("uv",new bt(f,2));function v(){const y=new T,I=new T;let w=0;const C=(e-t)/n;for(let P=0;P<=s;P++){const b=[],M=P/s,L=M*(e-t)+t;for(let k=0;k<=i;k++){const O=k/i,V=O*l+o,q=Math.sin(V),H=Math.cos(V);I.x=L*q,I.y=-M*n+g,I.z=L*H,u.push(I.x,I.y,I.z),y.set(q,C,H).normalize(),d.push(y.x,y.y,y.z),f.push(O,1-M),b.push(m++)}_.push(b)}for(let P=0;P.9&&C<.1&&(x<.2&&(a[v+0]+=1),y<.2&&(a[v+2]+=1),I<.2&&(a[v+4]+=1))}}function d(v){s.push(v.x,v.y,v.z)}function f(v,x){const y=v*3;x.x=t[y+0],x.y=t[y+1],x.z=t[y+2]}function m(){const v=new T,x=new T,y=new T,I=new T,w=new Z,C=new Z,P=new Z;for(let b=0,M=0;b80*e){o=c=r[0],l=h=r[1];for(let m=e;mc&&(c=u),d>h&&(h=d);f=Math.max(c-o,h-l),f=f!==0?32767/f:0}return $s(s,a,e,o,l,f,0),a}};function Pd(r,t,e,n,i){let s,a;if(i===uv(r,t,e,n)>0)for(s=t;s=t;s-=n)a=Ih(s,r[s],r[s+1],a);return a&&fo(a,a.next)&&(Qs(a),a=a.next),a}function wi(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(fo(e,e.next)||ae(e.prev,e,e.next)===0)){if(Qs(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function $s(r,t,e,n,i,s,a){if(!r)return;!a&&s&&rv(r,n,i,s);let o=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?Kx(r,n,i,s):$x(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(c.i/e|0),Qs(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=Qx(wi(r),t,e),$s(r,t,e,n,i,s,2)):a===2&&jx(r,t,e,n,i,s):$s(wi(r),t,e,n,i,s,1);break}}}function $x(r){const t=r.prev,e=r,n=r.next;if(ae(t,e,n)>=0)return!1;const i=t.x,s=e.x,a=n.x,o=t.y,l=e.y,c=n.y,h=is?i>a?i:a:s>a?s:a,f=o>l?o>c?o:c:l>c?l:c;let m=n.next;for(;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&es(i,o,s,l,a,c,m.x,m.y)&&ae(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Kx(r,t,e,n){const i=r.prev,s=r,a=r.next;if(ae(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,h=i.y,u=s.y,d=a.y,f=ol?o>c?o:c:l>c?l:c,g=h>u?h>d?h:d:u>d?u:d,p=Al(f,m,t,e,n),v=Al(_,g,t,e,n);let x=r.prevZ,y=r.nextZ;for(;x&&x.z>=p&&y&&y.z<=v;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&es(o,h,l,u,c,d,x.x,x.y)&&ae(x.prev,x,x.next)>=0||(x=x.prevZ,y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==i&&y!==a&&es(o,h,l,u,c,d,y.x,y.y)&&ae(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;x&&x.z>=p;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&es(o,h,l,u,c,d,x.x,x.y)&&ae(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==i&&y!==a&&es(o,h,l,u,c,d,y.x,y.y)&&ae(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Qx(r,t,e){let n=r;do{const i=n.prev,s=n.next.next;!fo(i,s)&&Id(i,n,n.next,s)&&Ks(i,s)&&Ks(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Qs(n),Qs(n.next),n=r=s),n=n.next}while(n!==r);return wi(n)}function jx(r,t,e,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&lv(a,o)){let l=Ld(a,o);a=wi(a,a.next),l=wi(l,l.next),$s(a,t,e,n,i,s,0),$s(l,t,e,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function tv(r,t,e,n){const i=[];let s,a,o,l,c;for(s=0,a=t.length;s=e.next.y&&e.next.y!==e.y){const d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=s&&d>n&&(n=d,i=e.x=e.x&&e.x>=l&&s!==e.x&&es(ai.x||e.x===i.x&&sv(i,e)))&&(i=e,h=u)),e=e.next;while(e!==o);return i}function sv(r,t){return ae(r.prev,r,t.prev)<0&&ae(t.next,r,r.next)<0}function rv(r,t,e,n){let i=r;do i.z===0&&(i.z=Al(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,av(i)}function av(r){let t,e,n,i,s,a,o,l,c=1;do{for(e=r,r=null,s=null,a=0;e;){for(a++,n=e,o=0,t=0;t0||l>0&&n;)o!==0&&(l===0||!n||e.z<=n.z)?(i=e,e=e.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;e=n}s.nextZ=null,c*=2}while(a>1);return r}function Al(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function ov(r){let t=r,e=r;do(t.x=(r-a)*(s-o)&&(r-a)*(n-o)>=(e-a)*(t-o)&&(e-a)*(s-o)>=(i-a)*(n-o)}function lv(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!cv(r,t)&&(Ks(r,t)&&Ks(t,r)&&hv(r,t)&&(ae(r.prev,r,t.prev)||ae(r,t.prev,t))||fo(r,t)&&ae(r.prev,r,r.next)>0&&ae(t.prev,t,t.next)>0)}function ae(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function fo(r,t){return r.x===t.x&&r.y===t.y}function Id(r,t,e,n){const i=jr(ae(r,t,e)),s=jr(ae(r,t,n)),a=jr(ae(e,n,r)),o=jr(ae(e,n,t));return!!(i!==s&&a!==o||i===0&&Qr(r,e,t)||s===0&&Qr(r,n,t)||a===0&&Qr(e,r,n)||o===0&&Qr(e,t,n))}function Qr(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function jr(r){return r>0?1:r<0?-1:0}function cv(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Id(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Ks(r,t){return ae(r.prev,r,r.next)<0?ae(r,t,r.next)>=0&&ae(r,r.prev,t)>=0:ae(r,t,r.prev)<0||ae(r,r.next,t)<0}function hv(r,t){let e=r,n=!1;const i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Ld(r,t){const e=new wl(r.i,r.x,r.y),n=new wl(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Ih(r,t,e,n){const i=new wl(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Qs(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 wl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function uv(r,t,e,n){let i=0;for(let s=t,a=e-n;s2&&r[t-1].equals(r[0])&&r.pop()}function Uh(r,t){for(let e=0;eNumber.EPSILON){const K=Math.sqrt(B),$=Math.sqrt(R*R+S*S),Et=it.x-vt/K,lt=it.y+ut/K,_t=j.x-S/$,Ft=j.y+R/$,nt=((_t-Et)*S-(Ft-lt)*R)/(ut*S-vt*R);ht=Et+ut*nt-E.x,X=lt+vt*nt-E.y;const mt=ht*ht+X*X;if(mt<=2)return new Z(ht,X);Tt=Math.sqrt(mt/2)}else{let K=!1;ut>Number.EPSILON?R>Number.EPSILON&&(K=!0):ut<-Number.EPSILON?R<-Number.EPSILON&&(K=!0):Math.sign(vt)===Math.sign(S)&&(K=!0),K?(ht=-vt,X=ut,Tt=Math.sqrt(B)):(ht=ut,X=vt,Tt=Math.sqrt(B/2))}return new Z(ht/Tt,X/Tt)}const pt=[];for(let E=0,it=V.length,j=it-1,ht=E+1;E=0;E--){const it=E/g,j=f*Math.cos(it*Math.PI/2),ht=m*Math.sin(it*Math.PI/2)+_;for(let X=0,Tt=V.length;X=0;){const ht=j;let X=j-1;X<0&&(X=E.length-1);for(let Tt=0,ut=h+g*2;Tt0)&&f.push(x,y,w),(p!==n-1||l0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Fd extends Re{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ft(16777215),this.specular=new ft(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ye,this.combine=ir,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Bd extends Re{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ft(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zn,this.normalScale=new Z(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.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class zd extends Re{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class kd extends Re{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ft(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ye,this.combine=ir,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Vd extends Re{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ft(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Hd extends Oe{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function _i(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function Gd(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Wd(r){function t(i,s){return r[i]-r[s]}const e=r.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort(t),n}function El(r,t,e){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=e[s]*t;for(let l=0;l!==t;++l)i[a++]=r[o+l]}return i}function oc(r,t,e,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&&(t.push(s.time),e.push.apply(e,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(t.push(s.time),a.toArray(e,e.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(t.push(s.time),e.push(a)),s=r[i++];while(s!==void 0)}function mv(r,t,e,n,i=30){const s=r.clone();s.name=t;const a=[];for(let l=0;l=n)){u.push(c.times[f]);for(let _=0;_s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l=o.times[m]){const p=m*u+h,v=p+u-h;_=o.values.slice(p,v)}else{const p=o.createInterpolant(),v=h,x=u-h;p.evaluate(s),_=p.resultBuffer.slice(v,x)}l==="quaternion"&&new ze().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let p=0;p=s)){const o=e[1];t=s)break e}a=n,n=0;break n}break t}for(;n>>1;te;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(i!==void 0&&Gd(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===oa,s=t.length-1;let a=1;for(let o=1;o0){t[a]=t[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}on.prototype.TimeBufferType=Float32Array;on.prototype.ValueBufferType=Float32Array;on.prototype.DefaultInterpolation=Fa;class Ti extends on{constructor(t,e,n){super(t,e,n)}}Ti.prototype.ValueTypeName="bool";Ti.prototype.ValueBufferType=Array;Ti.prototype.DefaultInterpolation=Vs;Ti.prototype.InterpolantFactoryMethodLinear=void 0;Ti.prototype.InterpolantFactoryMethodSmooth=void 0;class cc extends on{}cc.prototype.ValueTypeName="color";class js extends on{}js.prototype.ValueTypeName="number";class Yd extends ur{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(i-e);let c=t*o;for(let h=c+o;c!==h;c+=4)ze.slerpFlat(s,0,a,c-o,a,c,l);return s}}class dr extends on{InterpolantFactoryMethodLinear(t){return new Yd(this.times,this.values,this.getValueSize(),t)}}dr.prototype.ValueTypeName="quaternion";dr.prototype.InterpolantFactoryMethodSmooth=void 0;class Ci extends on{constructor(t,e,n){super(t,e,n)}}Ci.prototype.ValueTypeName="string";Ci.prototype.ValueBufferType=Array;Ci.prototype.DefaultInterpolation=Vs;Ci.prototype.InterpolantFactoryMethodLinear=void 0;Ci.prototype.InterpolantFactoryMethodSmooth=void 0;class tr extends on{}tr.prototype.ValueTypeName="vector";class er{constructor(t="",e=-1,n=[],i=Ja){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=qe(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let a=0,o=n.length;a!==o;++a)e.push(vv(n[a]).scale(i));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let s=0,a=n.length;s!==a;++s)e.push(on.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const s=e.length,a=[];for(let o=0;o1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],e,n));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,_){if(f.length!==0){const g=[],p=[];oc(f,g,p,m),g.length!==0&&_.push(new u(d,g,p))}},i=[],s=t.name||"default",a=t.fps||30,o=t.blendMode;let l=t.length||-1;const c=t.hierarchy||[];for(let u=0;u{e&&e(s),this.manager.itemEnd(t)},0),s;if(bn[t]!==void 0){bn[t].push({onLoad:e,onProgress:n,onError:i});return}bn[t]=[],bn[t].push({onLoad:e,onProgress:n,onError:i});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=bn[t],u=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,m=f!==0;let _=0;const g=new ReadableStream({start(p){v();function v(){u.read().then(({done:x,value:y})=>{if(x)p.close();else{_+=y.byteLength;const I=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let w=0,C=h.length;w{p.error(x)})}}});return new Response(g)}else throw new yv(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{En.add(t,c);const h=bn[t];delete bn[t];for(let u=0,d=h.length;u{const h=bn[t];if(h===void 0)throw this.manager.itemError(t),c;delete bn[t];for(let u=0,d=h.length;u{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Mv extends ke{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Ln(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(o){try{e(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(t)}},n,i)}parse(t){const e=[];for(let n=0;n0:i.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const s in t.uniforms){const a=t.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 ft().setHex(a.value);break;case"v2":i.uniforms[s].value=new Z().fromArray(a.value);break;case"v3":i.uniforms[s].value=new T().fromArray(a.value);break;case"v4":i.uniforms[s].value=new ne().fromArray(a.value);break;case"m3":i.uniforms[s].value=new Bt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Rt().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(t.defines!==void 0&&(i.defines=t.defines),t.vertexShader!==void 0&&(i.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(i.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(i.glslVersion=t.glslVersion),t.extensions!==void 0)for(const s in t.extensions)i.extensions[s]=t.extensions[s];if(t.lights!==void 0&&(i.lights=t.lights),t.clipping!==void 0&&(i.clipping=t.clipping),t.size!==void 0&&(i.size=t.size),t.sizeAttenuation!==void 0&&(i.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(i.map=n(t.map)),t.matcap!==void 0&&(i.matcap=n(t.matcap)),t.alphaMap!==void 0&&(i.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(i.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(i.bumpScale=t.bumpScale),t.normalMap!==void 0&&(i.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(i.normalMapType=t.normalMapType),t.normalScale!==void 0){let s=t.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Z().fromArray(s)}return t.displacementMap!==void 0&&(i.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(i.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(i.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(i.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(i.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(i.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(i.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(i.specularMap=n(t.specularMap)),t.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(t.specularIntensityMap)),t.specularColorMap!==void 0&&(i.specularColorMap=n(t.specularColorMap)),t.envMap!==void 0&&(i.envMap=n(t.envMap)),t.envMapRotation!==void 0&&i.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(i.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(i.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(i.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(i.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(i.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(i.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(i.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(i.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(i.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Z().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(i.iridescenceMap=n(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(i.transmissionMap=n(t.transmissionMap)),t.thicknessMap!==void 0&&(i.thicknessMap=n(t.thicknessMap)),t.anisotropyMap!==void 0&&(i.anisotropyMap=n(t.anisotropyMap)),t.sheenColorMap!==void 0&&(i.sheenColorMap=n(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){const e={ShadowMaterial:Dd,SpriteMaterial:Kl,RawShaderMaterial:Nd,ShaderMaterial:rn,PointsMaterial:jl,MeshPhysicalMaterial:Od,MeshStandardMaterial:ac,MeshPhongMaterial:Fd,MeshToonMaterial:Bd,MeshNormalMaterial:zd,MeshLambertMaterial:kd,MeshDepthMaterial:Jl,MeshDistanceMaterial:$l,MeshBasicMaterial:Jn,MeshMatcapMaterial:Vd,LineDashedMaterial:Hd,LineBasicMaterial:Oe,Material:Re};return new e[t]}}class Tl{static decodeText(t){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(t);let e="";for(let n=0,i=t.length;n0){const l=new hc(e);s=new nr(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=t.length;c0){i=new nr(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=t.length;a{const g=new Ne;g.min.fromArray(_.boxMin),g.max.fromArray(_.boxMax);const p=new Ce;return p.radius=_.sphereRadius,p.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:g,sphereInitialized:_.sphereInitialized,sphere:p}}),a._maxInstanceCount=t.maxInstanceCount,a._maxVertexCount=t.maxVertexCount,a._maxIndexCount=t.maxIndexCount,a._geometryInitialized=t.geometryInitialized,a._geometryCount=t.geometryCount,a._matricesTexture=c(t.matricesTexture.uuid),t.colorsTexture!==void 0&&(a._colorsTexture=c(t.colorsTexture.uuid));break;case"LOD":a=new xd;break;case"Line":a=new Yn(o(t.geometry),l(t.material));break;case"LineLoop":a=new Sd(o(t.geometry),l(t.material));break;case"LineSegments":a=new gn(o(t.geometry),l(t.material));break;case"PointCloud":case"Points":a=new bd(o(t.geometry),l(t.material));break;case"Sprite":a=new _d(l(t.material));break;case"Group":a=new ts;break;case"Bone":a=new Ql;break;default:a=new Zt}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.matrix!==void 0?(a.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.up!==void 0&&a.up.fromArray(t.up),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(a.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(a.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.frustumCulled!==void 0&&(a.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(a.renderOrder=t.renderOrder),t.userData!==void 0&&(a.userData=t.userData),t.layers!==void 0&&(a.layers.mask=t.layers),t.children!==void 0){const d=t.children;for(let f=0;f"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,a=En.get(t);if(a!==void 0){if(s.manager.itemStart(t),a.then){a.then(c=>{e&&e(c),s.manager.itemEnd(t)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(t,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return En.add(t,c),e&&e(c),s.manager.itemEnd(t),c}).catch(function(c){i&&i(c),En.remove(t),s.manager.itemError(t),s.manager.itemEnd(t)});En.add(t,l),s.manager.itemStart(t)}}let ta;class dc{static getContext(){return ta===void 0&&(ta=new(window.AudioContext||window.webkitAudioContext)),ta}static setContext(t){ta=t}}class Lv extends ke{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Ln(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(l){try{const c=l.slice(0);dc.getContext().decodeAudioData(c,function(u){e(u)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):console.error(l),s.manager.itemError(t)}}}const Vh=new Rt,Hh=new Rt,ai=new Rt;class Uv{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ae,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ae,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(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,ai.copy(t.projectionMatrix);const i=e.eyeSep/2,s=i*e.near/e.focus,a=e.near*Math.tan(yi*e.fov*.5)/e.zoom;let o,l;Hh.elements[12]=-i,Vh.elements[12]=i,o=-a*e.aspect+s,l=a*e.aspect+s,ai.elements[0]=2*e.near/(l-o),ai.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(ai),o=-a*e.aspect-s,l=a*e.aspect-s,ai.elements[0]=2*e.near/(l-o),ai.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(ai)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Hh),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Vh)}}class af{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Gh(),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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Gh();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Gh(){return(typeof performance>"u"?Date:performance).now()}const oi=new T,Wh=new ze,Dv=new T,li=new T;class Nv extends Zt{constructor(){super(),this.type="AudioListener",this.context=dc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new af}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(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(oi,Wh,Dv),li.set(0,0,-1).applyQuaternion(Wh),e.positionX){const i=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(oi.x,i),e.positionY.linearRampToValueAtTime(oi.y,i),e.positionZ.linearRampToValueAtTime(oi.z,i),e.forwardX.linearRampToValueAtTime(li.x,i),e.forwardY.linearRampToValueAtTime(li.y,i),e.forwardZ.linearRampToValueAtTime(li.z,i),e.upX.linearRampToValueAtTime(n.x,i),e.upY.linearRampToValueAtTime(n.y,i),e.upZ.linearRampToValueAtTime(n.z,i)}else e.setPosition(oi.x,oi.y,oi.z),e.setOrientation(li.x,li.y,li.z,n.x,n.y,n.z)}}class of extends Zt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=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+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,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!==null&&(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 t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let l=e,c=e+e;l!==c;++l)if(n[l]!==n[l+e]){o.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let s=n,a=i;s!==a;++s)e[s]=e[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let a=0;a!==s;++a)t[e+a]=t[n+a]}_slerp(t,e,n,i){ze.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,s){const a=this._workIndex*s;ze.multiplyQuaternionsFlat(t,a,t,e,t,n),ze.slerpFlat(t,e,t,e,t,a,i)}_lerp(t,e,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=e+o;t[l]=t[l]*a+t[n+o]*i}}_lerpAdditive(t,e,n,i,s){for(let a=0;a!==s;++a){const o=e+a;t[o]=t[o]+t[n+a]*i}}}const fc="\\[\\]\\.:\\/",zv=new RegExp("["+fc+"]","g"),pc="[^"+fc+"]",kv="[^"+fc.replace("\\.","")+"]",Vv=/((?:WC+[\/:])*)/.source.replace("WC",pc),Hv=/(WCOD+)?/.source.replace("WCOD",kv),Gv=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",pc),Wv=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",pc),Xv=new RegExp("^"+Vv+Hv+Gv+Wv+"$"),qv=["material","materials","bones","map"];class Yv{constructor(t,e,n){const i=n||Yt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}class Yt{constructor(t,e,n){this.path=e,this.parsedPath=n||Yt.parseTrackName(e),this.node=Yt.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Yt.Composite(t,e,n):new Yt(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(zv,"")}static parseTrackName(t){const e=Xv.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);qv.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: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){const n=function(s){for(let a=0;a=s){const u=s++,d=t[u];e[d.uuid]=h,t[h]=d,e[c]=u,t[u]=l;for(let f=0,m=i;f!==m;++f){const _=n[f],g=_[u],p=_[h];_[h]=g,_[u]=p}}}this.nCachedObjects_=s}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=t.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,u=e[h];if(u!==void 0)if(delete e[h],u0&&(e[f.uuid]=u),t[u]=f,t.pop();for(let m=0,_=i;m!==_;++m){const g=n[m];g[u]=g[d],g.pop()}}}this.nCachedObjects_=s}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);i=s.length,n[t]=i,a.push(t),o.push(e),s.push(u);for(let d=h,f=l.length;d!==f;++d){const m=l[d];u[d]=new Yt(m,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=t[o];e[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class cf{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const s=e.tracks,a=s.length,o=new Array(a),l={endingStart:pi,endingEnd:pi};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Vu,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(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const i=this._clip.duration,s=t._clip.duration,a=s/i,o=i/s;t.warp(1,a,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=t/a,c[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled){this._updateWeight(t);return}const s=this._startTime;if(s!==null){const l=(t-s)*n;l<0||n===0?e=0:(this._startTime=null,e=n*l)}e*=this._updateTimeScale(t);const a=this._updateTime(e),o=this._updateWeight(t);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case kl:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case Ja:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,s=this._loopCount;const a=n===Hu;if(t===0)return s===-1?i:a&&(s&1)===1?e-i:i;if(n===ku){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else if(i<0)i=0;else{this.time=i;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(s===-1&&(t>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=e||i<0){const o=Math.floor(i/e);i-=e*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(l===1){const c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=mi,i.endingEnd=mi):(t?i.endingStart=this.zeroSlopeAtStart?mi:pi:i.endingStart=Hs,e?i.endingEnd=this.zeroSlopeAtEnd?mi:pi:i.endingEnd=Hs)}_scheduleFading(t,e,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=e,o[1]=s+t,l[1]=n,this}}const Jv=new Float32Array(1);class $v extends Dn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,s=i.length,a=t._propertyBindings,o=t._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const d=i[u],f=d.name;let m=h[f];if(m!==void 0)++m.referenceCount,a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,f));continue}const _=e&&e._propertyBindings[u].binding.parsedPath;m=new lf(Yt.create(n,f,_),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const n=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,n)}const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return e!==null&&e=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,s=Math.sign(t),a=this._accuIndex^=1;for(let c=0;c!==n;++c)e[c]._update(i,t,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Zh).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Jh=new T,ea=new T;class ry{constructor(t=new T,e=new T){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Jh.subVectors(t,this.start),ea.subVectors(this.end,this.start);const n=ea.dot(ea);let s=ea.dot(Jh)/n;return e&&(s=he(s,0,1)),s}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const $h=new T;class ay extends Zt{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new Ht,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,o=1,l=32;a1)for(let u=0;u.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{eu.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(eu,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class vy extends gn{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ht;i.setAttribute("position",new bt(e,3)),i.setAttribute("color",new bt(n,3));const s=new Oe({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(t,e,n){const i=new ft,s=this.geometry.attributes.color.array;return i.set(t),i.toArray(s,0),i.toArray(s,3),i.set(e),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 yy{constructor(){this.type="ShapePath",this.color=new ft,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Js,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,s,a){return this.currentPath.bezierCurveTo(t,e,n,i,s,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(p){const v=[];for(let x=0,y=p.length;xNumber.EPSILON){if(M<0&&(C=v[w],b=-b,P=v[I],M=-M),p.yP.y)continue;if(p.y===C.y){if(p.x===C.x)return!0}else{const L=M*(p.x-C.x)-b*(p.y-C.y);if(L===0)return!0;if(L<0)continue;y=!y}}else{if(p.y!==C.y)continue;if(P.x<=p.x&&p.x<=C.x||C.x<=p.x&&p.x<=P.x)return!0}}return y}const i=pn.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Mi,l.curves=o.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],d=[];let f=[],m=0,_;d[m]=void 0,f[m]=[];for(let p=0,v=s.length;p1){let p=!1,v=0;for(let x=0,y=d.length;x0&&p===!1&&(f=u)}let g;for(let p=0,v=d.length;p{console.warn(y)}))},navigator.xr.offerSession!==void 0&&navigator.xr.offerSession("immersive-vr",T).then(b).catch(y=>{console.warn(y)})}function a(){s.style.display="",s.style.cursor="auto",s.style.left="calc(50% - 75px)",s.style.width="150px",s.onmouseenter=null,s.onmouseleave=null,s.onclick=null}function i(){a(),s.textContent="VR NOT SUPPORTED"}function h(n){a(),console.warn("Exception when trying to call xr.isSessionSupported",n),s.textContent="VR NOT ALLOWED"}function l(n){n.style.position="absolute",n.style.bottom="20px",n.style.padding="12px 6px",n.style.border="1px solid #fff",n.style.borderRadius="4px",n.style.background="rgba(0,0,0,0.1)",n.style.color="#fff",n.style.font="normal 13px sans-serif",n.style.textAlign="center",n.style.opacity="0.5",n.style.outline="none",n.style.zIndex="999"}if("xr"in navigator)return s.id="VRButton",s.style.display="none",l(s),navigator.xr.isSessionSupported("immersive-vr").then(function(n){n?r():i(),n&&g.xrSessionIsGranted&&s.click()}).catch(h),s;{const n=document.createElement("a");return window.isSecureContext===!1?(n.href=document.location.href.replace(/^http:/,"https:"),n.innerHTML="WEBXR NEEDS HTTPS"):(n.href="https://immersiveweb.dev/",n.innerHTML="WEBXR NOT AVAILABLE"),n.style.left="calc(50% - 90px)",n.style.width="180px",n.style.textDecoration="none",l(n),n}}static registerSessionGrantedListener(){if(typeof navigator<"u"&&"xr"in navigator){if(/WebXRViewer\//i.test(navigator.userAgent))return;navigator.xr.addEventListener("sessiongranted",()=>{g.xrSessionIsGranted=!0})}}}g.xrSessionIsGranted=!1;g.registerSessionGrantedListener();const u={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function U(o){const e=await fetch(o);if(e.ok)return e.json();throw new Error(e.statusText)}async function re(o){if(!o)throw new Error("No basePath supplied");return await U(`${o}/profilesList.json`)}async function le(o,e,t=null,s=!0){if(!o)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await re(e);let a;if(o.profiles.some(l=>{const n=r[l];return n&&(a={profileId:l,profilePath:`${e}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!t)throw new Error("No matching profile name found");const l=r[t];if(!l)throw new Error(`No matching profile name found and default profile "${t}" missing.`);a={profileId:t,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}}const i=await U(a.profilePath);let h;if(s){let l;if(o.handedness==="any"?l=i.layouts[Object.keys(i.layouts)[0]]:l=i.layouts[o.handedness],!l)throw new Error(`No matching handedness, ${o.handedness}, in profile ${a.profileId}`);l.assetPath&&(h=a.profilePath.replace("profile.json",l.assetPath))}return{profile:i,assetPath:h}}const de={xAxis:0,yAxis:0,button:0,state:u.ComponentState.DEFAULT};function ue(o=0,e=0){let t=o,s=e;if(Math.sqrt(o*o+e*e)>1){const i=Math.atan2(e,o);t=Math.cos(i),s=Math.sin(i)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:s*.5+.5}}class ce{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===u.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(de)}updateFromComponent({xAxis:e,yAxis:t,button:s,state:r}){const{normalizedXAxis:a,normalizedYAxis:i}=ue(e,t);switch(this.componentProperty){case u.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?a:.5;break;case u.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?i:.5;break;case u.ComponentProperty.BUTTON:this.value=this.states.includes(r)?s:0;break;case u.ComponentProperty.STATE:this.valueNodeProperty===u.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class he{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(s=>{const r=new ce(t.visualResponses[s]);this.visualResponses[s]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:u.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=u.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=u.ComponentState.PRESSED:(t.touched||this.values.button>u.ButtonTouchThreshold)&&(this.values.state=u.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===u.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>u.AxisTouchThreshold&&(this.values.state=u.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===u.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>u.AxisTouchThreshold&&(this.values.state=u.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class pe{constructor(e,t,s){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=s,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const a=this.layoutDescription.components[r];this.components[r]=new he(r,a)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const fe="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",me="generic-trigger";class xe extends z{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(t=>{t.isMesh&&(t.material.envMap=this.envMap,t.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(t=>{Object.values(t.visualResponses).forEach(s=>{const{valueNode:r,minNode:a,maxNode:i,value:h,valueNodeProperty:l}=s;r&&(l===u.VisualResponseProperty.VISIBILITY?r.visible=h:l===u.VisualResponseProperty.TRANSFORM&&(r.quaternion.slerpQuaternions(a.quaternion,i.quaternion,h),r.position.lerpVectors(a.position,i.position,h)))})}))}}function ye(o,e){Object.values(o.components).forEach(t=>{const{type:s,touchPointNodeName:r,visualResponses:a}=t;if(s===u.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(r),t.touchPointNode){const i=new H(.001),h=new R({color:255}),l=new O(i,h);t.touchPointNode.add(l)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(a).forEach(i=>{const{valueNodeName:h,minNodeName:l,maxNodeName:n,valueNodeProperty:b}=i;if(b===u.VisualResponseProperty.TRANSFORM){if(i.minNode=e.getObjectByName(l),i.maxNode=e.getObjectByName(n),!i.minNode){console.warn(`Could not find ${l} in the model`);return}if(!i.maxNode){console.warn(`Could not find ${n} in the model`);return}}i.valueNode=e.getObjectByName(h),i.valueNode||console.warn(`Could not find ${h} in the model`)})})}function B(o,e){ye(o.motionController,e),o.envMap&&e.traverse(t=>{t.isMesh&&(t.material.envMap=o.envMap,t.material.needsUpdate=!0)}),o.add(e)}class ve{constructor(e=null,t=null){this.gltfLoader=e,this.path=fe,this._assetCache={},this.onLoad=t,this.gltfLoader||(this.gltfLoader=new ie)}setPath(e){return this.path=e,this}createControllerModel(e){const t=new xe;let s=null;return e.addEventListener("connected",r=>{const a=r.data;a.targetRayMode!=="tracked-pointer"||!a.gamepad||le(a,this.path,me).then(({profile:i,assetPath:h})=>{t.motionController=new pe(a,i,h);const l=this._assetCache[t.motionController.assetUrl];if(l)s=l.scene.clone(),B(t,s),this.onLoad&&this.onLoad(s);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,n=>{this._assetCache[t.motionController.assetUrl]=n,s=n.scene.clone(),B(t,s),this.onLoad&&this.onLoad(s)},null,()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)})}}).catch(i=>{console.warn(i)})}),e.addEventListener("disconnected",()=>{t.motionController=null,t.remove(s),s=null}),t}}let p,v,c,d,m,L,P,w,N,V,f,A,x,C,E=null;const S=[],we=new G(0,1,0),k={displayGrid:!0};ge();function ge(){v=new W,c=new D({antialias:!0}),c.setPixelRatio(window.devicePixelRatio),c.setSize(window.innerWidth,window.innerHeight),c.setClearColor(12303291),c.xr.enabled=!0,document.body.appendChild(c.domElement),c.domElement.tabIndex=1,c.setAnimationLoop(Ee),m=new M,v.add(m),w=new $(10,10,16777215,16777215),w.material.transparent=!0,w.material.opacity=.5,w.material.depthWrite=!1,m.add(w),p=new X(60,window.innerWidth/window.innerHeight,.1,4e3),p.position.set(0,1,0),m.add(p);const o=new _(16777215);o.position.set(1,2,3),v.add(o);const e=new q(16777215,.2);v.add(e),L=new te,P=new se,A=new M,A.rotation.x=Math.PI/2,A.position.y=32,v.add(A),d=new ae("https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/scene-tileset.json"),A.add(d.group),d.setCamera(p),d.setResolutionFromRenderer(p,c);const t=i=>{S.push(i)};d.downloadQueue.schedulingCallback=t,d.parseQueue.schedulingCallback=t,d.lruCache.maxSize=1200,d.lruCache.minSize=900,N=new oe,V=new G(0,0,1);const s=new R({color:11722715});f=new O(new Y(1.5,.2,16,100),s),f.visible=!1,v.add(f),document.body.appendChild(g.createButton(c)),x=c.xr.getController(0),x.addEventListener("selectstart",()=>{f.visible&&m.position.copy(f.position)}),x.addEventListener("connected",function(i){this.controllerActive=!0,this.add(be(i.data))}),x.addEventListener("disconnected",function(){this.controllerActive=!1,this.remove(this.children[0])}),m.add(x);const r=new ve;C=c.xr.getControllerGrip(0),C.add(r.createControllerModel(C)),m.add(C),j(),window.addEventListener("resize",j,!1);const a=new ne;a.width=300,a.add(k,"displayGrid"),a.open()}function be(o){let e,t;switch(o.targetRayMode){case"tracked-pointer":return e=new J,e.setAttribute("position",new F([0,0,0,0,0,-1],3)),e.setAttribute("color",new F([.5,.5,.5,0,0,0],3)),t=new K({vertexColors:!0,blending:Z,depthWrite:!1,transparent:!0}),new ee(e,t);case"gaze":return e=new Q(.02,.04,32).translate(0,0,-1),t=new R({opacity:.5,transparent:!0}),new O(e,t)}}function j(){p.updateProjectionMatrix(),c.setPixelRatio(window.devicePixelRatio),c.setSize(window.innerWidth,window.innerHeight),p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix()}function Ae(){if(c.xr.isPresenting){if(E===null){const o=c.xr.getCamera(p);d.cameras.forEach(t=>d.deleteCamera(t)),d.setCamera(o);const e=o.cameras[0];e&&d.setResolution(o,e.viewport.z,e.viewport.w),E=c.xr.getSession()}}else E!==null&&(d.cameras.forEach(o=>d.deleteCamera(o)),d.setCamera(p),d.setResolutionFromRenderer(p,c),p.position.set(0,1,0),E=null)}function Ce(){for(let o=0,e=S.length;o + + + + + + 3D Tiles Renderer Batch Example + + + + + + + + + + + +
+ + diff --git a/example/bundle/cmptExample.html b/example/bundle/cmptExample.html new file mode 100644 index 000000000..5dfbb0371 --- /dev/null +++ b/example/bundle/cmptExample.html @@ -0,0 +1,40 @@ + + + + + + + 3D Tiles Renderer Composite Format Example + + + + + + + + + + + + + + + + + diff --git a/example/bundle/customMaterial.html b/example/bundle/customMaterial.html new file mode 100644 index 000000000..8f72cb835 --- /dev/null +++ b/example/bundle/customMaterial.html @@ -0,0 +1,45 @@ + + + + + + + 3D Tiles Renderer Material Example + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/bundle/ellipsoid.html b/example/bundle/ellipsoid.html new file mode 100644 index 000000000..5331b5aab --- /dev/null +++ b/example/bundle/ellipsoid.html @@ -0,0 +1,46 @@ + + + + + + + 3D Tiles Renderer Batch Example + + + + + + + + + + + +
+ + diff --git a/example/bundle/fadingTiles.html b/example/bundle/fadingTiles.html new file mode 100644 index 000000000..298bdbed1 --- /dev/null +++ b/example/bundle/fadingTiles.html @@ -0,0 +1,68 @@ + + + + + + + Dither Fade Tiles + + + + + + + + + + + + + + + + + + + + + +
+ Demonstration of tiles using a dither fade to change, smoothing out the transition. +
+ + diff --git a/example/bundle/gltf.html b/example/bundle/gltf.html new file mode 100644 index 000000000..7162a908c --- /dev/null +++ b/example/bundle/gltf.html @@ -0,0 +1,36 @@ + + + + + + + 3D Tiles Renderer 3DTILES_content_gltf Example + + + + + + + + + + + + + diff --git a/example/bundle/googleMapsAerial.html b/example/bundle/googleMapsAerial.html new file mode 100644 index 000000000..5bf1f1d0a --- /dev/null +++ b/example/bundle/googleMapsAerial.html @@ -0,0 +1,85 @@ + + + + + + + Google 3D Tiles Example + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Example using Googles Photorealistic 3D Tiles - Tokyo Tower +
+ Google Cloud Tiles API key required +
+
+
+
+ + diff --git a/example/bundle/googleMapsExample.html b/example/bundle/googleMapsExample.html new file mode 100644 index 000000000..2fa53676e --- /dev/null +++ b/example/bundle/googleMapsExample.html @@ -0,0 +1,90 @@ + + + + + + + Google 3D Tiles Example + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Example using Googles Photorealistic 3D Tiles - Globe +
+ Google Cloud Tiles API key required +
+
+
+
+ + diff --git a/example/bundle/i3dmExample.html b/example/bundle/i3dmExample.html new file mode 100644 index 000000000..60412fe1a --- /dev/null +++ b/example/bundle/i3dmExample.html @@ -0,0 +1,37 @@ + + + + + + + 3D Tiles Renderer Instanced Example + + + + + + + + + + + + + + diff --git a/example/bundle/index.html b/example/bundle/index.html new file mode 100644 index 000000000..48ff47dfe --- /dev/null +++ b/example/bundle/index.html @@ -0,0 +1,48 @@ + + + + + + + 3D Tiles Renderer Options Example + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/bundle/ionExample.html b/example/bundle/ionExample.html new file mode 100644 index 000000000..40ca9a13b --- /dev/null +++ b/example/bundle/ionExample.html @@ -0,0 +1,70 @@ + + + + + + + 3D Tiles Renderer Cesium Ion Integration Example + + + + + + + + + + + + + + + + + + + + + + +
+
+ Paste the evaluation Cesium Ion token from the Cesium repository or your own token and asset id
into the fields and press "reload" to see the demo. See cesium.com for more information. +
+
+
+ + diff --git a/example/bundle/ionLunar.html b/example/bundle/ionLunar.html new file mode 100644 index 000000000..418399be7 --- /dev/null +++ b/example/bundle/ionLunar.html @@ -0,0 +1,73 @@ + + + + + + + Cesium Ion Lunar Data Set + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Paste the evaluation Cesium Ion token from the Cesium repository or your own token and asset id
into the fields and press "reload" to see the demo. See cesium.com for more information. +
+
+
+ + diff --git a/example/bundle/landformSiteOverlay.html b/example/bundle/landformSiteOverlay.html new file mode 100644 index 000000000..ae978a25a --- /dev/null +++ b/example/bundle/landformSiteOverlay.html @@ -0,0 +1,68 @@ + + + + + + + Landform Drive 1004 Drive Tile Sets + + + + + + + + + + + + + + + + + + + +
+ Set of tiles from M20 Drive 1004 generated using NASA JPL's Landform with generated slope magnitude overlay. +
+ See information on this tile sets generation here. +
+ + diff --git a/example/bundle/mars.html b/example/bundle/mars.html new file mode 100644 index 000000000..896747b5b --- /dev/null +++ b/example/bundle/mars.html @@ -0,0 +1,70 @@ + + + + + + + Dingo Gap Tile Set + + + + + + + + + + + + + + + + + + + + + +
+ Dingo Gap site reconstructed from multiple sols of Curiosity Rover and Mars Reconnaissance Orbiter images. +
+ See more information here. +
+ + diff --git a/example/bundle/metadata.html b/example/bundle/metadata.html new file mode 100644 index 000000000..be3fbb2a7 --- /dev/null +++ b/example/bundle/metadata.html @@ -0,0 +1,99 @@ + + + + + + + 3D Tiles Renderer Metadata Example + + + + + + + + + + + + + + + + + + + + + + +
+
+ Demonstration of displaying glTF Mesh Features and +
+ Structural Metadata properties on mouse-over. +
+ See Cesium repo for demo API key.
+
+
+
+ + diff --git a/example/bundle/offscreenShadows.html b/example/bundle/offscreenShadows.html new file mode 100644 index 000000000..cf5e84c52 --- /dev/null +++ b/example/bundle/offscreenShadows.html @@ -0,0 +1,45 @@ + + + + + + + 3D Tiles Renderer Material Example + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/bundle/pntsExample.html b/example/bundle/pntsExample.html new file mode 100644 index 000000000..72e36dcbd --- /dev/null +++ b/example/bundle/pntsExample.html @@ -0,0 +1,35 @@ + + + + + + + 3D Tiles Renderer Points Example + + + + + + + + + + + + diff --git a/example/bundle/r3f/basic.html b/example/bundle/r3f/basic.html new file mode 100644 index 000000000..605fe88e5 --- /dev/null +++ b/example/bundle/r3f/basic.html @@ -0,0 +1,54 @@ + + + + + + @react-three/fiber 3D Tiles Renderer + + + + + + + + + + + + + + + + + + + + +
Demonstration using @react-three/fiber and @react-three/drei
+
+ + diff --git a/example/bundle/r3f/globe.html b/example/bundle/r3f/globe.html new file mode 100644 index 000000000..aa5cb44a6 --- /dev/null +++ b/example/bundle/r3f/globe.html @@ -0,0 +1,64 @@ + + + + + + @react-three/fiber Cesium Ion + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Example using Google Photorealistic Tiles & @react-three/fiber. +
+ Google Cloud API Token required. +
+
+ + diff --git a/example/bundle/r3f/ion.html b/example/bundle/r3f/ion.html new file mode 100644 index 000000000..bb4a2371a --- /dev/null +++ b/example/bundle/r3f/ion.html @@ -0,0 +1,63 @@ + + + + + + @react-three/fiber Cesium Ion + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Example using Cesium Ion & @react-three/fiber. +
+ Paste the evaluation token from the Cesium repository or your own. +
+
+ + diff --git a/example/bundle/vr.html b/example/bundle/vr.html new file mode 100644 index 000000000..225b9965d --- /dev/null +++ b/example/bundle/vr.html @@ -0,0 +1,42 @@ + + + + + + + 3D Tiles Renderer VR Example + + + + + + + + + + + + + + + + + + + +