From b2a37ca0df3c9c3afa10d247854a0e6c54c6bc57 Mon Sep 17 00:00:00 2001 From: qqmyers Date: Wed, 7 Aug 2024 18:53:59 -0400 Subject: [PATCH 1/5] Initial Voyager 3D support for .glb files --- previewers/betatest/VoyagerPreview.html | 41 +++ previewers/betatest/js/voyager.js | 19 ++ .../lib/voyager-explorer.min.v0.17.0.gdcc.js | 239 ++++++++++++++++++ 3 files changed, 299 insertions(+) create mode 100644 previewers/betatest/VoyagerPreview.html create mode 100644 previewers/betatest/js/voyager.js create mode 100644 previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js diff --git a/previewers/betatest/VoyagerPreview.html b/previewers/betatest/VoyagerPreview.html new file mode 100644 index 0000000..397117c --- /dev/null +++ b/previewers/betatest/VoyagerPreview.html @@ -0,0 +1,41 @@ + + + + + + Voyager 3D Preview + + + + + + + + + + + + Voyager Explorer v0.12.3 + + + + + + +
+

Voyager 3D Preview

+
+
+
+ + +
+
+
+ + + \ No newline at end of file diff --git a/previewers/betatest/js/voyager.js b/previewers/betatest/js/voyager.js new file mode 100644 index 0000000..39ef524 --- /dev/null +++ b/previewers/betatest/js/voyager.js @@ -0,0 +1,19 @@ +$(document).ready(function() { + startPreview(false); +}); + +function translateBaseHtmlPage() { + var videoPreviewText = $.i18n("videoPreviewText"); + $('.videoPreviewText').text(videoPreviewText); +} + +function writeContent(fileUrl, file, title, authors) { + // Currently the styling of Voyager hides this info anyway. + // addStandardPreviewHeader(file, title, authors); + const lastIndexOfChar = fileUrl.lastIndexOf("/"); + const rootUrl = fileUrl.substring(0, lastIndexOfChar + 1); + const fileName = fileUrl.substring(lastIndexOfChar + 1); + console.log(fileUrl); + $("voyager-explorer").attr("root", rootUrl).attr("model", fileName); + $.getScript("lib/voyager-explorer.min.v0.17.0.gdcc.js"); +} \ No newline at end of file diff --git a/previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js b/previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js new file mode 100644 index 0000000..746be60 --- /dev/null +++ b/previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js @@ -0,0 +1,239 @@ +/*This file has been modified for use with Dataverse. Current modifications: + * Added * as anAccept header file type for voyager-explorer in addition to text/plain for model files (line 14 of the minimized file) + +*/ +/*! For license information please see voyager-explorer.min.js.LICENSE.txt */ +(()=>{var e={3523:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n\n// #include \n// replaced with\nvarying vec2 vUv;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\n vec2 coords = vUv * 2.0 - 1.0;\n float f = dot(coords, coords);\n\tgl_FragColor = vec4(outgoingLight, mix(diffuseColor.a, 0.0, f));\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n\n"},2001:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n\n// #include \n// replaced with\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t// #include \n\t// replaced with\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n\n"},8669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="//#define PHYSICAL\n//#define STANDARD\n\n#ifdef PHYSICAL\n #define REFLECTIVITY\n #define CLEARCOAT\n #define TRANSPARENCY\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef TRANSPARENCY\n uniform float transparency;\n#endif\n\n#ifdef REFLECTIVITY\n uniform float reflectivity;\n#endif\n\n#ifdef CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_SHEEN\n uniform vec3 sheen;\n#endif\n\n//#ifndef STANDARD\n//\tuniform float clearCoat;\n//\tuniform float clearCoatRoughness;\n//#endif\n\nvarying vec3 vViewPosition;\n\n\n#include \n#include \n#include \n#include \n\n//#include \n//#include \n// REPLACED WITH\n#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP) || defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n\tvarying vec2 vUv;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n//#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_ZONEMAP\n\tuniform sampler2D zoneMap;\n#endif\n\n#ifdef USE_AOMAP\n uniform vec3 aoMapMix;\n#endif\n\n#ifdef MODE_XRAY\n varying float vIntensity;\n#endif\n\n#ifdef CUT_PLANE\n varying vec3 vWorldPosition;\n uniform vec4 cutPlaneDirection;\n uniform vec3 cutPlaneColor;\n#endif\n\nvoid main() {\n #ifdef CUT_PLANE\n if (dot(vWorldPosition, cutPlaneDirection.xyz) < -cutPlaneDirection.w) {\n discard;\n }\n #endif\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n #include \n\n\t#ifdef CUT_PLANE\n\t // on the cut surface (back facing fragments revealed), replace normal with cut plane direction\n if (!gl_FrontFacing) {\n normal = -cutPlaneDirection.xyz;\n diffuseColor.rgb = cutPlaneColor.rgb;\n }\n\t#endif\n\n #include \n #include \n #include \n\n\t// accumulation\n #if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n vec2 vUv2 = vUv;\n #endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t//#include \n\t// REPLACED WITH\n\t#ifdef USE_AOMAP\n\t // if cut plane is enabled, disable ambient occlusion on back facing fragments\n\t #ifdef CUT_PLANE\n if (gl_FrontFacing) {\n\t #endif\n\n \t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n \tvec3 aoSample = texture2D(aoMap, vUv).rgb;\n \tvec3 aoFactors = mix(vec3(1.0), aoSample, clamp(aoMapMix * aoMapIntensity, 0.0, 1.0));\n \tfloat ambientOcclusion = aoFactors.x * aoFactors.y * aoFactors.z;\n \tfloat ambientOcclusion2 = ambientOcclusion * ambientOcclusion;\n \treflectedLight.directDiffuse *= ambientOcclusion2;\n \treflectedLight.directSpecular *= ambientOcclusion;\n \t//reflectedLight.indirectDiffuse *= ambientOcclusion;\n\n \t#if defined(USE_ENVMAP) && defined(PHYSICAL)\n \t\tfloat dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n \t\treflectedLight.indirectSpecular *= computeSpecularOcclusion(dotNV, ambientOcclusion, material.specularRoughness);\n \t#endif\n\n \t#ifdef CUT_PLANE\n \t }\n \t#endif\n #endif\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n // this is a stub for the transparency model\n #ifdef TRANSPARENCY\n diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n #endif\n\n\t#ifdef CUT_PLANE\n\tif (!gl_FrontFacing) {\n\t\toutgoingLight = cutPlaneColor.rgb;\n\t}\n\t#endif\n\n\tgl_FragColor = vec4(outgoingLight, diffuseColor.a);\n\n\t#ifdef USE_ZONEMAP\n\t\tvec4 zoneColor = texture2D(zoneMap, vUv);\n\t\tgl_FragColor += vec4(zoneColor.rgb, 1.0);\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n #ifdef MODE_NORMALS\n gl_FragColor = vec4(vec3(normal * 0.5 + 0.5), 1.0);\n #endif\n\n #ifdef MODE_XRAY\n gl_FragColor = vec4(vec3(0.4, 0.7, 1.0) * vIntensity, 1.0);\n #endif\n}\n"},9849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="//#define PHYSICAL\n//#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#include \n\n#include \n\n//#include \n//#include \n// REPLACED WITH\n#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP) || defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef MODE_XRAY\n varying float vIntensity;\n#endif\n\n#ifdef CUT_PLANE\n varying vec3 vWorldPosition;\n#endif\n\nvoid main() {\n\n//\t#include \n//\t#include \n// REPLACED WITH\n#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP) || defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n\tvUv = (uvTransform * vec3(uv, 1)).xy;\n#endif\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifdef MODE_XRAY\n vIntensity = pow(abs(1.0 - abs(dot(vNormal, vec3(0.0, 0.0, 1.0)))), 3.0);\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = -mvPosition.xyz;\n\n\t// #include \n\t// REPLACED WITH\n\t#if defined(USE_ENVMAP) || defined(DISTANCE) || defined(USE_SHADOWMAP) || defined(CUT_PLANE)\n \tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n\n\t#include \n\t#include \n\n#ifdef CUT_PLANE\n vWorldPosition = worldPosition.xyz / worldPosition.w;\n#endif\n\n#ifdef MODE_NORMALS\n vNormal = normal;\n#endif\n}\n"},5310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const i=n(2206),s=n(610),r=n(3348),o=n(360),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends i.default{_addVocabularies(){super._addVocabularies(),s.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var h=n(3750);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var u=n(6110);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}})},6657:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends n{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=i;class s extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof i&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function r(e,...t){const n=[e[0]];let i=0;for(;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const i=n(6657),s=n(2715);var r=n(6657);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var o=n(2715);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),t.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?s.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=L(this.rhs,e,t)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof i.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=L(this.rhs,e,t),this}get names(){return R(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class h extends c{constructor(e,t,n,i){super(e,n,i),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class p extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=L(this.code,e,t),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,n)=>t+n.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:n}=this;let i=n.length;for(;i--;){const s=n[i];s.optimizeNames(e,t)||(N(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>P(e,t.names)),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends f{}class y extends g{}y.kind="else";class b extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof b?t:t.nodes:this.nodes.length?this:new b(D(e),t instanceof b?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var n;if(this.else=null===(n=this.else)||void 0===n?void 0:n.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=L(this.condition,e,t),this}get names(){const e=super.names;return R(e,this.condition),this.else&&P(e,this.else.names),e}}b.kind="if";class x extends g{}x.kind="for";class _ extends x{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=L(this.iteration,e,t),this}get names(){return P(super.names,this.iteration.names)}}class w extends x{constructor(e,t,n,i){super(),this.varKind=e,this.name=t,this.from=n,this.to=i}render(e){const t=e.es5?s.varKinds.var:this.varKind,{name:n,from:i,to:r}=this;return`for(${t} ${n}=${i}; ${n}<${r}; ${n}++)`+super.render(e)}get names(){const e=R(super.names,this.from);return R(e,this.to)}}class S extends x{constructor(e,t,n,i){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=L(this.iterable,e,t),this}get names(){return P(super.names,this.iterable.names)}}class M extends g{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}M.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class T extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var n,i;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(i=this.finally)||void 0===i||i.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&P(e,this.catch.names),this.finally&&P(e,this.finally.names),e}}class C extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}C.kind="catch";class A extends g{render(e){return"finally"+super.render(e)}}A.kind="finally";function P(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function R(e,t){return t instanceof i._CodeOrName?P(e,t.names):e}function L(e,t,n){return e instanceof i.Name?r(e):(s=e)instanceof i._Code&&s._items.some((e=>e instanceof i.Name&&1===t[e.str]&&void 0!==n[e.str]))?new i._Code(e._items.reduce(((e,t)=>(t instanceof i.Name&&(t=r(t)),t instanceof i._Code?e.push(...t._items):e.push(t),e)),[])):e;var s;function r(e){const i=n[e.str];return void 0===i||1!==t[e.str]?e:(delete t[e.str],i)}}function N(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function D(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:i._`!${z(e)}`}t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new s.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,i){const s=this._scope.toName(t);return void 0!==n&&i&&(this._constants[s.str]=n),this._leafNode(new l(e,s,n)),s}const(e,t,n){return this._def(s.varKinds.const,e,t,n)}let(e,t,n){return this._def(s.varKinds.let,e,t,n)}var(e,t,n){return this._def(s.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new h(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==i.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[n,s]of e)t.length>1&&t.push(","),t.push(n),(n!==s||this.opts.es5)&&(t.push(":"),(0,i.addCodeArg)(t,s));return t.push("}"),new i._Code(t)}if(e,t,n){if(this._blockNode(new b(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new b(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(b,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,n,i,r=(this.opts.es5?s.varKinds.var:s.varKinds.let)){const o=this._scope.toName(e);return this._for(new w(r,o,t,n),(()=>i(o)))}forOf(e,t,n,r=s.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof i.Name?t:this.var("_arr",t);return this.forRange("_i",0,i._`${e}.length`,(t=>{this.var(o,i._`${e}[${t}]`),n(o)}))}return this._for(new S("of",r,o,t),(()=>n(o)))}forIn(e,t,n,r=(this.opts.es5?s.varKinds.var:s.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,i._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new S("in",r,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(x)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new T;if(this._blockNode(i),this.code(e),t){const e=this.name("e");this._currNode=i.catch=new C(e),t(e)}return n&&(this._currNode=i.finally=new A,this.code(n)),this._endBlockNode(C,A)}throw(e){return this._leafNode(new p(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=i.nil,n,s){return this._blockNode(new M(e,t,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(M)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=D;const O=k(t.operators.AND);t.and=function(...e){return e.reduce(O)};const I=k(t.operators.OR);function k(e){return(t,n)=>t===i.nil?n:n===i.nil?t:i._`${z(t)} ${e} ${z(n)}`}function z(e){return e instanceof i.Name?e:i._`(${e})`}t.or=function(...e){return e.reduce(I)}},2715:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const i=n(6657);class s extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var r;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(r=t.UsedValueState||(t.UsedValueState={})),t.varKinds={const:new i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof i.Name?e:this.name(e)}name(e){return new i.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,n;if((null===(n=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===n?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class a extends i.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=i._`.${new i.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=i._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:i.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(e),{prefix:s}=i,r=null!==(n=t.key)&&void 0!==n?n:t.ref;let o=this._values[s];if(o){const e=o.get(r);if(e)return e}else o=this._values[s]=new Map;o.set(r,i);const a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,i.setValue(t,{property:s,itemIndex:l}),i}getValue(e,t){const n=this._values[e];if(n)return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return i._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,n){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,n)}_reduceValues(e,n,o={},a){let l=i.nil;for(const c in e){const h=e[c];if(!h)continue;const u=o[c]=o[c]||new Map;h.forEach((e=>{if(u.has(e))return;u.set(e,r.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=i._`${l}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new s(e);l=i._`${l}${o}${this.opts._n}`}u.set(e,r.Completed)}))}return l}}},6257:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const i=n(6110),s=n(530),r=n(7748);function o(e,t){const n=e.const("err",t);e.if(i._`${r.default.vErrors} === null`,(()=>e.assign(r.default.vErrors,i._`[${n}]`)),i._`${r.default.vErrors}.push(${n})`),e.code(i._`${r.default.errors}++`)}function a(e,t){const{gen:n,validateName:s,schemaEnv:r}=e;r.$async?n.throw(i._`new ${e.ValidationError}(${t})`):(n.assign(i._`${s}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>i.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?i.str`"${e}" keyword must be ${t} ($data)`:i.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,s,r){const{it:l}=e,{gen:h,compositeRule:u,allErrors:d}=l,p=c(e,n,s);(null!=r?r:u||d)?o(h,p):a(l,i._`[${p}]`)},t.reportExtraError=function(e,n=t.keywordError,i){const{it:s}=e,{gen:l,compositeRule:h,allErrors:u}=s;o(l,c(e,n,i)),h||u||a(s,r.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(r.default.errors,t),e.if(i._`${r.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(i._`${r.default.vErrors}.length`,t)),(()=>e.assign(r.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:s,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",o,r.default.errors,(o=>{e.const(l,i._`${r.default.vErrors}[${o}]`),e.if(i._`${l}.instancePath === undefined`,(()=>e.assign(i._`${l}.instancePath`,(0,i.strConcat)(r.default.instancePath,a.errorPath)))),e.assign(i._`${l}.schemaPath`,i.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(i._`${l}.schema`,n),e.assign(i._`${l}.data`,s))}))};const l={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function c(e,t,n){const{createErrors:s}=e.it;return!1===s?i._`{}`:function(e,t,n={}){const{gen:s,it:o}=e,a=[h(o,n),u(e,n)];return function(e,{params:t,message:n},s){const{keyword:o,data:a,schemaValue:c,it:h}=e,{opts:u,propertyName:d,topSchemaRef:p,schemaPath:m}=h;s.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||i._`{}`]),u.messages&&s.push([l.message,"function"==typeof n?n(e):n]);u.verbose&&s.push([l.schema,c],[l.parentSchema,i._`${p}${m}`],[r.default.data,a]);d&&s.push([l.propertyName,d])}(e,t,a),s.object(...a)}(e,t,n)}function h({errorPath:e},{instancePath:t}){const n=t?i.str`${e}${(0,s.getErrorPath)(t,s.Type.Str)}`:e;return[r.default.instancePath,(0,i.strConcat)(r.default.instancePath,n)]}function u({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let o=r?t:i.str`${t}/${e}`;return n&&(o=i.str`${o}${(0,s.getErrorPath)(n,s.Type.Str)}`),[l.schemaPath,o]}},9336:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const i=n(6110),s=n(7939),r=n(7748),o=n(6184),a=n(530),l=n(3750),c=n(5858);class h{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){const t=p.call(this,e);if(t)return t;const n=(0,o.getFullPath)(e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:h}=this.opts,u=new i.CodeGen(this.scope,{es5:a,lines:c,ownProperties:h});let d;e.$async&&(d=u.scopeValue("Error",{ref:s.default,code:i._`require("ajv/dist/runtime/validation_error").default`}));const m=u.scopeName("validate");e.validateName=m;const f={gen:u,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,i.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:d,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:i.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:i._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),u.optimize(this.opts.code.optimize);const t=u.toString();g=`${u.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:n}),n.errors=null,n.schema=e.schema,n.schemaEnv=e,e.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:m,validateCode:t,scopeValues:u._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof i.Name?void 0:e,items:t instanceof i.Name?void 0:t,dynamicProps:e instanceof i.Name,dynamicItems:t instanceof i.Name},n.source&&(n.source.evaluated=(0,i.stringify)(n.evaluated))}return e.validate=n,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function d(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function p(e){for(const i of this._compilations)if(n=e,(t=i).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return i;var t,n}function m(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||f.call(this,e,t)}function f(e,t){const n=c.parse(t),i=(0,o._getFullPath)(n);let s=(0,o.getFullPath)(e.baseId);if(Object.keys(e.schema).length>0&&i===s)return v.call(this,n,e);const r=(0,o.normalizeId)(i),a=this.refs[r]||this.schemas[r];if("string"==typeof a){const t=f.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return v.call(this,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||u.call(this,a),r===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,i=t[n];return i&&(s=(0,o.resolveUrl)(s,i)),new h({schema:t,schemaId:n,root:e,baseId:s})}return v.call(this,n,a)}}t.SchemaEnv=h,t.compileSchema=u,t.resolveRef=function(e,t,n){var i;n=(0,o.resolveUrl)(t,n);const s=e.refs[n];if(s)return s;let r=m.call(this,e,n);if(void 0===r){const s=null===(i=e.localRefs)||void 0===i?void 0:i[n],{schemaId:o}=this.opts;s&&(r=new h({schema:s,schemaId:o,root:e,baseId:t}))}return void 0!==r?e.refs[n]=d.call(this,r):void 0},t.getCompilingSchema=p,t.resolveSchema=f;const g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(e,{baseId:t,schema:n,root:i}){var s;if("/"!==(null===(s=e.fragment)||void 0===s?void 0:s[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(i)];if(void 0===e)return;const s="object"==typeof(n=e)&&n[this.opts.schemaId];!g.has(i)&&s&&(t=(0,o.resolveUrl)(t,s))}let r;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,o.resolveUrl)(t,n.$ref);r=f.call(this,i,e)}const{schemaId:l}=this.opts;return r=r||new h({schema:n,schemaId:l,root:i,baseId:t}),r.schema!==r.root.schema?r:void 0}},7748:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")};t.default=s},3482:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6184);class s extends Error{constructor(e,t,n){super(n||`can't resolve reference ${t} from id ${e}`),this.missingRef=(0,i.resolveUrl)(e,t),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(this.missingRef))}}t.default=s},6184:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const i=n(530),s=n(8926),r=n(8125),o=n(5858),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&h(e)<=t)};const l=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(l.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(c))return!0;if("object"==typeof n&&c(n))return!0}return!1}function h(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!a.has(n)&&("object"==typeof e[n]&&(0,i.eachItem)(e[n],(e=>t+=h(e))),t===1/0))return 1/0}return t}function u(e="",t){!1!==t&&(e=m(e));return d(o.parse(e))}function d(e){return o.serialize(e).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=d;const p=/#\/?$/;function m(e){return e?e.replace(p,""):""}t.normalizeId=m,t.resolveUrl=function(e,t){return t=m(t),o.resolve(e,t)};const f=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n}=this.opts,i=m(e[n]||t),a={"":i},l=u(i,!1),c={},h=new Set;return r(e,{allKeys:!0},((e,t,i,s)=>{if(void 0===s)return;const r=l+t;let u=a[s];function g(t){if(t=m(u?o.resolve(u,t):t),h.has(t))throw p(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?d(e,n.schema,t):t!==m(r)&&("#"===t[0]?(d(e,c[t],t),c[t]=e):this.refs[t]=r),t}function v(e){if("string"==typeof e){if(!f.test(e))throw new Error(`invalid anchor "${e}"`);g.call(this,`#${e}`)}}"string"==typeof e[n]&&(u=g.call(this,e[n])),v.call(this,e.$anchor),v.call(this,e.$dynamicAnchor),a[t]=u})),c;function d(e,t,n){if(void 0!==t&&!s(e,t))throw p(n)}function p(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},6754:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const n=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&n.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},530:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const i=n(6110),s=n(6657);function r(e,t=e.schema){const{opts:n,self:i}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const s=i.RULES.keywords;for(const n in t)s[n]||m(e,`unknown keyword: "${n}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const n in e)if(t[n])return!0;return!1}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:s}){return(r,o,a,l)=>{const c=void 0===a?o:a instanceof i.Name?(o instanceof i.Name?e(r,o,a):t(r,o,a),a):o instanceof i.Name?(t(r,a,o),o):n(o,a);return l!==i.Name||c instanceof i.Name?c:s(r,c)}}function h(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",i._`{}`);return void 0!==t&&u(e,n,t),n}function u(e,t,n){Object.keys(n).forEach((n=>e.assign(i._`${t}${(0,i.getProperty)(n)}`,!0)))}t.toHash=function(e){const t={};for(const n of e)t[n]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!o(t,e.self.RULES.all))},t.checkUnknownRules=r,t.schemaHasRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,s,r){if(!r){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return i._`${n}`}return i._`${e}${t}${(0,i.getProperty)(s)}`},t.unescapeFragment=function(e){return l(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=l,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>{e.if(i._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,i._`${n} || {}`).code(i._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,i._`${n} || {}`),u(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:h}),items:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,i._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>e.assign(n,!0===t||i._`${n} > ${t} ? ${n} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=h,t.setEvaluated=u;const d={};var p;function m(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:d[t.code]||(d[t.code]=new s._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(p=t.Type||(t.Type={})),t.getErrorPath=function(e,t,n){if(e instanceof i.Name){const s=t===p.Num;return n?s?i._`"[" + ${e} + "]"`:i._`"['" + ${e} + "']"`:s?i._`"/" + ${e}`:i._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=m},7177:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>i(e,t)))}function i(e,t){var n;return void 0!==e[t.keyword]||(null===(n=t.definition.implements)||void 0===n?void 0:n.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},i){const s=t.RULES.types[i];return s&&!0!==s&&n(e,s)},t.shouldUseGroup=n,t.shouldUseRule=i},2971:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const i=n(6257),s=n(6110),r=n(7748),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:s}=e,r={gen:n,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,i.reportError)(r,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:i}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(r.default.data):(t.assign(s._`${i}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:i}=e;!1===i?(n.var(t,!1),a(e)):n.var(t,!0)}},7349:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const i=n(6754),s=n(7177),r=n(6257),o=n(6110),a=n(530);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(i.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l=t.DataType||(t.DataType={})),t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:i,opts:r}=e,a=function(e,t){return t?e.filter((e=>h.has(e)||"array"===t&&"array"===e)):[]}(t,r.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,s.schemaHasRulesForType)(e,t[0]));if(c){const s=d(t,i,r.strictNumbers,l.Wrong);n.if(s,(()=>{a.length?function(e,t,n){const{gen:i,data:s,opts:r}=e,a=i.let("dataType",o._`typeof ${s}`),l=i.let("coerced",o._`undefined`);"array"===r.coerceTypes&&i.if(o._`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,(()=>i.assign(s,o._`${s}[0]`).assign(a,o._`typeof ${s}`).if(d(t,s,r.strictNumbers),(()=>i.assign(l,s)))));i.if(o._`${l} !== undefined`);for(const e of n)(h.has(e)||"array"===e&&"array"===r.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void i.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${s}`).elseIf(o._`${s} === null`).assign(l,o._`""`);case"number":return void i.elseIf(o._`${a} == "boolean" || ${s} === null + || (${a} == "string" && ${s} && ${s} == +${s})`).assign(l,o._`+${s}`);case"integer":return void i.elseIf(o._`${a} === "boolean" || ${s} === null + || (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(l,o._`+${s}`);case"boolean":return void i.elseIf(o._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(l,!1).elseIf(o._`${s} === "true" || ${s} === 1`).assign(l,!0);case"null":return i.elseIf(o._`${s} === "" || ${s} === 0 || ${s} === false`),void i.assign(l,null);case"array":i.elseIf(o._`${a} === "string" || ${a} === "number" + || ${a} === "boolean" || ${s} === null`).assign(l,o._`[${s}]`)}}i.else(),m(e),i.endIf(),i.if(o._`${l} !== undefined`,(()=>{i.assign(s,l),function({gen:e,parentData:t,parentDataProperty:n},i){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,i)))}(e,l)}))}(e,t,a):m(e)}))}return c};const h=new Set(["string","number","integer","boolean","null"]);function u(e,t,n,i=l.Correct){const s=i===l.Correct?o.operators.EQ:o.operators.NEQ;let r;switch(e){case"null":return o._`${t} ${s} null`;case"array":r=o._`Array.isArray(${t})`;break;case"object":r=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":r=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":r=a();break;default:return o._`typeof ${t} ${s} ${e}`}return i===l.Correct?r:(0,o.not)(r);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function d(e,t,n,i){if(1===e.length)return u(e[0],t,n,i);let s;const r=(0,a.toHash)(e);if(r.array&&r.object){const e=o._`typeof ${t} != "object"`;s=r.null?e:o._`!${t} || ${e}`,delete r.null,delete r.array,delete r.object}else s=o.nil;r.number&&delete r.integer;for(const e in r)s=(0,o.and)(s,u(e,t,n,i));return s}t.checkDataType=u,t.checkDataTypes=d;const p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:n,schema:i}=e,s=(0,a.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:n,schema:i.type,schemaCode:s,schemaValue:s,parentSchema:i,params:{},it:e}}(e);(0,r.reportError)(t,p)}t.reportTypeError=m},5944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const i=n(6110),s=n(530);function r(e,t,n){const{gen:r,compositeRule:o,data:a,opts:l}=e;if(void 0===n)return;const c=i._`${a}${(0,i.getProperty)(t)}`;if(o)return void(0,s.checkStrictMode)(e,`default is ignored for: ${c}`);let h=i._`${c} === undefined`;"empty"===l.useDefaults&&(h=i._`${h} || ${c} === null || ${c} === ""`),r.if(h,i._`${c} = ${(0,i.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:i}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(i)&&i.forEach(((t,n)=>r(e,n,t.default)))}},3750:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const i=n(2971),s=n(7349),r=n(7177),o=n(7349),a=n(5944),l=n(2e3),c=n(5678),h=n(6110),u=n(7748),d=n(6184),p=n(530),m=n(6257);function f({gen:e,validateName:t,schema:n,schemaEnv:i,opts:s},r){s.code.es5?e.func(t,h._`${u.default.data}, ${u.default.valCxt}`,i.$async,(()=>{e.code(h._`"use strict"; ${g(n,s)}`),function(e,t){e.if(u.default.valCxt,(()=>{e.var(u.default.instancePath,h._`${u.default.valCxt}.${u.default.instancePath}`),e.var(u.default.parentData,h._`${u.default.valCxt}.${u.default.parentData}`),e.var(u.default.parentDataProperty,h._`${u.default.valCxt}.${u.default.parentDataProperty}`),e.var(u.default.rootData,h._`${u.default.valCxt}.${u.default.rootData}`),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`${u.default.valCxt}.${u.default.dynamicAnchors}`)}),(()=>{e.var(u.default.instancePath,h._`""`),e.var(u.default.parentData,h._`undefined`),e.var(u.default.parentDataProperty,h._`undefined`),e.var(u.default.rootData,u.default.data),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`{}`)}))}(e,s),e.code(r)})):e.func(t,h._`${u.default.data}, ${function(e){return h._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${e.dynamicRef?h._`, ${u.default.dynamicAnchors}={}`:h.nil}}={}`}(s)}`,i.$async,(()=>e.code(g(n,s)).code(r)))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?h._`/*# sourceURL=${n} */`:h.nil}function v(e,t){b(e)&&(x(e),y(e))?function(e,t){const{schema:n,gen:i,opts:s}=e;s.$comment&&n.$comment&&w(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const r=i.const("_errs",u.default.errors);_(e,r),i.var(t,h._`${r} === ${u.default.errors}`)}(e,t):(0,i.boolOrEmptySchema)(e,t)}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function b(e){return"boolean"!=typeof e.schema}function x(e){(0,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:i,self:s}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function _(e,t){if(e.opts.jtd)return S(e,[],!1,t);const n=(0,s.getSchemaTypes)(e.schema);S(e,n,!(0,s.coerceAndCheckDataType)(e,n),t)}function w({gen:e,schemaEnv:t,schema:n,errSchemaPath:i,opts:s}){const r=n.$comment;if(!0===s.$comment)e.code(h._`${u.default.self}.logger.log(${r})`);else if("function"==typeof s.$comment){const n=h.str`${i}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code(h._`${u.default.self}.opts.$comment(${r}, ${n}, ${s}.schema)`)}}function S(e,t,n,i){const{gen:s,schema:a,data:l,allErrors:c,opts:d,self:m}=e,{RULES:f}=m;function g(p){(0,r.shouldUseGroup)(a,p)&&(p.type?(s.if((0,o.checkDataType)(p.type,l,d.strictNumbers)),M(e,p),1===t.length&&t[0]===p.type&&n&&(s.else(),(0,o.reportTypeError)(e)),s.endIf()):M(e,p),c||s.if(h._`${u.default.errors} === ${i||0}`))}!a.$ref||!d.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(d.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{T(e.dataTypes,t)||C(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),e.dataTypes=e.dataTypes.filter((e=>T(t,e)))})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&C(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const i in n){const s=n[i];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:n}=s.definition;n.length&&!n.some((e=>E(t,e)))&&C(e,`missing type "${n.join(",")}" for keyword "${i}"`)}}}(e,e.dataTypes)}(e,t),s.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):s.block((()=>P(e,"$ref",f.all.$ref.definition)))}function M(e,t){const{gen:n,schema:i,opts:{useDefaults:s}}=e;s&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,r.shouldUseRule)(i,n)&&P(e,n.keyword,n.definition,t.type)}))}function E(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function T(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function C(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){b(e)&&(x(e),y(e))?function(e){const{schema:t,opts:n,gen:i}=e;f(e,(()=>{n.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),i.let(u.default.vErrors,null),i.let(u.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",h._`${n}.evaluated`),t.if(h._`${e.evaluated}.dynamicProps`,(()=>t.assign(h._`${e.evaluated}.props`,h._`undefined`))),t.if(h._`${e.evaluated}.dynamicItems`,(()=>t.assign(h._`${e.evaluated}.items`,h._`undefined`)))}(e),_(e),function(e){const{gen:t,schemaEnv:n,validateName:i,ValidationError:s,opts:r}=e;n.$async?t.if(h._`${u.default.errors} === 0`,(()=>t.return(u.default.data)),(()=>t.throw(h._`new ${s}(${u.default.vErrors})`))):(t.assign(h._`${i}.errors`,u.default.vErrors),r.unevaluated&&function({gen:e,evaluated:t,props:n,items:i}){n instanceof h.Name&&e.assign(h._`${t}.props`,n);i instanceof h.Name&&e.assign(h._`${t}.items`,i)}(e),t.return(h._`${u.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,i.topBoolOrEmptySchema)(e)))};class A{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",N(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",u.default.errors))}result(e,t,n){this.failResult((0,h.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,h.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(h._`${t} !== undefined && (${(0,h.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_error(e,t){(e?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=h.nil){this.gen.block((()=>{this.check$data(e,n),t()}))}check$data(e=h.nil,t=h.nil){if(!this.$data)return;const{gen:n,schemaCode:i,schemaType:s,def:r}=this;n.if((0,h.or)(h._`${i} === undefined`,t)),e!==h.nil&&n.assign(e,!0),(s.length||r.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==h.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:n,def:i,it:s}=this;return(0,h.or)(function(){if(n.length){if(!(t instanceof h.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return h._`${(0,o.checkDataTypes)(e,t,s.opts.strictNumbers,o.DataType.Wrong)}`}return h.nil}(),function(){if(i.validateSchema){const n=e.scopeValue("validate$data",{ref:i.validateSchema});return h._`!${n}(${t})`}return h.nil}())}subschema(e,t){const n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);const i={...this.it,...n,items:void 0,props:void 0};return v(i,t),i}mergeEvaluated(e,t){const{it:n,gen:i}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(i,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(i,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:i}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return i.if(t,(()=>this.mergeEvaluated(e,h.Name))),!0}}function P(e,t,n,i){const s=new A(e,n,t);"code"in n?n.code(s,i):s.$data&&n.validate?(0,l.funcKeywordCode)(s,n):"macro"in n?(0,l.macroKeywordCode)(s,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(s,n)}t.KeywordCxt=A;const R=/^\/(?:[^~]|~0|~1)*$/,L=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:n,dataPathArr:i}){let s,r;if(""===e)return u.default.rootData;if("/"===e[0]){if(!R.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,r=u.default.rootData}else{const o=L.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(s=o[2],"#"===s){if(a>=t)throw new Error(l("property/index",a));return i[t-a]}if(a>t)throw new Error(l("data",a));if(r=n[t-a],!s)return r}let o=r;const a=s.split("/");for(const e of a)e&&(r=h._`${r}${(0,h.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=h._`${o} && ${r}`);return o;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=N},2e3:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const i=n(6110),s=n(7748),r=n(7111),o=n(6257);function a(e){const{gen:t,data:n,it:s}=e;t.if(s.parentData,(()=>t.assign(n,i._`${s.parentData}[${s.parentDataProperty}]`)))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,i.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:s,schema:r,parentSchema:o,it:a}=e,c=t.macro.call(a.self,r,o,a),h=l(n,s,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const u=n.name("valid");e.subschema({schema:c,schemaPath:i.nil,errSchemaPath:`${a.errSchemaPath}/${s}`,topSchemaRef:h,compositeRule:!0},u),e.pass(u,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:h,schema:u,parentSchema:d,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const f=!p&&t.compile?t.compile.call(m.self,u,d,m):t.validate,g=l(c,h,f),v=c.let("valid");function y(n=(t.async?i._`await `:i.nil)){const o=m.opts.passContext?s.default.this:s.default.self,a=!("compile"in t&&!p||!1===t.schema);c.assign(v,i._`${n}${(0,r.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var n;c.if((0,i.not)(null!==(n=t.valid)&&void 0!==n?n:v),e)}e.block$data(v,(function(){if(!1===t.errors)y(),t.modifying&&a(e),b((()=>e.error()));else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>y(i._`await `)),(t=>c.assign(v,!1).if(i._`${t} instanceof ${m.ValidationError}`,(()=>c.assign(e,i._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=i._`${g}.errors`;return c.assign(e,null),y(i.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:n}=e;n.if(i._`Array.isArray(${t})`,(()=>{n.assign(s.default.vErrors,i._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`).assign(s.default.errors,i._`${s.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:v)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:i},s,r){if(Array.isArray(s.keyword)?!s.keyword.includes(r):s.keyword!==r)throw new Error("ajv implementation error");const o=s.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${r}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[r])){const e=`keyword "${r}" value is invalid at path "${i}": `+n.errorsText(s.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}}},5678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const i=n(6110),s=n(530);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==r)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const r=e.schema[t];return void 0===n?{schema:r,schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:r[n],schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}${(0,i.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,s.escapeFragment)(n)}`}}if(void 0!==r){if(void 0===o||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:l,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:a,propertyName:l}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:l}=t;h(c.let("data",i._`${t.data}${(0,i.getProperty)(n)}`,!0)),e.errorPath=i.str`${o}${(0,s.getErrorPath)(n,r,l.jsPropertySyntax)}`,e.parentDataProperty=i._`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}if(void 0!==o){h(o instanceof i.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)}function h(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:i,createErrors:s,allErrors:r}){void 0!==i&&(e.compositeRule=i),void 0!==s&&(e.createErrors=s),void 0!==r&&(e.allErrors=r),e.jtdDiscriminator=t,e.jtdMetadata=n}},2206:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var i=n(3750);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return i.KeywordCxt}});var s=n(6110);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return s.CodeGen}});const r=n(7939),o=n(3482),a=n(6754),l=n(9336),c=n(6110),h=n(6184),u=n(7349),d=n(530),p=n(338),m=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function y(e){var t,n,i,s,r,o,a,l,c,h,u,d,p,m,f,g,v,y,b,x,_,w;const S=e.strict,M=null===(t=e.code)||void 0===t?void 0:t.optimize,E=!0===M||void 0===M?1:M||0;return{strictSchema:null===(i=null!==(n=e.strictSchema)&&void 0!==n?n:S)||void 0===i||i,strictNumbers:null===(r=null!==(s=e.strictNumbers)&&void 0!==s?s:S)||void 0===r||r,strictTypes:null!==(a=null!==(o=e.strictTypes)&&void 0!==o?o:S)&&void 0!==a?a:"log",strictTuples:null!==(c=null!==(l=e.strictTuples)&&void 0!==l?l:S)&&void 0!==c?c:"log",strictRequired:null!==(u=null!==(h=e.strictRequired)&&void 0!==h?h:S)&&void 0!==u&&u,code:e.code?{...e.code,optimize:E}:{optimize:E},loopRequired:null!==(d=e.loopRequired)&&void 0!==d?d:200,loopEnum:null!==(p=e.loopEnum)&&void 0!==p?p:200,meta:null===(m=e.meta)||void 0===m||m,messages:null===(f=e.messages)||void 0===f||f,inlineRefs:null===(g=e.inlineRefs)||void 0===g||g,schemaId:null!==(v=e.schemaId)&&void 0!==v?v:"$id",addUsedSchema:null===(y=e.addUsedSchema)||void 0===y||y,validateSchema:null===(b=e.validateSchema)||void 0===b||b,validateFormats:null===(x=e.validateFormats)||void 0===x||x,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(w=e.int32range)||void 0===w||w}}class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...y(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:f,es5:t,lines:n}),this.logger=function(e){if(!1===e)return T;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),x.call(this,g,e,"NOT SUPPORTED"),x.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=E.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&M.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let i=p;"id"===n&&(i={...p},i.id=i.$id,delete i.$id),t&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let n;if("string"==typeof e){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);const i=n(t);return"$async"in n||(this.errors=n.errors),i}compile(e,t){const n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:n}=this.opts;return i.call(this,e,t);async function i(e,t){await s.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||r.call(this,n)}async function s(e){e&&!this.getSchema(e)&&await i.call(this,{$ref:e},!0)}async function r(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),r.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){const n=await c.call(this,e);this.refs[e]||await s.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,i);return this}let s;if("object"==typeof e){const{schemaId:t}=this.opts;if(s=e[t],void 0!==s&&"string"!=typeof s)throw new Error(`schema ${t} must be string`)}return t=(0,h.normalizeId)(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,i,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let n;if(n=e.$schema,void 0!==n&&"string"!=typeof n)throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(n,e);if(!i&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return i}getSchema(e){let t;for(;"string"==typeof(t=_.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,i=new l.SchemaEnv({schema:{},schemaId:n});if(t=l.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=_.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,h.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(A.call(this,n,t),!t)return(0,d.eachItem)(n,(e=>P.call(this,e))),this;L.call(this,t);const i={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,0===i.type.length?e=>P.call(this,e,i):e=>i.type.forEach((t=>P.call(this,e,i,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const n of t.rules){const t=n.rules.findIndex((t=>t.keyword===e));t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){return e&&0!==e.length?e.map((e=>`${n}${e.instancePath} ${e.message}`)).reduce(((e,n)=>e+t+n)):"No errors"}$dataMetaSchema(e,t){const n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const i of t){const t=i.split("/").slice(1);let s=e;for(const e of t)s=s[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:i}=t.definition,r=s[e];i&&r&&(s[e]=D(r))}}return e}_removeAllSchemas(e,t){for(const n in e){const i=e[n];t&&!t.test(n)||("string"==typeof i?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,t,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let r;const{schemaId:o}=this.opts;if("object"==typeof e)r=e[o];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;n=(0,h.normalizeId)(r||n);const c=h.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),i&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function x(e,t,n,i="error"){for(const s in e){const r=s;r in t&&this.logger[i](`${n}: option ${s}. ${e[r]}`)}}function _(e){return e=(0,h.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function M(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}}function E(){const e={...this.opts};for(const t of m)delete e[t];return e}t.default=b,b.ValidationError=r.default,b.MissingRefError=o.default;const T={log(){},warn(){},error(){}};const C=/^[a-z_$][a-z0-9_$:-]*$/i;function A(e,t){const{RULES:n}=this;if((0,d.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!C.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function P(e,t,n){var i;const s=null==t?void 0:t.post;if(n&&s)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:r}=this;let o=s?r.post:r.rules.find((({type:e})=>e===n));if(o||(o={type:n,rules:[]},r.rules.push(o)),r.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?R.call(this,o,a,t.before):o.rules.push(a),r.all[e]=a,null===(i=t.implements)||void 0===i||i.forEach((e=>this.addKeyword(e)))}function R(e,t,n){const i=e.rules.findIndex((e=>e.keyword===n));i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function L(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=D(t)),e.validateSchema=this.compile(t,!0))}const N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D(e){return{anyOf:[e,N]}}},8062:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8926);i.code='require("ajv/dist/runtime/equal").default',t.default=i},5842:(e,t)=>{"use strict";function n(e){const t=e.length;let n,i=0,s=0;for(;s=55296&&n<=56319&&s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=n},1600:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const i=n(6110),s=n(530),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:i}=t;Array.isArray(i)?o(e,i):(0,s.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:r,data:o,keyword:a,it:l}=e;l.items=!0;const c=n.const("len",i._`${o}.length`);if(!1===r)e.setParams({len:t.length}),e.pass(i._`${c} <= ${t.length}`);else if("object"==typeof r&&!(0,s.alwaysValidSchema)(l,r)){const r=n.var("valid",i._`${c} <= ${t.length}`);n.if((0,i.not)(r),(()=>function(r){n.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:s.Type.Num},r),l.allErrors||n.if((0,i.not)(r),(()=>n.break()))}))}(r))),e.ok(r)}}t.validateAdditionalItems=o,t.default=r},8183:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r=n(7748),o=n(530),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>s._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:l,errsCount:c,it:h}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:u,opts:d}=h;if(h.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(h,n))return;const p=(0,i.allSchemaProperties)(a.properties),m=(0,i.allSchemaProperties)(a.patternProperties);function f(e){t.code(s._`delete ${l}[${e}]`)}function g(i){if("all"===d.removeAdditional||d.removeAdditional&&!1===n)f(i);else{if(!1===n)return e.setParams({additionalProperty:i}),e.error(),void(u||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(h,n)){const n=t.name("valid");"failing"===d.removeAdditional?(v(i,n,!1),t.if((0,s.not)(n),(()=>{e.reset(),f(i)}))):(v(i,n),u||t.if((0,s.not)(n),(()=>t.break())))}}}function v(t,n,i){const s={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===i&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(s,n)}t.forIn("key",l,(n=>{p.length||m.length?t.if(function(n){let r;if(p.length>8){const e=(0,o.schemaRefOrVal)(h,a.properties,"properties");r=(0,i.isOwnProperty)(t,e,n)}else r=p.length?(0,s.or)(...p.map((e=>s._`${n} === ${e}`))):s.nil;return m.length&&(r=(0,s.or)(r,...m.map((t=>s._`${(0,i.usePattern)(e,t)}.test(${n})`)))),(0,s.not)(r)}(n),(()=>g(n))):g(n)})),e.ok(s._`${c} === ${r.default.errors}`)}};t.default=a},8302:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(530),s={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:s}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const r=t.name("valid");n.forEach(((t,n)=>{if((0,i.alwaysValidSchema)(s,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},r);e.ok(r),e.mergeEvaluated(o)}))}};t.default=s},120:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(7111).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=i},7458:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?i.str`must contain at least ${e} valid item(s)`:i.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?i._`{minContains: ${e}}`:i._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:a}=e;let l,c;const{minContains:h,maxContains:u}=r;a.opts.next?(l=void 0===h?1:h,c=u):l=1;const d=t.const("len",i._`${o}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,s.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,s.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,s.alwaysValidSchema)(a,n)){let t=i._`${d} >= ${l}`;return void 0!==c&&(t=i._`${t} && ${d} <= ${c}`),void e.pass(t)}a.items=!0;const p=t.name("valid");function m(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(i._`${e}++`),void 0===c?t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0).break())):(t.if(i._`${e} > ${c}`,(()=>t.assign(p,!1).break())),1===l?t.assign(p,!0):t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,i){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:s.Type.Num,compositeRule:!0},n),i()}))}void 0===c&&1===l?f(p,(()=>t.if(p,(()=>t.break())))):(t.let(p,!1),0===l?t.if(i._`${o}.length > 0`,m,(()=>t.assign(p,!0))):m()),e.result(p,(()=>e.reset()))}};t.default=r},2790:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const i=n(6110),s=n(530),r=n(7111);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const s=1===t?"property":"properties";return i.str`must have ${s} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:s}})=>i._`{property: ${e}, + missingProperty: ${s}, + depsCount: ${t}, + deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const i in e){if("__proto__"===i)continue;(Array.isArray(e[i])?t:n)[i]=e[i]}return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:s,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const h=(0,r.propertyInData)(n,s,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?n.if(h,(()=>{for(const t of c)(0,r.checkReportMissingProp)(e,t)})):(n.if(i._`${h} && (${(0,r.checkMissingProp)(e,c,a)})`),(0,r.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:i,keyword:o,it:a}=e,l=n.name("valid");for(const c in t)(0,s.alwaysValidSchema)(a,t[c])||(n.if((0,r.propertyInData)(n,i,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},7498:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>i.str`must match "${e.ifClause}" schema`,params:({params:e})=>i._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:r}=e;void 0===n.then&&void 0===n.else&&(0,s.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const a=o(r,"then"),l=o(r,"else");if(!a&&!l)return;const c=t.let("valid",!0),h=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(h,u("then",n),u("else",n))}else a?t.if(h,u("then")):t.if((0,i.not)(h),u("else"));function u(n,s){return()=>{const r=e.subschema({keyword:n},h);t.assign(c,h),e.mergeValidEvaluated(r,c),s?t.assign(s,i._`${n}`):e.setParams({ifClause:n})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,s.alwaysValidSchema)(e,n)}t.default=r},3698:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1600),s=n(3609),r=n(8223),o=n(2490),a=n(7458),l=n(2790),c=n(3796),h=n(8183),u=n(1935),d=n(8289),p=n(2514),m=n(120),f=n(6328),g=n(8302),v=n(7498),y=n(6105);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,v.default,y.default,c.default,h.default,l.default,u.default,d.default];return e?t.push(s.default,o.default):t.push(i.default,r.default),t.push(a.default),t}},8223:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const i=n(6110),s=n(530),r=n(7111),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,s.alwaysValidSchema)(n,t)||e.ok((0,r.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:r,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:i,errSchemaPath:r}=c,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(i.strictTuples&&!a){const e=`"${l}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${r}"`;(0,s.checkStrictMode)(c,e,i.strictTuples)}}(o),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=s.mergeEvaluated.items(r,n.length,c.items));const h=r.name("valid"),u=r.const("len",i._`${a}.length`);n.forEach(((t,n)=>{(0,s.alwaysValidSchema)(c,t)||(r.if(i._`${u} > ${n}`,(()=>e.subschema({keyword:l,schemaProp:n,dataProp:n},h))),e.ok(h))}))}t.validateTuple=a,t.default=o},2490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(7111),o=n(1600),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:i}=e,{prefixItems:a}=n;i.items=!0,(0,s.alwaysValidSchema)(i,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,r.validateArray)(e)))}};t.default=a},2514:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(530),s={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:s}=e;if((0,i.alwaysValidSchema)(s,n))return void e.fail();const r=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),e.failResult(r,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=s},6328:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>i._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const a=n,l=t.let("valid",!1),c=t.let("passing",null),h=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((n,r)=>{let a;(0,s.alwaysValidSchema)(o,n)?t.var(h,!0):a=e.subschema({keyword:"oneOf",schemaProp:r,compositeRule:!0},h),r>0&&t.if(i._`${h} && ${l}`).assign(l,!1).assign(c,i._`[${c}, ${r}]`).else(),t.if(h,(()=>{t.assign(l,!0),t.assign(c,r),a&&e.mergeEvaluated(a,i.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=r},8289:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r=n(530),o=n(530),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:l,it:c}=e,{opts:h}=c,u=(0,i.allSchemaProperties)(n),d=u.filter((e=>(0,r.alwaysValidSchema)(c,n[e])));if(0===u.length||d.length===u.length&&(!c.opts.unevaluated||!0===c.props))return;const p=h.strictSchema&&!h.allowMatchingProperties&&l.properties,m=t.name("valid");!0===c.props||c.props instanceof s.Name||(c.props=(0,o.evaluatedPropsToName)(t,c.props));const{props:f}=c;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(n){t.forIn("key",a,(r=>{t.if(s._`${(0,i.usePattern)(e,n)}.test(${r})`,(()=>{const i=d.includes(n);i||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:r,dataPropType:o.Type.Str},m),c.opts.unevaluated&&!0!==f?t.assign(s._`${f}[${r}]`,!0):i||c.allErrors||t.if((0,s.not)(m),(()=>t.break()))}))}))}!function(){for(const e of u)p&&g(e),c.allErrors?v(e):(t.var(m,!0),v(e),t.if(m))}()}};t.default=a},3609:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8223),s={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,i.validateTuple)(e,"items")};t.default=s},1935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3750),s=n(7111),r=n(530),o=n(8183),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new i.KeywordCxt(c,o.default,"additionalProperties"));const h=(0,s.allSchemaProperties)(n);for(const e of h)c.definedProperties.add(e);c.opts.unevaluated&&h.length&&!0!==c.props&&(c.props=r.mergeEvaluated.props(t,(0,r.toHash)(h),c.props));const u=h.filter((e=>!(0,r.alwaysValidSchema)(c,n[e])));if(0===u.length)return;const d=t.name("valid");for(const n of u)p(n)?m(n):(t.if((0,s.propertyInData)(t,l,n,c.opts.ownProperties)),m(n),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(d);function p(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},3796:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>i._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,s.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",r,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,i.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=r},6105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(530),s={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,i.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=s},7111:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const i=n(6110),s=n(530),r=n(7748);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:i._`Object.prototype.hasOwnProperty`})}function a(e,t,n){return i._`${o(e)}.call(${t}, ${n})`}function l(e,t,n,s){const r=i._`${t}${(0,i.getProperty)(n)} === undefined`;return s?(0,i.or)(r,(0,i.not)(a(e,t,n))):r}function c(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:s,it:r}=e;n.if(l(n,s,t,r.opts.ownProperties),(()=>{e.setParams({missingProperty:i._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},s,r){return(0,i.or)(...s.map((s=>(0,i.and)(l(e,t,s,n.ownProperties),i._`${r} = ${s}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=a,t.propertyInData=function(e,t,n,s){const r=i._`${t}${(0,i.getProperty)(n)} !== undefined`;return s?i._`${r} && ${a(e,t,n)}`:r},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(e,t){return c(t).filter((n=>!(0,s.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:s,schemaPath:o,errorPath:a},it:l},c,h,u){const d=u?i._`${e}, ${t}, ${s}${o}`:t,p=[[r.default.instancePath,(0,i.strConcat)(r.default.instancePath,a)],[r.default.parentData,l.parentData],[r.default.parentDataProperty,l.parentDataProperty],[r.default.rootData,r.default.rootData]];l.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const m=i._`${d}, ${n.object(...p)}`;return h!==i.nil?i._`${c}.call(${h}, ${m})`:i._`${c}(${m})`},t.usePattern=function({gen:e,it:{opts:t}},n){const s=t.unicodeRegExp?"u":"";return e.scopeValue("pattern",{key:n,ref:new RegExp(n,s),code:i._`new RegExp(${n}, ${s})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:r,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return l((()=>t.assign(e,!1))),e}return t.var(a,!0),l((()=>t.break())),a;function l(o){const l=t.const("len",i._`${n}.length`);t.forRange("i",0,l,(n=>{e.subschema({keyword:r,dataProp:n,dataPropType:s.Type.Num},a),t.if((0,i.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,s.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>n.forEach(((n,s)=>{const o=e.subschema({keyword:r,schemaProp:s,compositeRule:!0},l);t.assign(a,i._`${a} || ${l}`);e.mergeValidEvaluated(o,l)||t.if((0,i.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},4874:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},9730:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4874),s=n(5403),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",i.default,s.default];t.default=r},5403:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const i=n(3482),s=n(7111),r=n(6110),o=n(7748),a=n(9336),l=n(530),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:s}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:p}=s,{root:m}=l;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(l===m)return u(e,c,l,l.$async);const n=t.scopeValue("root",{ref:m});return u(e,r._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new i.default(o,n);return f instanceof a.SchemaEnv?function(t){const n=h(e,t);u(e,n,t,t.$async)}(f):function(i){const s=t.scopeValue("schema",!0===d.code.source?{ref:i,code:(0,r.stringify)(i)}:{ref:i}),o=t.name("valid"),a=e.subschema({schema:i,dataTypes:[],schemaPath:r.nil,topSchemaRef:s,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function h(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function u(e,t,n,i){const{gen:a,it:c}=e,{allErrors:h,schemaEnv:u,opts:d}=c,p=d.passContext?o.default.this:r.nil;function m(e){const t=r._`${e}.errors`;a.assign(o.default.vErrors,r._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,r._`${o.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;const i=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(i&&!i.dynamicProps)void 0!==i.props&&(c.props=l.mergeEvaluated.props(a,i.props,c.props));else{const t=a.var("props",r._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,r.Name)}if(!0!==c.items)if(i&&!i.dynamicItems)void 0!==i.items&&(c.items=l.mergeEvaluated.items(a,i.items,c.items));else{const t=a.var("items",r._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,r.Name)}}i?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(r._`await ${(0,s.callValidateCode)(e,t,p)}`),f(t),h||a.assign(n,!0)}),(e=>{a.if(r._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),m(e),h||a.assign(n,!1)})),e.ok(n)}():e.result((0,s.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=h,t.callRef=u,t.default=c},3348:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(2997),r={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===s.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>i._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:a}=e,{oneOf:l}=o;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");const c=r.propertyName;if("string"!=typeof c)throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const h=t.let("valid",!1),u=t.const("tag",i._`${n}${(0,i.getProperty)(c)}`);function d(n){const s=t.name("valid"),r=e.subschema({keyword:"oneOf",schemaProp:n},s);return e.mergeEvaluated(r,i.Name),s}t.if(i._`typeof ${u} == "string"`,(()=>function(){const n=function(){var e;const t={},n=s(o);let i=!0;for(let t=0;te.error(!1,{discrError:s.DiscrError.Tag,tag:u,tagName:c}))),e.ok(h)}};t.default=r},2997:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(t.DiscrError||(t.DiscrError={}))},610:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9730),s=n(6020),r=n(3698),o=n(5036),a=n(9275),l=[i.default,s.default,(0,r.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},8997:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match format "${e}"`,params:({schemaCode:e})=>i._`{format: ${e}}`},code(e,t){const{gen:n,data:s,$data:r,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:h,schemaEnv:u,self:d}=l;c.validateFormats&&(r?function(){const r=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=n.const("fDef",i._`${r}[${a}]`),l=n.let("fType"),h=n.let("format");n.if(i._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(l,i._`${o}.type || "string"`).assign(h,i._`${o}.validate`)),(()=>n.assign(l,i._`"string"`).assign(h,o))),e.fail$data((0,i.or)(!1===c.strictSchema?i.nil:i._`${a} && !${h}`,function(){const e=u.$async?i._`(${o}.async ? await ${h}(${s}) : ${h}(${s}))`:i._`${h}(${s})`,n=i._`(typeof ${h} == "function" ? ${e} : ${h}.test(${s}))`;return i._`${h} && ${h} !== true && ${l} === ${t} && !${n}`}()))}():function(){const r=d.formats[o];if(!r)return void function(){if(!1===c.strictSchema)return void d.logger.warn(e());throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${h}"`}}();if(!0===r)return;const[a,l,p]=function(e){const t=e instanceof RegExp?(0,i.regexpCode)(e):c.code.formats?i._`${c.code.formats}${(0,i.getProperty)(o)}`:void 0,s=n.scopeValue("formats",{key:o,ref:e,code:t});if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,i._`${s}.validate`];return["string",e,s]}(r);a===t&&e.pass(function(){if("object"==typeof r&&!(r instanceof RegExp)&&r.async){if(!u.$async)throw new Error("async format in sync schema");return i._`await ${p}(${s})`}return"function"==typeof l?i._`${p}(${s})`:i._`${p}.test(${s})`}())}())}};t.default=s},5036:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=[n(8997).default];t.default=i},9275:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},3103:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(8062),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>i._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(i._`!${(0,s.useFunc)(t,r.default)}(${n}, ${a})`):e.fail(i._`${l} !== ${n}`)}};t.default=o},3139:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(8062),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>i._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const h=a.length>=c.opts.loopEnum,u=(0,s.useFunc)(t,r.default);let d;if(h||o)d=t.let("valid"),e.block$data(d,(function(){t.assign(d,!1),t.forOf("v",l,(e=>t.if(i._`${u}(${n}, ${e})`,(()=>t.assign(d,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);d=(0,i.or)(...a.map(((t,s)=>function(e,t){const s=a[t];return"object"==typeof s&&null!==s?i._`${u}(${n}, ${e}[${t}])`:i._`${n} === ${s}`}(e,s))))}e.pass(d)}};t.default=o},6020:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(897),s=n(5162),r=n(4905),o=n(2508),a=n(82),l=n(6846),c=n(7569),h=n(5640),u=n(3103),d=n(3139),p=[i.default,s.default,r.default,o.default,a.default,l.default,c.default,h.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];t.default=p},7569:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:s}=e,r="maxItems"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`${n}.length ${r} ${s}`)}};t.default=s},4905:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(5842),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,l="maxLength"===t?i.operators.GT:i.operators.LT,c=!1===a.opts.unicode?i._`${n}.length`:i._`${(0,s.useFunc)(e.gen,r.default)}(${n})`;e.fail$data(i._`${c} ${l} ${o}`)}};t.default=o},897:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=i.operators,r={maximum:{okStr:"<=",ok:s.LTE,fail:s.GT},minimum:{okStr:">=",ok:s.GTE,fail:s.LT},exclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},exclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}},o={message:({keyword:e,schemaCode:t})=>i.str`must be ${r[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{comparison: ${r[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:n,schemaCode:s}=e;e.fail$data(i._`${n} ${r[t].fail} ${s} || isNaN(${n})`)}};t.default=a},82:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:s}=e,r="maxProperties"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`Object.keys(${n}).length ${r} ${s}`)}};t.default=s},5162:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>i.str`must be multiple of ${e}`,params:({schemaCode:e})=>i._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:s,it:r}=e,o=r.opts.multipleOfPrecision,a=t.let("res"),l=o?i._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:i._`${a} !== parseInt(${a})`;e.fail$data(i._`(${s} === 0 || (${a} = ${n}/${s}, ${l}))`)}};t.default=s},2508:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>s.str`must match pattern "${e}"`,params:({schemaCode:e})=>s._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:r,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?s._`(new RegExp(${o}, ${l}))`:(0,i.usePattern)(e,r);e.fail$data(s._`!${c}.test(${t})`)}};t.default=r},6846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r=n(530),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>s.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>s._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:l,it:c}=e,{opts:h}=c;if(!l&&0===n.length)return;const u=n.length>=h.loopRequired;if(c.allErrors?function(){if(u||l)e.block$data(s.nil,d);else for(const t of n)(0,i.checkReportMissingProp)(e,t)}():function(){const r=t.let("missing");if(u||l){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,r){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(r,(0,i.propertyInData)(t,a,n,h.ownProperties)),t.if((0,s.not)(r),(()=>{e.error(),t.break()}))}),s.nil)}(r,n))),e.ok(n)}else t.if((0,i.checkMissingProp)(e,n,r)),(0,i.reportMissingProp)(e,r),t.else()}(),h.strictRequired){const t=e.parentSchema.properties,{definedProperties:i}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!i.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(c,t,c.opts.strictRequired)}}function d(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,i.noPropertyInData)(t,a,n,h.ownProperties),(()=>e.error()))}))}}};t.default=o},5640:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7349),s=n(6110),r=n(530),o=n(8062),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>s.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>s._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:l,parentSchema:c,schemaCode:h,it:u}=e;if(!a&&!l)return;const d=t.let("valid"),p=c.items?(0,i.getSchemaTypes)(c.items):[];function m(r,o){const a=t.name("item"),l=(0,i.checkDataTypes)(p,a,u.opts.strictNumbers,i.DataType.Wrong),c=t.const("indices",s._`{}`);t.for(s._`;${r}--;`,(()=>{t.let(a,s._`${n}[${r}]`),t.if(l,s._`continue`),p.length>1&&t.if(s._`typeof ${a} == "string"`,s._`${a} += "_"`),t.if(s._`typeof ${c}[${a}] == "number"`,(()=>{t.assign(o,s._`${c}[${a}]`),e.error(),t.assign(d,!1).break()})).code(s._`${c}[${a}] = ${r}`)}))}function f(i,a){const l=(0,r.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(s._`;${i}--;`,(()=>t.for(s._`${a} = ${i}; ${a}--;`,(()=>t.if(s._`${l}(${n}[${i}], ${n}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const i=t.let("i",s._`${n}.length`),r=t.let("j");e.setParams({i,j:r}),t.assign(d,!0),t.if(s._`${i} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(i,r)))}),s._`${h} === false`),e.ok(d)}};t.default=a},9981:e=>{var t=Object.prototype.toString;e.exports=function(e){return e.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===t.call(e.buffer)||Array.isArray(e)}},1512:e=>{e.exports=function(e,t){return"number"==typeof e?e:"number"==typeof t?t:0}},984:e=>{e.exports=function(e){switch(e){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},8926:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,s,r;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(s=i;0!=s--;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(r=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(s=i;0!=s--;)if(!Object.prototype.hasOwnProperty.call(n,r[s]))return!1;for(s=i;0!=s--;){var o=r[s];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9105:e=>{"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},6186:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},8125:e=>{"use strict";var t=e.exports=function(e,t,i){"function"==typeof t&&(i=t,t={}),n(t,"function"==typeof(i=t.cb||i)?i:i.pre||function(){},i.post||function(){},e,"",e)};function n(e,i,s,r,o,a,l,c,h,u){if(r&&"object"==typeof r&&!Array.isArray(r)){for(var d in i(r,o,a,l,c,h,u),r){var p=r[d];if(Array.isArray(p)){if(d in t.arrayKeywords)for(var m=0;m{var i=n(1516),s=n(139),r=n(1512),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function u(e){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(e)}function d(e){return new Function(["return function "+e+"() {"," return this._"+e,"}"].join("\n"))()}function p(e,t){if(!e.chars||0===e.chars.length)return null;var n=f(e.chars,t);return n>=0?e.chars[n]:null}function m(e,t,n){if(!e.kernings||0===e.kernings.length)return 0;for(var i=e.kernings,s=0;s=0)return e.chars[i].height}return 0}(a),this._capHeight=function(e){for(var t=0;t=0)return e.chars[i].height}return 0}(a),this._lineHeight=g,this._ascender=g-y-this._xHeight;var w=this;c.forEach((function(e,i){for(var s,r=e.start,o=e.end,l=e.width,c=r;c=0)return e.chars[i]}return 0}(e)||e.chars[0],n=this._opt.tabSize*t.xadvance;this._fallbackSpaceGlyph=t,this._fallbackTabGlyph=s(t,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(e,t){var n=p(e,t);return n||(t===c?this._fallbackTabGlyph:t===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(e,t,n,i){var s,r=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:t,end:t,width:0};n=Math.min(e.length,n);for(var h=t;h=i||p>=i)break;a=p,l=f,s=u}c++}return s&&(l+=s.xoffset),{start:t,end:t+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(e){Object.defineProperty(u.prototype,e,{get:d(e),configurable:!0})}))},4439:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,r){for(var o,a,l=s(e),c=1;c{var i=n(984),s=n(9981),r=n(6186),o=[0,2,3],a=[2,1,3];e.exports=function(e,t){e&&(s(e)||r(e))||(t=e||{},e=null);for(var n="string"==typeof(t="number"==typeof t?{count:t}:t||{}).type?t.type:"uint16",l="number"==typeof t.count?t.count:1,c=t.start||0,h=!1!==t.clockwise?o:a,u=h[0],d=h[1],p=h[2],m=6*l,f=e||new(i(n))(m),g=0,v=0;g{var t={min:[0,0],max:[0,0]};function n(e){var n=e.length/2;t.min[0]=e[0],t.min[1]=e[1],t.max[0]=e[0],t.max[1]=e[1];for(var i=0;i{e.exports.pages=function(e){var t=new Float32Array(4*e.length*1),n=0;return e.forEach((function(e){var i=e.data.page||0;t[n++]=i,t[n++]=i,t[n++]=i,t[n++]=i})),t},e.exports.uvs=function(e,t,n,i){var s=new Float32Array(4*e.length*2),r=0;return e.forEach((function(e){var o=e.data,a=o.x+o.width,l=o.y+o.height,c=o.x/t,h=o.y/n,u=a/t,d=l/n;i&&(h=(n-o.y)/n,d=(n-l)/n),s[r++]=c,s[r++]=h,s[r++]=c,s[r++]=d,s[r++]=u,s[r++]=d,s[r++]=u,s[r++]=h})),s},e.exports.positions=function(e){var t=new Float32Array(4*e.length*2),n=0;return e.forEach((function(e){var i=e.data,s=e.position[0]+i.xoffset,r=e.position[1]+i.yoffset,o=i.width,a=i.height;t[n++]=s,t[n++]=r,t[n++]=s,t[n++]=r+a,t[n++]=s+o,t[n++]=r+a,t[n++]=s+o,t[n++]=r})),t}},5858:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),n=0;n1){t[0]=t[0].slice(0,-1);for(var i=t.length-1,s=1;s= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=p-m,T=Math.floor,C=String.fromCharCode;function A(e){throw new RangeError(M[e])}function P(e,t){for(var n=[],i=e.length;i--;)n[i]=t(e[i]);return n}function R(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+P((e=e.replace(S,".")).split("."),t).join(".")}function L(e){for(var t=[],n=0,i=e.length;n=55296&&s<=56319&&n>1,e+=T(e/t);e>E*f>>1;i+=p)e=T(e/E);return T(i+(E+1)*e/(e+g))},I=function(e){var t=[],n=e.length,i=0,s=b,r=y,o=e.lastIndexOf(x);o<0&&(o=0);for(var a=0;a=128&&A("not-basic"),t.push(e.charCodeAt(a));for(var l=o>0?o+1:0;l=n&&A("invalid-input");var g=N(e.charCodeAt(l++));(g>=p||g>T((d-i)/h))&&A("overflow"),i+=g*h;var v=u<=r?m:u>=r+f?f:u-r;if(gT(d/_)&&A("overflow"),h*=_}var w=t.length+1;r=O(i-c,w,0==c),T(i/w)>d-s&&A("overflow"),s+=T(i/w),i%=w,t.splice(i++,0,s)}return String.fromCodePoint.apply(String,t)},k=function(e){var t=[],n=(e=L(e)).length,i=b,s=0,r=y,o=!0,a=!1,l=void 0;try{for(var c,h=e[Symbol.iterator]();!(o=(c=h.next()).done);o=!0){var u=c.value;u<128&&t.push(C(u))}}catch(e){a=!0,l=e}finally{try{!o&&h.return&&h.return()}finally{if(a)throw l}}var g=t.length,v=g;for(g&&t.push(x);v=i&&R<_&&(_=R)}}catch(e){S=!0,M=e}finally{try{!w&&P.return&&P.return()}finally{if(S)throw M}}var N=v+1;_-i>T((d-s)/N)&&A("overflow"),s+=(_-i)*N,i=_;var I=!0,k=!1,z=void 0;try{for(var U,V=e[Symbol.iterator]();!(I=(U=V.next()).done);I=!0){var F=U.value;if(Fd&&A("overflow"),F==i){for(var B=s,j=p;;j+=p){var $=j<=r?m:j>=r+f?f:j-r;if(B<$)break;var H=B-$,G=p-$;t.push(C(D($+H%G,0))),B=T(H/G)}t.push(C(D(B,0))),r=O(s,N,v==g),s=0,++v}}}catch(e){k=!0,z=e}finally{try{!I&&V.return&&V.return()}finally{if(k)throw z}}++s,++i}return t.join("")},z=function(e){return R(e,(function(e){return _.test(e)?I(e.slice(4).toLowerCase()):e}))},U=function(e){return R(e,(function(e){return w.test(e)?"xn--"+k(e):e}))},V={version:"2.1.0",ucs2:{decode:L,encode:function(e){return String.fromCodePoint.apply(String,u(e))}},decode:I,encode:k,toASCII:U,toUnicode:z},F={};function B(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function j(e){for(var t="",n=0,i=e.length;n=194&&s<224){if(i-n>=6){var r=parseInt(e.substr(n+4,2),16);t+=String.fromCharCode((31&s)<<6|63&r)}else t+=e.substr(n,6);n+=6}else if(s>=224){if(i-n>=9){var o=parseInt(e.substr(n+4,2),16),a=parseInt(e.substr(n+7,2),16);t+=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a)}else t+=e.substr(n,9);n+=9}else t+=e.substr(n,3),n+=3}return t}function $(e,t){function n(e){var n=j(e);return n.match(t.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,n).replace(t.NOT_USERINFO,B).replace(t.PCT_ENCODED,s)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_HOST,B).replace(t.PCT_ENCODED,s)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,n).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,B).replace(t.PCT_ENCODED,s)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,n).replace(t.NOT_QUERY,B).replace(t.PCT_ENCODED,s)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,n).replace(t.NOT_FRAGMENT,B).replace(t.PCT_ENCODED,s)),e}function H(e){return e.replace(/^0*(.*)/,"$1")||"0"}function G(e,t){var n=e.match(t.IPV4ADDRESS)||[],i=h(n,2)[1];return i?i.split(".").map(H).join("."):e}function W(e,t){var n=e.match(t.IPV6ADDRESS)||[],i=h(n,3),s=i[1],r=i[2];if(s){for(var o=s.toLowerCase().split("::").reverse(),a=h(o,2),l=a[0],c=a[1],u=c?c.split(":").map(H):[],d=l.split(":").map(H),p=t.IPV4ADDRESS.test(d[d.length-1]),m=p?7:8,f=d.length-m,g=Array(m),v=0;v1){var x=g.slice(0,y.index),_=g.slice(y.index+y.length);b=x.join(":")+"::"+_.join(":")}else b=g.join(":");return r&&(b+="%"+r),b}return e}var q=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,X=void 0==="".match(/(){0}/)[1];function Y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},i=!1!==t.iri?c:l;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var s=e.match(q);if(s){X?(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5])):(n.scheme=s[1]||void 0,n.userinfo=-1!==e.indexOf("@")?s[3]:void 0,n.host=-1!==e.indexOf("//")?s[4]:void 0,n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=-1!==e.indexOf("?")?s[7]:void 0,n.fragment=-1!==e.indexOf("#")?s[8]:void 0,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?s[4]:void 0)),n.host&&(n.host=W(G(n.host,i),i)),void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||n.path||void 0!==n.query?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==n.reference&&(n.error=n.error||"URI is not a "+t.reference+" reference.");var r=F[(t.scheme||n.scheme||"").toLowerCase()];if(t.unicodeSupport||r&&r.unicodeSupport)$(n,i);else{if(n.host&&(t.domainHost||r&&r.domainHost))try{n.host=V.toASCII(n.host.replace(i.PCT_ENCODED,j).toLowerCase())}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+e}$(n,l)}r&&r.parse&&r.parse(n,t)}else n.error=n.error||"URI can not be parsed.";return n}function K(e,t){var n=!1!==t.iri?c:l,i=[];return void 0!==e.userinfo&&(i.push(e.userinfo),i.push("@")),void 0!==e.host&&i.push(W(G(String(e.host),n),n).replace(n.IPV6ADDRESS,(function(e,t,n){return"["+t+(n?"%25"+n:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(i.push(":"),i.push(String(e.port))),i.length?i.join(""):void 0}var J=/^\.\.?\//,Z=/^\/\.(\/|$)/,Q=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(J))e=e.replace(J,"");else if(e.match(Z))e=e.replace(Z,"/");else if(e.match(Q))e=e.replace(Q,"/"),t.pop();else if("."===e||".."===e)e="";else{var n=e.match(ee);if(!n)throw new Error("Unexpected dot segment condition");var i=n[0];e=e.slice(i.length),t.push(i)}return t.join("")}function ne(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.iri?c:l,i=[],s=F[(t.scheme||e.scheme||"").toLowerCase()];if(s&&s.serialize&&s.serialize(e,t),e.host)if(n.IPV6ADDRESS.test(e.host));else if(t.domainHost||s&&s.domainHost)try{e.host=t.iri?V.toUnicode(e.host):V.toASCII(e.host.replace(n.PCT_ENCODED,j).toLowerCase())}catch(n){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+n}$(e,n),"suffix"!==t.reference&&e.scheme&&(i.push(e.scheme),i.push(":"));var r=K(e,t);if(void 0!==r&&("suffix"!==t.reference&&i.push("//"),i.push(r),e.path&&"/"!==e.path.charAt(0)&&i.push("/")),void 0!==e.path){var o=e.path;t.absolutePath||s&&s.absolutePath||(o=te(o)),void 0===r&&(o=o.replace(/^\/\//,"/%2F")),i.push(o)}return void 0!==e.query&&(i.push("?"),i.push(e.query)),void 0!==e.fragment&&(i.push("#"),i.push(e.fragment)),i.join("")}function ie(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(e=Y(ne(e,n),n),t=Y(ne(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=te(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function se(e,t,n){var i=o({scheme:"null"},n);return ne(ie(Y(e,i),Y(t,i),i,!0),i)}function re(e,t){return"string"==typeof e?e=ne(Y(e,t),t):"object"===i(e)&&(e=Y(ne(e,t),t)),e}function oe(e,t,n){return"string"==typeof e?e=ne(Y(e,n),n):"object"===i(e)&&(e=ne(e,n)),"string"==typeof t?t=ne(Y(t,n),n):"object"===i(t)&&(t=ne(t,n)),e===t}function ae(e,t){return e&&e.toString().replace(t&&t.iri?c.ESCAPE:l.ESCAPE,B)}function le(e,t){return e&&e.toString().replace(t&&t.iri?c.PCT_ENCODED:l.PCT_ENCODED,j)}var ce={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var n="https"===String(e.scheme).toLowerCase();return e.port!==(n?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},he={scheme:"https",domainHost:ce.domainHost,parse:ce.parse,serialize:ce.serialize};function ue(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var de={scheme:"ws",domainHost:!0,parse:function(e,t){var n=e;return n.secure=ue(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=void 0,n.query=void 0,n},serialize:function(e,t){if(e.port!==(ue(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var n=e.resourceName.split("?"),i=h(n,2),s=i[0],r=i[1];e.path=s&&"/"!==s?s:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},pe={scheme:"wss",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize},me={},fe="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ge="[0-9A-Fa-f]",ve=n(n("%[EFef]"+ge+"%"+ge+ge+"%"+ge+ge)+"|"+n("%[89A-Fa-f]"+ge+"%"+ge+ge)+"|"+n("%"+ge+ge)),ye="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),xe="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",_e=new RegExp(fe,"g"),we=new RegExp(ve,"g"),Se=new RegExp(t("[^]",ye,"[\\.]",'[\\"]',be),"g"),Me=new RegExp(t("[^]",fe,xe),"g"),Ee=Me;function Te(e){var t=j(e);return t.match(_e)?t:e}var Ce={scheme:"mailto",parse:function(e,t){var n=e,i=n.to=n.path?n.path.split(","):[];if(n.path=void 0,n.query){for(var s=!1,r={},o=n.query.split("&"),a=0,l=o.length;a{var t=/\n/,n="\n",i=/\s/;function s(e,t,n,i){var s=e.indexOf(t,n);return-1===s||s>i?i:s}function r(e){return i.test(e)}function o(e,t,n,i){return{start:t,end:t+Math.min(i,n-t)}}e.exports=function(t,n){return e.exports.lines(t,n).map((function(e){return t.substring(e.start,e.end)})).join("\n")},e.exports.lines=function(e,i){if(0===(i=i||{}).width&&"nowrap"!==i.mode)return[];e=e||"";var a="number"==typeof i.width?i.width:Number.MAX_VALUE,l=Math.max(0,i.start||0),c="number"==typeof i.end?i.end:e.length,h=i.mode,u=i.measure||o;return"pre"===h?function(e,n,i,s,r){for(var o=[],a=i,l=i;li&&!r(t.charAt(p));)p--;if(p===i)m>i+n.length&&m--,p=m;else for(m=p;p>i&&r(t.charAt(p-n.length));)p--}if(p>=i){var f=e(t,i,p,h);c.push(f)}i=m}return c}(u,e,l,c,a,h)}},139:e=>{e.exports=function(){for(var e={},n=0;n{"use strict";n.d(t,{Z:()=>db});var i={};n.r(i),n.d(i,{ArcCurve:()=>gi,CatmullRomCurve3:()=>wi,CubicBezierCurve:()=>Ti,CubicBezierCurve3:()=>Ci,EllipseCurve:()=>fi,LineCurve:()=>Ai,LineCurve3:()=>Pi,QuadraticBezierCurve:()=>Ri,QuadraticBezierCurve3:()=>Li,SplineCurve:()=>Ni});const s=Symbol("Publisher private data"),r=Symbol("Publisher strict option");class o{constructor(e){const t=!e||e.knownEvents;this[s]={[r]:t}}on(e,t,n){if(Array.isArray(e))return void e.forEach((e=>{this.on(e,t,n)}));if(!t)throw new Error("missing callback function");let i=this[s][e];if(!i){if(this[s][r])throw new Error(`can't subscribe; unknown event: '${e}'`);i=this[s][e]=[]}let o={callback:t,context:n};i.push(o)}addEventListener(e,t,n){this.on(e,t,n)}once(e,t,n){if(Array.isArray(e))return void e.forEach((e=>{this.once(e,t,n)}));const i=s=>{this.off(e,i,n),t.call(n,s)};i.cb=t,this.on(e,i,n)}off(e,t,n){if("object"==typeof e){if(Array.isArray(e))e.forEach((e=>{this.off(e,t,n)}));else{const t=this[s];for(let n=0,i=Object.keys(t).length;n{this[s][e]||(this[s][e]=[])}))}hasEvent(e){return!!this[s][e]}listEvents(){return Object.getOwnPropertyNames(this[s])}}const a=[function(e){return e},function(e,t){for(let n=0,i=t.length;n=0)throw new Error("non-array source property; can't link to element");if(1===t.elementCount&&i>=0)throw new Error("non-array destination property; can't link to element");this.source=e,this.destination=t,this.sourceIndex=n,this.destinationIndex=i;const s=void 0===n?-1:n,r=void 0===i?-1:i,o=e.elementCount>1&&s<0&&r<0;this.fnConvert=function(e,t,n){const i=n?1:0;return u[e][t][i]}(e.type,t.type,o);const a=function(e,t,n){return-1===e&&-1===t?n:e<=3&&t<=3?p[e+1][t+1]:function(n,i,s){return i[t]=s(n[e]),i}}(s,r,this.fnConvert);var l,c,h;this.fnCopy=(l=e.isMulti(),c=t.isMulti(),h=a,!1===l?!1===c?h:function(e,t,n){for(let n=0,i=t.length;n0&&(t=h(e[0],t)),t}:function(e,t,n){for(let n=0,i=e.length,s=t.length;nv(y.Number,e,t),x=(e,t)=>v(y.Integer,e,t),_=(e,t)=>v(y.Percent,e,t),w=(e,t)=>v(y.Vector3,e,t),S=(e,t)=>v(y.Matrix4,e,t),M=(e,t)=>v(y.Scale,e,t),E=(e,t)=>v(y.Scale3,e,t),T=(e,t)=>v(y.ColorRGB,e,t),C=(e,t)=>v(y.Boolean,e,t),A=(e,t)=>v(y.String,e,t),P=(e,t)=>v(y.AssetPath,e,t),R=(e,t,n)=>function(e,t,n){n=g(n);const i={enum:e,options:(s=e,Object.keys(s).filter((e=>isNaN(Number(e))))),preset:0};var s;return{path:t,schema:n?Object.assign({},i,n):i}}(t,e,n),L=(e,t,n)=>function(e,t,n){const i={options:e,preset:0};return{path:t,schema:(n=g(n))?Object.assign({},i,n):i}}(t,e,n),N=(e,t,n)=>function(e,t,n){const i={preset:null,objectType:e};return{path:t,schema:(n=g(n))?Object.assign({},i,n):i}}(t,e,n),D=(e,t)=>v(y.Event,e,t);class O extends o{constructor(e,t,n){if(super(),this.addEvents("value","link","change","dispose"),!t||void 0===t.preset)throw new Error("missing schema/preset");const i=t.preset,s=Array.isArray(i);this.type=typeof(s?i[0]:i),this.schema=t,this.custom=n||!1,this.elementCount=s?i.length:1,this.inLinks=[],this.outLinks=[],this._group=null,this._key="",this._path=e,this.value=null,this.reset(),this.changed=!t.event}get group(){return this._group}get key(){return this._key}get path(){return this._path}set path(e){this._path=e,this.emit({type:"change",what:"path",property:this})}get name(){return this._path.split(".").pop()}dispose(){this.unlink(),this._group&&this._group.removeProperty(this),this.emit({type:"dispose",property:this})}setValue(e,t,n){this.value=e,t||(this.changed=!0,this.isInput()&&(this._group.linkable.changed=!0)),n||this.emit("value",e);const i=this.outLinks;for(let e=0,t=i.length;e=0&&this.setValue(i,t,n)}copyValue(e,t){Array.isArray(e)&&(e=e.slice()),this.setValue(e,t)}set(e){e||(this.changed=!0,this.isInput()&&(this._group.linkable.changed=!0)),this.emit("value",this.value);const t=this.outLinks;for(let e=0,n=t.length;ei.source===e&&i.sourceIndex===t&&i.destinationIndex===n));return!!i&&(e.removeOutLink(i),this.removeInLink(i),!0)}unlink(){this.inLinks.slice().forEach((e=>{e.source.removeOutLink(e),this.removeInLink(e)}));if(this.outLinks.slice().forEach((e=>{this.removeOutLink(e),e.destination.removeInLink(e)})),0!==this.inLinks.length||0!==this.outLinks.length)throw new Error("fatal: leftover links")}addInLink(e){if(e.destination!==this)throw new Error("input link's destination must equal this");this.inLinks.push(e),this.requestSort(),this.emit({type:"link",add:!0,remove:!1,link:e})}addOutLink(e){if(e.source!==this)throw new Error("output link's source must equal this");this.outLinks.push(e),this.requestSort(),e.push()}removeInLink(e){const t=this.inLinks.indexOf(e);if(t<0)throw new Error("input link not found");this.inLinks.splice(t,1),this.requestSort(),0===this.inLinks.length&&"object"===this.type&&this.reset(),this.emit({type:"link",add:!1,remove:!0,link:e})}removeOutLink(e){const t=this.outLinks.indexOf(e);if(t<0)throw new Error("output link not found");this.outLinks.splice(t,1),this.requestSort()}canLinkTo(e,t,n){return e.canLinkFrom(this,t,n)}canLinkFrom(e,t,n){if(this.isOutput())return!1;const i=t>=0,s=n>=0;if(!e.isArray()&&i)throw new Error("non-array source property; can't link to element");if(!this.isArray()&&s)throw new Error("non-array destination property; can't link to element");const r=e.isArray()&&!i;return r===(this.isArray()&&!s)&&((!r||e.elementCount===this.elementCount)&&(!("object"===e.type&&"object"===this.type&&!function(e,t){if(!e||!t)return!1;let n=e.prototype;for(;n;){if(n===t.prototype)return!0;n=n.prototype}return!1}(e.schema.objectType,this.schema.objectType))&&(o=e.type,a=this.type,d[o][a])));var o,a}reset(){let e;if(this.isMulti()){let t=this.value;t?t.length=1:e=t=[],t[0]=this.clonePreset()}else e=this.clonePreset();this.setValue(e)}setMultiChannelCount(e){if(!this.isMulti())throw new Error("can't set multi channel count on non-multi property");const t=this.value,n=t.length;t.length=e;for(let i=n;i=e.length?0:t]||""}}isInput(){return this._group&&this._group===this._group.linkable.ins}isOutput(){return this._group&&this._group===this._group.linkable.outs}isArray(){return Array.isArray(this.schema.preset)}isMulti(){return!!this.schema.multi}isDefault(){const e=this.schema.multi?this.value[0]:this.value,t=this.schema.preset,n=Array.isArray(e)?e.length:-1;if(n!==(Array.isArray(t)?t.length:-1))return!1;if(n>=0){for(let i=0;i0||this.outLinks.length>0}hasInLinks(e){const t=this.inLinks;if(!(e>=0))return t.length>0;for(let n=0,i=t.length;n=0))return!0;return!1}hasOutLinks(e){const t=this.outLinks;if(!(e>=0))return t.length>0;for(let n=0,i=t.length;n0&&(e=e||{},e.links=this.outLinks.map((e=>{const t={id:e.destination._group.linkable.id,key:e.destination.key};return e.sourceIndex>=0&&(t.srcIndex=e.sourceIndex),e.destinationIndex>=0&&(t.dstIndex=e.destinationIndex),t}))),e}fromJSON(e,t){void 0!==e.value&&(this.value=e.value),void 0!==e.links&&e.links.forEach((e=>{t[e.id].ins[e.key].linkFrom(this,e.srcIndex,e.dstIndex)}))}toString(){const e=this.schema,t=e.event?"event":e.options?"enum":this.type;return`${this.path} [${t}]`}dump(e=""){console.log(e+`Property '${this.path}', key: ${this.key}, value: ${this.value}`)}validateValue(e){const t=this.schema;if(t.enum){const n=Math.trunc(e);return t.enum[n]?n:0}if(t.options){const n=Math.trunc(e);return n<0||n>=t.options.length?0:n}return"number"===this.type?(e=t.min?Math.max(t.min,e):e,e=t.max?Math.min(t.max,e):e):e}clonePreset(){const e=this.schema.preset;return Array.isArray(e)?e.slice():e}}function I(e,t){let n;e&&"number"==typeof e||(e=12);do{n="";for(let t=0;te.custom))}dispose(){this.unlinkAllProperties()}isInputGroup(){return this===this.linkable.ins}isOutputGroup(){return this===this.linkable.outs}createProperties(e,t){return Object.keys(e).forEach(((n,i)=>{const s=void 0===t?void 0:t+i,r=e[n];this.createProperty(r.path,r.schema,n,s)})),this}createProperty(e,t,n,i){const s=new O(e,t);return this.addProperty(s,n,i),s}createCustomProperty(e,t,n){const i=new O(e,t,!0);return this.addCustomProperty(i,n),i}addCustomProperty(e,t){const n=I(5);this.addProperty(e,n,t)}addProperty(e,t,n){if(e.group)throw new Error("can't add, property already part of a group");if(this[t])throw new Error(`key '${t}' already exists in group`);e._group=this,e._key=t,void 0===n?this.properties.push(e):this.properties.splice(n,0,e),this[t]=e,this.emit({type:"property",add:!0,remove:!1,property:e})}removeProperty(e){if(e.group!==this)throw new Error("can't remove, property not in this group");if(e.hasLinks())throw new Error("can't remove, property has links");if(this[e.key]!==e)throw new Error(`property key '${e.key}' not found in group`);this.properties.slice(this.properties.indexOf(e),1),delete this[e.key],e._group=null,e._key="",this.emit({type:"property",add:!1,remove:!0,property:e})}getProperty(e){const t=this[e];if(!t)throw new Error(`no property found with key '${e}'`);return t}getKeys(e=!1){const t=[];return this.properties.forEach((n=>{(e||"object"!==n.type)&&t.push(n.key)})),t}getValues(e=!1){const t=[];return this.properties.map((n=>{(e||"object"!==n.type)&&t.push(n.value)})),t}cloneValues(e=!1){const t=[];return this.properties.map((n=>{(e||"object"!==n.type)&&t.push(n.cloneValue())})),t}setValues(e){Object.keys(e).forEach((t=>this.getProperty(t).value=e[t]))}copyValues(e){Object.keys(e).forEach((t=>this.getProperty(t).copyValue(e[t])))}unlinkAllProperties(){this.properties.forEach((e=>e.unlink()))}toJSON(){let e=null;return this.properties.forEach((t=>{const n=t.toJSON();n&&(e=e||{},e[t.key]=n)})),e}fromJSON(e){Object.keys(e).forEach((t=>{const n=e[t];if(n.schema){const e=new O(n.path,n.schema,!0);this.addProperty(e,t)}}))}linksFromJSON(e,t){Object.keys(e).forEach((n=>{this[n].fromJSON(e[n],t)}))}}class z{constructor(e,t,n,i){this.typeName=j.getTypeName(t),this.didAdd=n,this.willRemove=i,this._registry=e,e.on(this.typeName,this.onComponent,this),this.component=e.get(t,!0),this.component&&n&&n(this.component)}dispose(){this._registry.off(this.typeName,this.onComponent,this),this.component=null,this.didAdd=null,this.willRemove=null}onComponent(e){e.add?(this.component=e.object,this.didAdd&&this.didAdd(e.object)):e.remove&&(this.willRemove&&this.willRemove(e.object),this.component=null)}}class U{constructor(e,t){this._typeName=t?j.getTypeName(t):null,this._id=t instanceof j?t.id:void 0,this._system=e}get component(){return this._id&&this._system.components.getById(this._id)||null}set component(e){if(e&&this._typeName&&!(e instanceof this._system.registry.getType(this._typeName)))throw new Error(`can't assign component of class '${e.constructor.name||"unknown"}' to link of class '${this._typeName}'`);this._id=e?e.id:void 0}}const V=[];class F extends o{constructor(e){super({knownEvents:!1});const t=e.typeName;if(!t)throw new Error("root type must have a 'typeName' member");this._rootTypeName=t,this._objLists={[this._rootTypeName]:[]},this._objTags={},this._objDict={}}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e}add(e){const t=e.id;if("string"==typeof t){if(void 0!==this._objDict[t])throw new Error("object already registered");this._objDict[t]=e}let n,i=e;const s=this._rootTypeName,r={type:"",add:!0,remove:!1,object:e};do{i=Object.getPrototypeOf(i),n=i.constructor.typeName,n&&((this._objLists[n]||(this._objLists[n]=[])).push(e),r.type=n,this.emit(r))}while(n!==s)}remove(e){const t=e.id;if("string"==typeof t){if(this._objDict[t]!==e)throw new Error("object not registered");delete this._objDict[t]}let n,i=e;const s=this._rootTypeName,r={type:"",add:!1,remove:!0,object:e};do{if(i=Object.getPrototypeOf(i),n=i.constructor.typeName,n){r.type=n;const t=this._objLists[n];t.splice(t.indexOf(e),1),this.emit(r)}}while(n!==s)}addByTag(e,t){if(!e||"tag"===e)throw new Error("illegal tag name");(this._objTags[e]||(this._objTags[e]=[])).push(t);const n={type:"tag",add:!0,remove:!1,object:t,tag:e};this.emit(n),n.type=e,this.emit(n)}removeByTag(e,t){if(!e||"tag"===e)throw new Error("illegal tag name");const n=this._objTags[e];if(n){const i=n.indexOf(t);if(i>=0){const s={type:"tag",add:!1,remove:!0,object:t,tag:e};return this.emit(s),s.type=e,this.emit(s),n.splice(i,1),!0}}return!1}clear(){this.cloneArray().forEach((e=>this.remove(e)))}get length(){return this._objLists[this._rootTypeName].length}count(e){const t=this._objLists[this.getTypeName(e)];return t?t.length:0}has(e){if("function"==typeof e){const t=this._objLists[e.typeName];return!!t&&t.length>0}if("string"==typeof e){const t=this._objLists[e];return!!t&&t.length>0}const t=this._objLists[e.constructor.typeName];return t&&t.indexOf(e)>=0}contains(e){const t=e.id;if("string"==typeof t)return!!this._objDict[t];const n=this._objLists[e.constructor.typeName];return n&&n.indexOf(e)>=0}get(e,t=!1){const n=this.getTypeName(e),i=this._objLists[n],s=i?i[0]:void 0;if(!t&&!s)throw new Error(`no instances of class '${n}' in object registry`);return s}getArray(e){return this._objLists[this.getTypeName(e)]||V}cloneArray(e){return this.getArray(e).slice()}getById(e){return this._objDict[e]}getDictionary(){return this._objDict}getByTag(e){return this._objTags[e]||V}on(e,t,n){super.on(this.getTypeName(e),t,n)}once(e,t,n){super.once(this.getTypeName(e),t,n)}off(e,t,n){super.off(this.getTypeName(e),t,n)}getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||this._rootTypeName}}class B extends o{constructor(e,t){super({knownEvents:!1}),this.graph=null,this.components=new F(j),this._name="",this._tags=new Set,this._isLocked=void 0,this.graph=e,this.id=t}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||B.typeName}get typeName(){return this.constructor.typeName}get displayTypeName(){const e=this.typeName;return"Node"===e?e:e.substr(1)}get isLocked(){return this._isLocked}get text(){return this.constructor.text}get icon(){return this.constructor.icon}get name(){return this._name}get displayName(){return this._name||this.text||this.displayTypeName}set name(e){this._name=e,this.emit({type:"change",what:"name",node:this})}get tags(){return this._tags}addTag(e){this._tags.has(e)||(this._tags.add(e),this.graph._addNodeTag(e,this))}removeTag(e){this._tags.has(e)&&(this._tags.delete(e),this.graph._removeNodeTag(e,this))}get system(){return this.graph.system}getComponent(e,t=!1){return this.components.get(e,t)}getComponents(e){return this.components.getArray(e)}getComponentsByTag(e){return this.components.getByTag(e)}getOrCreateComponent(e){return this.components.get(e,!0)||this.createComponent(e)}hasComponent(e){return this.components.has(e)}getGraphComponent(e,t=!1){return this.graph.components.get(e,t)}getGraphComponents(e){return this.graph.components.getArray(e)}getGraphComponentsByTag(e){return this.graph.components.getByTag(e)}hasGraphComponent(e){return this.graph.components.has(e)}getMainComponent(e,t=!1){return this.graph.system.graph.components.get(e,t)}getMainComponents(e){return this.graph.system.graph.components.getArray(e)}getMainComponentsByTag(e){return this.graph.system.graph.components.getByTag(e)}hasMainComponent(e){return this.graph.system.graph.components.has(e)}getSystemComponent(e,t=!1){return this.graph.system.components.get(e,t)}getSystemComponents(e){return this.graph.system.components.getArray(e)}getSystemComponentsByTag(e){return this.graph.system.components.getByTag(e)}hasSystemComponent(e){return this.graph.system.components.has(e)}getComponentById(e){return this.graph.system.components.getById(e)}getNode(e,t=!1){return this.graph.nodes.get(e,t)}getNodes(e){return this.graph.nodes.getArray(e)}getNodesByTag(e){return this.graph.nodes.getByTag(e)}hasNode(e){return this.graph.nodes.has(e)}getMainNode(e,t=!1){return this.graph.system.graph.nodes.get(e,t)}getMainNodes(e){return this.graph.system.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.graph.system.graph.nodes.getByTag(e)}hasMainNode(e){return this.graph.system.graph.nodes.has(e)}getSystemNode(e,t=!1){return this.graph.system.nodes.get(e,t)}getSystemNodes(e){return this.graph.system.nodes.getArray(e)}getSystemNodesByTag(e){return this.graph.system.nodes.getByTag(e)}hasSystemNode(e){return this.graph.system.nodes.has(e)}getNodeById(e){return this.graph.system.nodes.getById(e)}lock(){if(!1===this._isLocked)throw new Error("can't lock an unlocked node again");this._isLocked=!0}unlock(){this._isLocked=!1}create(){this.graph._addNode(this)}createComponents(){}clear(){this.components.getArray().slice().forEach((e=>e.dispose()))}dispose(){this.components.cloneArray().reverse().forEach((e=>e.dispose())),this.emit({type:"dispose",node:this}),this.graph&&(this.graph._removeNode(this),this.graph=null)}createComponent(e,t,n){if(!0===this._isLocked)throw new Error("node is locked, can't create component");const i=this.system.registry.getType(e);if(!i)throw new Error(`component type '${j.getTypeName(e)}' not registered`);const s=new i(this,n||I(12,this.system.components.getDictionary()));return s.create(),t&&(s.name=t),s}is(e){const t=B.getTypeName(e);let n=this;do{if(n=Object.getPrototypeOf(n),n.constructor.typeName===t)return!0}while(n.constructor.typeName!==B.typeName);return!1}toString(e=!1){const t=this.components.getArray(),n=`Node '${this.name}' - ${t.length} components`;return e?n+"\n"+t.map((e=>" "+e.toString())).join("\n"):n}dump(e=""){console.log(e+`%cNode '${this.typeName}' (${this.displayName})`,"color: blue"),this.components.getArray().forEach((t=>t.dump(e+" ")))}toJSON(){const e={},t=[];this._isLocked&&(e.locked=!0);const n=this.components.getArray();for(let e=0,i=n.length;e0&&(e.components=t),e}fromJSON(e){this._isLocked=!!e.locked,e.components&&e.components.forEach((e=>this.componentFromJSON(e)))}componentFromJSON(e){this.createComponent(e.type,e.name,e.id).fromJSON(e)}referencesFromJSON(e){e.components&&e.components.forEach((e=>{this.components.getById(e.id).referencesFromJSON(e)}))}componentToJSON(e){return e.toJSON()}_addComponent(e){if(e.isNodeSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per node`);this.components.add(e),this.graph._addComponent(e)}_removeComponent(e){this.graph._removeComponent(e),this.components.remove(e)}_addComponentTag(e,t){this.components.addByTag(e,t),this.graph._addComponentTag(e,t)}_removeComponentTag(e,t){this.graph._removeComponentTag(e,t),this.components.removeByTag(e,t)}}B.typeName="Node",B.text="",B.icon="";class j extends o{constructor(e,t){super({knownEvents:!1}),this.ins=new k(this),this.outs=new k(this),this.changed=!0,this.updated=!1,this._name="",this._tags=new Set,this._trackers=[],this.node=e,this.id=t}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||j.typeName}create(){this.node._addComponent(this),this.graph.isActive&&this.activate&&this.activate()}dispose(){this.graph.isActive&&this.deactivate&&this.deactivate(),this.emit({type:"dispose",component:this}),this.ins.dispose(),this.outs.dispose(),this._trackers.forEach((e=>e.dispose())),this.node&&(this.node._removeComponent(this),this.node=null)}get isNodeSingleton(){return this.constructor.isNodeSingleton}get isGraphSingleton(){return this.constructor.isGraphSingleton}get isSystemSingleton(){return this.constructor.isSystemSingleton}get typeName(){return this.constructor.typeName}get displayTypeName(){const e=this.typeName;return"Component"===e?e:e.substr(1)}get text(){return this.constructor.text}get icon(){return this.constructor.icon}get name(){return this._name}get displayName(){return this._name||this.text||this.displayTypeName}set name(e){this._name=e,this.emit({type:"change",component:this,what:"name"})}get tags(){return this._tags}addTag(e){this._tags.has(e)||(this._tags.add(e),this.node._addComponentTag(e,this))}removeTag(e){this._tags.has(e)&&(this._tags.delete(e),this.node._removeComponentTag(e,this))}get graph(){return this.node.graph}get system(){return this.node.system}get components(){return this.node.components}get isActive(){return this.graph.isActive}getComponent(e,t=!1){return this.node.components.get(e,t)}getComponents(e){return this.node.components.getArray(e)}getComponentsByTag(e){return this.node.components.getByTag(e)}createComponent(e){return this.node.createComponent(e)}getOrCreateComponent(e){return this.node.components.get(e,!0)||this.node.createComponent(e)}hasComponent(e){return this.node.components.has(e)}getGraphComponent(e,t=!1){return this.node.graph.components.get(e,t)}getGraphComponents(e){return this.node.graph.components.getArray(e)}getGraphComponentsByTag(e){return this.node.graph.components.getByTag(e)}hasGraphComponent(e){return this.node.graph.components.has(e)}getMainComponent(e,t=!1){return this.node.system.graph.components.get(e,t)}getMainComponents(e){return this.node.system.graph.components.getArray(e)}getMainComponentsByTag(e){return this.node.system.graph.components.getByTag(e)}hasMainComponent(e){return this.node.system.graph.components.has(e)}getSystemComponent(e,t=!1){return this.node.system.components.get(e,t)}getSystemComponents(e){return this.node.system.components.getArray(e)}getSystemComponentsByTag(e){return this.node.system.components.getByTag(e)}hasSystemComponent(e){return this.node.system.components.has(e)}getComponentById(e){return this.node.system.components.getById(e)}getNode(e,t=!1){return this.node.graph.nodes.get(e,t)}getNodes(e){return this.node.graph.nodes.getArray(e)}getNodesByTag(e){return this.node.graph.nodes.getByTag(e)}hasNode(e){return this.node.graph.nodes.has(e)}getMainNode(e,t=!1){return this.node.system.graph.nodes.get(e,t)}getMainNodes(e){return this.node.system.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.node.system.graph.nodes.getByTag(e)}hasMainNode(e){return this.node.system.graph.nodes.has(e)}getSystemNode(e,t=!1){return this.node.system.nodes.get(e,t)}getSystemNodes(e){return this.node.system.nodes.getArray(e)}getSystemNodesByTag(e){return this.node.system.nodes.getByTag(e)}hasSystemNode(e){return this.node.system.nodes.has(e)}getNodeById(e){return this.node.system.nodes.getById(e)}activate(){}update(e){throw new Error("this should never be called")}tick(e){throw new Error("this should never be called")}tock(e){throw new Error("this should never be called")}deactivate(){}requestSort(){this.graph.requestSort()}is(e){const t=j.getTypeName(e);let n=this;do{if(n=Object.getPrototypeOf(n),n.constructor.typeName===t)return!0}while(n.constructor.typeName!==j.typeName);return!1}unlinkAllProperties(){this.ins.unlinkAllProperties(),this.outs.unlinkAllProperties()}resetChanged(){this.changed=!1;const e=this.ins.properties;for(let t=0,n=e.length;tt.dump(e+" IN "))),this.outs.properties.forEach((t=>t.dump(e+" OUT ")))}toJSON(){let e={};const t=this.ins.toJSON();t&&(e.ins=t);const n=this.outs.toJSON();return n&&(e.outs=n),e}fromJSON(e){e.ins&&this.ins.fromJSON(e.ins),e.outs&&this.outs.fromJSON(e.outs)}referencesFromJSON(e){const t=this.system.components.getDictionary();e.ins&&this.ins.linksFromJSON(e.ins,t),e.outs&&this.outs.linksFromJSON(e.outs,t)}addCustomInput(e,t,n){return this.changed=!0,this.ins.createCustomProperty(e,t,n)}allowCustomInput(e){return!1}addCustomOutput(e,t,n){return this.outs.createCustomProperty(e,t,n)}allowCustomOutput(e){return!1}addInputs(e,t){return this.ins.createProperties(e,t)}addOutputs(e,t){return this.outs.createProperties(e,t)}}j.typeName="Component",j.text="",j.icon="",j.isNodeSingleton=!0,j.isGraphSingleton=!1,j.isSystemSingleton=!1,j.prototype.activate=null,j.prototype.update=null,j.prototype.tick=null,j.prototype.tock=null,j.prototype.deactivate=null;class $ extends j{constructor(e,t){super(e,t),this.ins=this.addInputs($.ins),this.outs=this.addOutputs($.outs),this._fullscreenElement=null,this.onFullscreenChange=this.onFullscreenChange.bind(this);const n=document.documentElement,i=n.requestFullscreen||n.mozRequestFullScreen||n.webkitRequestFullscreen;this.outs.fullscreenAvailable.setValue(!!i),this.ins.toggle.on("value",this.toggle,this)}get fullscreenElement(){return this._fullscreenElement}set fullscreenElement(e){e!==this._fullscreenElement&&(this._fullscreenElement&&this._fullscreenElement.removeEventListener("fullscreenchange",this.onFullscreenChange),this._fullscreenElement=e,e&&e.addEventListener("fullscreenchange",this.onFullscreenChange))}update(e){return!0}toggle(){const e=this.outs,t=this._fullscreenElement;if(t){const n=e.fullscreenActive.value;if(!n&&e.fullscreenAvailable.value)t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);else if(n){const e=document;e.exitFullscreen?e.exitFullscreen():e.cancelFullScreen?e.cancelFullScreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()}}}onFullscreenChange(e){const t=document,n=t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement;this.outs.fullscreenActive.setValue(!!n)}}$.typeName="CFullscreen",$.ins={toggle:D("Fullscreen.Toggle")},$.outs={fullscreenAvailable:C("Fullscreen.Available",!1),fullscreenActive:C("Fullscreen.Active",!1)};const H=100,G=301,W=302,q=303,X=306,Y=1e3,K=1001,J=1002,Z=1003,Q=1004,ee=1005,te=1006,ne=1008,ie=1009,se=1012,re=1014,oe=1015,ae=1016,le=1020,ce=1023,he=1026,ue=1027,de=33776,pe=33777,me=33778,fe=33779,ge=2300,ve=2301,ye=2302,be=3e3,xe=3001,_e=7680,we=35044,Se="300 es",Me=1035;class Ee extends j{constructor(e,t){super(e,t),this.outs=this.addOutputs(Ee.pulseOuts),this._tockUpdated=!1,this.addEvent("pulse"),this.onAnimationFrame=this.onAnimationFrame.bind(this),this.context={time:new Date,secondsElapsed:0,secondsDelta:0,frameNumber:0},this._secondsStarted=.001*Date.now(),this._secondsStopped=this._secondsStarted,this._animHandler=0,this._pulseEvent={type:"pulse",context:this.context,systemUpdated:!1}}start(){0===this._animHandler&&(this._secondsStopped>0&&(this._secondsStarted+=.001*Date.now()-this._secondsStopped,this._secondsStopped=0),this._animHandler=window.requestAnimationFrame(this.onAnimationFrame))}stop(){0!==this._animHandler&&(0===this._secondsStopped&&(this._secondsStopped=.001*Date.now()),window.cancelAnimationFrame(this._animHandler),this._animHandler=0)}pulse(e){const{outs:t,context:n,_pulseEvent:i}=this;n.time.setTime(e);const s=.001*e-this._secondsStarted;n.secondsDelta=s-n.secondsElapsed,n.secondsElapsed=s,n.frameNumber++,t.time.setValue(n.secondsElapsed),t.frame.setValue(n.frameNumber);const r=this.system.graph.tick(n);i.systemUpdated=r||this._tockUpdated,this.emit(i),this._tockUpdated=this.system.graph.tock(n)}onAnimationFrame(){this.pulse(Date.now()),this._animHandler=window.requestAnimationFrame(this.onAnimationFrame)}}var Te;Ee.typeName="CPulse",Ee.isSystemSingleton=!0,Ee.pulseOuts={time:b("Pulse.Time"),frame:x("Pulse.Frame")},function(e){e[e.Basic=0]="Basic",e[e.PCF=1]="PCF",e[e.PCFSoft=2]="PCFSoft"}(Te||(Te={}));const Ce={[Te.Basic]:0,[Te.PCF]:1,[Te.PCFSoft]:2};class Ae extends j{constructor(e,t){super(e,t),this.ins=this.addInputs(Ae.ins),this.outs=this.addOutputs(Ae.outs),this.views=[],this._activeSceneComponent=null,this._forceRender=!1,this.addEvents("active-scene","active-camera")}get activeSceneComponent(){return this._activeSceneComponent}set activeSceneComponent(e){if(e!==this._activeSceneComponent){const t=this._activeSceneComponent,n=this.activeCameraComponent;t&&t.off("active-camera",this.onActiveCamera,this),e&&e.on("active-camera",this.onActiveCamera,this),this._activeSceneComponent=e;const i=this.activeCameraComponent,s={type:"active-scene",previous:t,next:e};this.emit(s);const r={type:"active-camera",previous:n,next:i};this.emit(r)}}get activeSceneGraph(){return this._activeSceneComponent?this._activeSceneComponent.graph:null}get activeScene(){return this._activeSceneComponent?this._activeSceneComponent.scene:null}get activeCameraComponent(){return this._activeSceneComponent?this._activeSceneComponent.activeCameraComponent:null}get activeCamera(){const e=this._activeSceneComponent?this._activeSceneComponent.activeCameraComponent:null;return e?e.camera:null}forceRender(){this._forceRender=!0}create(){super.create(),this.trackComponent(Ee,(e=>{e.on("pulse",this.onPulse,this)}),(e=>{e.off("pulse",this.onPulse,this)}))}update(){const e=this.ins;return e.exposure.changed&&this.views.forEach((t=>t.renderer.toneMappingExposure=e.exposure.value)),e.gamma.changed,e.shadowsEnabled.changed&&this.views.forEach((t=>t.renderer.shadowMap.enabled=e.shadowsEnabled.value)),e.shadowMapType.changed&&this.views.forEach((t=>t.renderer.shadowMap.type=Ce[e.shadowMapType.getValidatedValue()])),!0}attachView(e){if(0===this.views.length){const t=e.renderer,n=this.outs;n.maxTextureSize.setValue(t.capabilities.maxTextureSize),n.maxCubemapSize.setValue(t.capabilities.maxCubemapSize)}this.views.push(e)}detachView(e){const t=this.views.indexOf(e);if(t<0)throw new Error("render view not registered");this.views.splice(t,1)}logInfo(){this.views.forEach((e=>{console.log(e.renderer.info)}))}onPulse(e){(e.systemUpdated||this._forceRender)&&(this.views.forEach((e=>{e.renderer.xr.isPresenting||e.render()})),this._forceRender=!1)}onActiveCamera(e){this.emit(e)}}Ae.typeName="CRenderer",Ae.isSystemSingleton=!0,Ae.ins={exposure:b("Shading.Exposure",1),gamma:b("Shading.Gamma",2),shadowsEnabled:C("Shadows.Enabled",!0),shadowMapType:R("Shadows.MapType",Te,Te.PCF)},Ae.outs={maxTextureSize:x("Caps.MaxTextureSize"),maxCubemapSize:x("Caps.MaxCubemapSize")};const Pe=[];for(let e=0;e<256;e++)Pe[e]=(e<16?"0":"")+e.toString(16);const Re=Math.PI/180,Le=180/Math.PI;function Ne(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Pe[255&e]+Pe[e>>8&255]+Pe[e>>16&255]+Pe[e>>24&255]+"-"+Pe[255&t]+Pe[t>>8&255]+"-"+Pe[t>>16&15|64]+Pe[t>>24&255]+"-"+Pe[63&n|128]+Pe[n>>8&255]+"-"+Pe[n>>16&255]+Pe[n>>24&255]+Pe[255&i]+Pe[i>>8&255]+Pe[i>>16&255]+Pe[i>>24&255]).toUpperCase()}function De(e,t,n){return Math.max(t,Math.min(n,e))}function Oe(e,t){return(e%t+t)%t}function Ie(e,t,n){return(1-n)*e+n*t}function ke(e){return 0==(e&e-1)&&0!==e}function ze(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}class Ue{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,s,r,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=s[r+0],d=s[r+1],p=s[r+2],m=s[r+3];if(0===o)return e[t+0]=a,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=u,e[t+1]=d,e[t+2]=p,void(e[t+3]=m);if(h!==m||a!==u||l!==d||c!==p){let e=1-o;const t=a*u+l*d+c*p+h*m,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const s=Math.sqrt(i),r=Math.atan2(s,t*n);e=Math.sin(e*r)/s,o=Math.sin(o*r)/s}const s=o*n;if(a=a*e+u*s,l=l*e+d*s,c=c*e+p*s,h=h*e+m*s,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,r){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=s[r],u=s[r+1],d=s[r+2],p=s[r+3];return e[t]=o*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-o*d,e[t+2]=l*p+c*d+o*u-a*h,e[t+3]=c*p-o*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,s=e._z,r=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(s/2),u=a(n/2),d=a(i/2),p=a(s/2);switch(r){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+o+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(s-l)*e,this._z=(r-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+r)/e,this._z=(s+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(s-l)/e,this._x=(i+r)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(r-i)/e,this._x=(s+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(De(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,r=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+r*o+i*l-s*a,this._y=i*c+r*a+s*o-n*l,this._z=s*c+r*l+n*a-i*o,this._w=r*c-n*o-i*a-s*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,s=this._z,r=this._w;let o=r*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=r,this._x=n,this._y=i,this._z=s,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*r+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=r*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=s*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ue.prototype.isQuaternion=!0;class Ve{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Be.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Be.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,r=e.y,o=e.z,a=e.w,l=a*t+r*i-o*n,c=a*n+o*t-s*i,h=a*i+s*n-r*t,u=-s*t-r*n-o*i;return this.x=l*a+u*-s+c*-o-h*-r,this.y=c*a+u*-r+h*-s-l*-o,this.z=h*a+u*-o+l*-r-c*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,r=t.x,o=t.y,a=t.z;return this.x=i*a-s*o,this.y=s*r-n*a,this.z=n*o-i*r,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Fe.copy(this).projectOnVector(e),this.sub(Fe)}reflect(e){return this.sub(Fe.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(De(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}Ve.prototype.isVector3=!0;const Fe=new Ve,Be=new Ue;class je{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,r,o,a,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=f,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 je).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/$e.setFromMatrixColumn(e,0).length(),s=1/$e.setFromMatrixColumn(e,1).length(),r=1/$e.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,s=e.z,r=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(s),h=Math.sin(s);if("XYZ"===e.order){const e=r*c,n=r*h,i=o*c,s=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-s*l,t[9]=-o*a,t[2]=s-e*l,t[6]=i+n*l,t[10]=r*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,s=l*h;t[0]=e+s*o,t[4]=i*o-n,t[8]=r*l,t[1]=r*h,t[5]=r*c,t[9]=-o,t[2]=n*o-i,t[6]=s+e*o,t[10]=r*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,s=l*h;t[0]=e-s*o,t[4]=-r*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=r*c,t[9]=s-e*o,t[2]=-r*l,t[6]=o,t[10]=r*a}else if("ZYX"===e.order){const e=r*c,n=r*h,i=o*c,s=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+s,t[1]=a*h,t[5]=s*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=r*a}else if("YZX"===e.order){const e=r*a,n=r*l,i=o*a,s=o*l;t[0]=a*c,t[4]=s-e*h,t[8]=i*h+n,t[1]=h,t[5]=r*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-s*h}else if("XZY"===e.order){const e=r*a,n=r*l,i=o*a,s=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+s,t[5]=r*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=s*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ge,e,We)}lookAt(e,t,n){const i=this.elements;return Ye.subVectors(e,t),0===Ye.lengthSq()&&(Ye.z=1),Ye.normalize(),qe.crossVectors(n,Ye),0===qe.lengthSq()&&(1===Math.abs(n.z)?Ye.x+=1e-4:Ye.z+=1e-4,Ye.normalize(),qe.crossVectors(n,Ye)),qe.normalize(),Xe.crossVectors(Ye,qe),i[0]=qe.x,i[4]=Xe.x,i[8]=Ye.x,i[1]=qe.y,i[5]=Xe.y,i[9]=Ye.y,i[2]=qe.z,i[6]=Xe.z,i[10]=Ye.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,r=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],_=i[0],w=i[4],S=i[8],M=i[12],E=i[1],T=i[5],C=i[9],A=i[13],P=i[2],R=i[6],L=i[10],N=i[14],D=i[3],O=i[7],I=i[11],k=i[15];return s[0]=r*_+o*E+a*P+l*D,s[4]=r*w+o*T+a*R+l*O,s[8]=r*S+o*C+a*L+l*I,s[12]=r*M+o*A+a*N+l*k,s[1]=c*_+h*E+u*P+d*D,s[5]=c*w+h*T+u*R+d*O,s[9]=c*S+h*C+u*L+d*I,s[13]=c*M+h*A+u*N+d*k,s[2]=p*_+m*E+f*P+g*D,s[6]=p*w+m*T+f*R+g*O,s[10]=p*S+m*C+f*L+g*I,s[14]=p*M+m*A+f*N+g*k,s[3]=v*_+y*E+b*P+x*D,s[7]=v*w+y*T+b*R+x*O,s[11]=v*S+y*C+b*L+x*I,s[15]=v*M+y*A+b*N+x*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+s*a*h-i*l*h-s*o*u+n*l*u+i*o*d-n*a*d)+e[7]*(+t*a*d-t*l*u+s*r*u-i*r*d+i*l*c-s*a*c)+e[11]*(+t*l*h-t*o*d-s*r*h+n*r*d+s*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*u+i*r*h-n*r*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],m=e[13],f=e[14],g=e[15],v=h*f*l-m*u*l+m*a*d-o*f*d-h*a*g+o*u*g,y=p*u*l-c*f*l-p*a*d+r*f*d+c*a*g-r*u*g,b=c*m*l-p*h*l+p*o*d-r*m*d-c*o*g+r*h*g,x=p*h*a-c*m*a-p*o*u+r*m*u+c*o*f-r*h*f,_=t*v+n*y+i*b+s*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/_;return e[0]=v*w,e[1]=(m*u*s-h*f*s-m*i*d+n*f*d+h*i*g-n*u*g)*w,e[2]=(o*f*s-m*a*s+m*i*l-n*f*l-o*i*g+n*a*g)*w,e[3]=(h*a*s-o*u*s-h*i*l+n*u*l+o*i*d-n*a*d)*w,e[4]=y*w,e[5]=(c*f*s-p*u*s+p*i*d-t*f*d-c*i*g+t*u*g)*w,e[6]=(p*a*s-r*f*s-p*i*l+t*f*l+r*i*g-t*a*g)*w,e[7]=(r*u*s-c*a*s+c*i*l-t*u*l-r*i*d+t*a*d)*w,e[8]=b*w,e[9]=(p*h*s-c*m*s-p*n*d+t*m*d+c*n*g-t*h*g)*w,e[10]=(r*m*s-p*o*s+p*n*l-t*m*l-r*n*g+t*o*g)*w,e[11]=(c*o*s-r*h*s-c*n*l+t*h*l+r*n*d-t*o*d)*w,e[12]=x*w,e[13]=(c*m*i-p*h*i+p*n*u-t*m*u-c*n*f+t*h*f)*w,e[14]=(p*o*i-r*m*i-p*n*a+t*m*a+r*n*f-t*o*f)*w,e[15]=(r*h*i-c*o*i+c*n*a-t*h*a-r*n*u+t*o*u)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,r=e.x,o=e.y,a=e.z,l=s*r,c=s*o;return this.set(l*r+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*r,0,l*a-i*o,c*a+i*r,s*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,r=t._y,o=t._z,a=t._w,l=s+s,c=r+r,h=o+o,u=s*l,d=s*c,p=s*h,m=r*c,f=r*h,g=o*h,v=a*l,y=a*c,b=a*h,x=n.x,_=n.y,w=n.z;return i[0]=(1-(m+g))*x,i[1]=(d+b)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-b)*_,i[5]=(1-(u+g))*_,i[6]=(f+v)*_,i[7]=0,i[8]=(p+y)*w,i[9]=(f-v)*w,i[10]=(1-(u+m))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=$e.set(i[0],i[1],i[2]).length();const r=$e.set(i[4],i[5],i[6]).length(),o=$e.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],He.copy(this);const a=1/s,l=1/r,c=1/o;return He.elements[0]*=a,He.elements[1]*=a,He.elements[2]*=a,He.elements[4]*=l,He.elements[5]*=l,He.elements[6]*=l,He.elements[8]*=c,He.elements[9]*=c,He.elements[10]*=c,t.setFromRotationMatrix(He),n.x=s,n.y=r,n.z=o,this}makePerspective(e,t,n,i,s,r){void 0===r&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*s/(t-e),l=2*s/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(r+s)/(r-s),d=-2*r*s/(r-s);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,s,r){const o=this.elements,a=1/(t-e),l=1/(n-i),c=1/(r-s),h=(t+e)*a,u=(n+i)*l,d=(r+s)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}je.prototype.isMatrix4=!0;const $e=new Ve,He=new je,Ge=new Ve(0,0,0),We=new Ve(1,1,1),qe=new Ve,Xe=new Ve,Ye=new Ve,Ke=new je,Je=new Ue;class Ze{constructor(e=0,t=0,n=0,i=Ze.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],r=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(De(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-De(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(De(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(a,s));break;case"ZYX":this._y=Math.asin(-De(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(De(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-De(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ke.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ke,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Je.setFromEuler(this),this.setFromQuaternion(Je,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new Ve(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ze.prototype.isEuler=!0,Ze.DefaultOrder="XYZ",Ze.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Qe{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>>0}enable(e){this.mask|=1<0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,r,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=s,c[5]=a,c[6]=n,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,r=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],b=i[7],x=i[2],_=i[5],w=i[8];return s[0]=r*m+o*v+a*x,s[3]=r*f+o*y+a*_,s[6]=r*g+o*b+a*w,s[1]=l*m+c*v+h*x,s[4]=l*f+c*y+h*_,s[7]=l*g+c*b+h*w,s[2]=u*m+d*v+p*x,s[5]=u*f+d*y+p*_,s[8]=u*g+d*b+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*r*c-t*o*l-n*s*c+n*o*a+i*s*l-i*r*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*r-o*l,u=o*a-c*s,d=l*s-r*a,p=t*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=h*m,e[1]=(i*l-c*n)*m,e[2]=(o*n-i*r)*m,e[3]=u*m,e[4]=(c*t-i*a)*m,e[5]=(i*s-o*t)*m,e[6]=d*m,e[7]=(n*a-l*t)*m,e[8]=(r*t-n*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,o){const a=Math.cos(s),l=Math.sin(s);return this.set(n*a,n*l,-n*(a*r+l*o)+r+e,-i*l,i*a,-i*(-l*r+a*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],r=i[3],o=i[6],a=i[1],l=i[4],c=i[7];return i[0]=t*s+n*a,i[3]=t*r+n*l,i[6]=t*o+n*c,i[1]=-n*s+t*a,i[4]=-n*r+t*l,i[7]=-n*o+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}tt.prototype.isMatrix3=!0;let nt=0;const it=new Ve,st=new Ue,rt=new je,ot=new Ve,at=new Ve,lt=new Ve,ct=new Ue,ht=new Ve(1,0,0),ut=new Ve(0,1,0),dt=new Ve(0,0,1),pt={type:"added"},mt={type:"removed"};class ft extends Qe{constructor(){super(),Object.defineProperty(this,"id",{value:nt++}),this.uuid=Ne(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ft.DefaultUp.clone();const e=new Ve,t=new Ze,n=new Ue,i=new Ve(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new je},normalMatrix:{value:new tt}}),this.matrix=new je,this.matrixWorld=new je,this.matrixAutoUpdate=ft.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new et,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return st.setFromAxisAngle(e,t),this.quaternion.multiply(st),this}rotateOnWorldAxis(e,t){return st.setFromAxisAngle(e,t),this.quaternion.premultiply(st),this}rotateX(e){return this.rotateOnAxis(ht,e)}rotateY(e){return this.rotateOnAxis(ut,e)}rotateZ(e){return this.rotateOnAxis(dt,e)}translateOnAxis(e,t){return it.copy(e).applyQuaternion(this.quaternion),this.position.add(it.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ht,e)}translateY(e){return this.translateOnAxis(ut,e)}translateZ(e){return this.translateOnAxis(dt,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(rt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ot.copy(e):ot.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),at.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rt.lookAt(at,ot,this.up):rt.lookAt(ot,at,this.up),this.quaternion.setFromRotationMatrix(rt),i&&(rt.extractRotation(i.matrixWorld),st.setFromRotationMatrix(rt),this.quaternion.premultiply(st.invert()))}add(e){if(arguments.length>1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=i,n;function r(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;ten?n:e,limitInt:function(e,t,n){return(e=Math.trunc(e))n?n:e},normalize:(e,t,n)=>(e-t)/(n-t),normalizeLimit:(e,t,n)=>(e=(e-t)/(n-t))<0?0:e>1?1:e,denormalize:(e,t,n)=>(t+e)*(n-t),scale:(e,t,n,i,s)=>i+(e-t)/(n-t)*(s-i),scaleLimit:(e,t,n,i,s)=>i+((e=en?n:e)-t)/(n-t)*(s-i),deg2rad:function(e){return.017453292519943295*e},rad2deg:function(e){return 57.29577951308232*e},deltaRadians:function(e,t){return e=(e%=gt.DOUBLE_PI)<0?e+gt.DOUBLE_PI:e,(t=(t%=gt.DOUBLE_PI)<0?t+gt.DOUBLE_PI:t)-e>gt.PI&&(e+=gt.DOUBLE_PI),t-e},deltaDegrees:function(e,t){return e=(e%=gt.DOUBLE_PI)<0?e+gt.DOUBLE_PI:e,(t=(t%=gt.DOUBLE_PI)<0?t+gt.DOUBLE_PI:t)-e>gt.PI&&(e+=gt.DOUBLE_PI),t-e},curves:{linear:e=>e,easeIn:e=>Math.sin(e*gt.HALF_PI),easeOut:e=>Math.cos(e*gt.HALF_PI-gt.PI)+1,ease:e=>.5*Math.cos(e*gt.PI-gt.PI)+.5,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e}},vt=gt;class yt{constructor(){this.visited={},this.visiting={},this.sorted=[]}sort(e){for(let t=0,n=e.length;t0)throw new Error("graph not empty")}requestSort(){this._sortRequested=!0}sort(){this._sortedList=this._sorter.sort(this.components.getArray());this.parent&&(this.parent.name||this.parent.typeName)}createCustomNode(e,t,n){const i=this.system.registry.getType(e);if(!i)throw new Error(`node type '${B.getTypeName(e)}' not registered`);const s=new i(this,n||I(12,this.system.nodes.getDictionary()));return s.create(),t&&(s.name=t),n||(s.createComponents(),s.unlock()),s}createNode(e,t){const n=new B(this,t||I(12,this.system.nodes.getDictionary()));return n.create(),e&&(n.name=e),n.unlock(),n}findNodeByName(e,t){const n=this.nodes.getArray(t);for(let t=0,i=n.length;te.toString(!0))).join("\n"):i}dump(e=""){console.log(e+"%cGraph","color: red");this.findRootNodes().forEach((t=>t.dump(e+" ")))}toJSON(){const e={},t=[],n=this.nodes.getArray();for(let e=0,i=n.length;e0&&(e.nodes=t),e}fromJSON(e){e.nodes&&(e.nodes.forEach((e=>{this.createCustomNode(e.type,e.name,e.id).fromJSON(e)})),e.nodes.forEach((e=>{this.nodes.getById(e.id).referencesFromJSON(e)})))}nodeToJSON(e){return e.toJSON()}_addNode(e){this.nodes.add(e),this.system._addNode(e)}_removeNode(e){this.system._removeNode(e),this.nodes.remove(e)}_addNodeTag(e,t){this.nodes.addByTag(e,t),this.system._addNodeTag(e,t)}_removeNodeTag(e,t){this.system._removeNodeTag(e,t),this.nodes.removeByTag(e,t)}_addComponent(e){if(e.isGraphSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per graph`);this.components.add(e),this.system._addComponent(e),e.tock&&this._tockList.push(e),this._sortRequested=!0}_removeComponent(e){this.system._removeComponent(e),this.components.remove(e),e.tock&&this._tockList.splice(this._tockList.indexOf(e),1),this._sortRequested=!0}_addComponentTag(e,t){this.components.addByTag(e,t),this.system._addComponentTag(e,t)}_removeComponentTag(e,t){this.system._removeComponentTag(e,t),this.components.removeByTag(e,t)}_addRoot(e){this.roots.push(e),this.parent&&this.parent.onAddInnerRoot(e)}_removeRoot(e){this.parent&&this.parent.onRemoveInnerRoot(e),this.roots.splice(this.roots.indexOf(e),1)}}class xt extends j{constructor(e,t){super(e,t),this.ins=this.addInputs(xt.graphIns),this._innerGraph=null,this._innerRoot=null,this._innerGraph=new bt(this.system,this)}get innerGraph(){return this._innerGraph}get innerNodes(){return this._innerGraph.nodes}get innerComponents(){return this._innerGraph.components}get innerRoots(){return this._innerGraph.roots}getInnerComponent(e,t=!1){return this._innerGraph.components.get(e,t)}getInnerComponents(e){return this._innerGraph.components.getArray(e)}hasInnerComponent(e){return this._innerGraph.components.has(e)}getInnerNode(e,t=!1){return this._innerGraph.nodes.get(e,t)}getInnerNodes(e){return this._innerGraph.nodes.getArray(e)}hasInnerNode(e){return this._innerGraph.nodes.has(e)}isEmpty(){return 0===this._innerGraph.nodes.count()}update(e){const t=this.ins;if(t.active.changed){const e=t.active.value;e!==this._innerGraph.isActive&&(e?this.activateInnerGraph():this.deactivateInnerGraph())}return!0}tick(e){return this._innerGraph.tick(e)}tock(e){return this._innerGraph.tock(e)}dispose(){this._innerGraph.clear(),this._innerGraph=null,this._innerRoot=null,super.dispose()}clearInnerGraph(){this._innerGraph.clear()}fromJSON(e){super.fromJSON(e),this._innerGraph.clear(),this._innerGraph.fromJSON(e.graph)}toJSON(){const e=super.toJSON();return e.graph=this._innerGraph.toJSON(),e}dump(e=""){super.dump(e),this.innerGraph.dump(e+" ")}onAddInnerRoot(e){}onRemoveInnerRoot(e){}activateInnerGraph(){this._innerGraph.activate()}deactivateInnerGraph(){this._innerGraph.deactivate()}}xt.typeName="CGraph",xt.graphIns={active:C("Graph.Active",!0)};const _t=(e,t,n)=>{let i;const s=e.children;for(let e=0,n=s.length;e{let i;const s=e.children;for(let e=0,n=s.length;e{let i=[];const s=e.children;for(let e=0,n=s.length;ee.node.dispose())),this._parent&&this._parent.removeChild(this),this.graph._removeRoot(this),super.dispose()}getRootComponent(e){let t=this;for(;t._parent;)t=t._parent;return t?t.node.components.get(e):null}getParentComponent(e,t){let n=this;for(;;){if(n=n._parent,!n){const e=this.graph.parent;n=e?e.components.get(Mt):void 0}if(!n)return;const i=n.node.components.get(e,!0);if(i)return i;if(!t)return}}getParentNode(e,t){let n=this;for(;;){if(n=n._parent,!n){const e=this.graph.parent;n=e?e.components.get(Mt):void 0}if(!n)return;const i=n.node;if(i.is(e))return i;if(!t)return}}getSiblingNode(e){return this.getSiblingNodes(e)[0]}getSiblingNodes(e){const t=this._parent;return this.graph.nodes.getArray(e).filter((e=>{const n=e.components.get(Mt);return(n?n._parent:null)==t}))}hasChildComponents(e,t){return _t(this,e,t)}getChildComponent(e,t){return wt(this,e,t)}getChildComponents(e,t){return St(this,e,t)}traverseUp(e,t,n,i){if(e)if(t){const e=this.node.components.getArray();for(let t=0,n=e.length;t(e.emit(n),n.stopPropagation)))}propagateDown(e,t,n){this.traverseDown(!0,e,t,(e=>(e.emit(n),n.stopPropagation)))}addChild(e){if(e===this)throw new Error("can't add self as child");if(e._parent)throw new Error("can't add child, component has a parent");if(e.graph!==this.graph)throw new Error("can't add child, component in different graph");e._parent=this,this._children.push(e),this.graph._removeRoot(e);const t={type:"hierarchy",add:!0,remove:!1,parent:this,child:e};this.traverseUp(!0,!1,!0,(e=>e.emit(t))),this.traverseDown(!1,!1,!0,(e=>e.emit(t))),this.system.emit(t)}removeChild(e){if(e._parent!==this)throw new Error("component not a child of this");const t={type:"hierarchy",add:!1,remove:!0,parent:this,child:e};this.traverseUp(!0,!1,!0,(e=>e.emit(t))),this.traverseDown(!1,!1,!0,(e=>e.emit(t))),this.system.emit(t);const n=this._children.indexOf(e);this._children.splice(n,1),e._parent=null,this.graph._addRoot(e)}onComponent(e){if(e.object===this)return;const t={type:"child",add:e.add,remove:e.remove,component:e.object};this.traverseUp(!0,!1,!0,(e=>e.emit(t)))}toJSON(){const e=super.toJSON();return this._children.length>0&&(e.children=this._children.map((e=>e.id))),e}referencesFromJSON(e){super.referencesFromJSON(e);const t=this.system.components.getDictionary();e.children&&e.children.forEach((e=>{const n=t[e];this.addChild(n)}))}toString(){return super.toString()+` - children: ${this.children.length}`}dump(e=""){super.dump(e),this.children.length>0&&(console.log(e+"%cChildren","color: purple"),this.children.forEach((t=>t.node.dump(e+" "))))}}Mt.typeName="CHierarchy";const Et=new Ve,Tt=new Ve,Ct=new Ue,At=new Ze;var Pt;!function(e){e[e.XYZ=0]="XYZ",e[e.YZX=1]="YZX",e[e.ZXY=2]="ZXY",e[e.XZY=3]="XZY",e[e.YXZ=4]="YXZ",e[e.ZYX=5]="ZYX"}(Pt||(Pt={}));class Rt extends Mt{constructor(e,t){super(e,t),this.ins=this.addInputs(Rt.transformIns),this.outs=this.addOutputs(Rt.transformOuts),this._object3D=this.createObject3D(),this._object3D.matrixAutoUpdate=!1}get transform(){return this}get object3D(){return this._object3D}get children(){return this._children||[]}get matrix(){return this._object3D.matrix}update(e){const t=this._object3D,{position:n,rotation:i,order:s,scale:r}=this.ins,{matrix:o}=this.outs;t.position.fromArray(n.value),Et.fromArray(i.value).multiplyScalar(vt.DEG2RAD);const a=s.getOptionText();return t.rotation.setFromVector3(Et,a),t.scale.fromArray(r.value),t.updateMatrix(),t.matrix.toArray(o.value),o.set(),!0}dispose(){this._object3D&&(this._object3D.children.slice().forEach((e=>this._object3D.remove(e))),this._object3D.parent&&this._object3D.parent.remove(this._object3D)),super.dispose()}setPropertiesFromMatrix(e){const t=!e;e=e||this._object3D.matrix;const{position:n,rotation:i,order:s,scale:r}=this.ins;e.decompose(Et,Ct,Tt),Et.toArray(n.value);const o=s.getOptionText();At.setFromQuaternion(Ct,o),At.toVector3(Et),Et.multiplyScalar(vt.RAD2DEG).toArray(i.value),Tt.toArray(r.value),n.set(t),i.set(t),r.set(t)}addChild(e){super.addChild(e),this._object3D.add(e._object3D)}removeChild(e){this._object3D.remove(e._object3D),super.removeChild(e)}createObject3D(){return new ft}}Rt.typeName="CTransform",Rt.transformIns={position:w("Transform.Position"),rotation:w("Transform.Rotation"),order:R("Transform.Order",Pt),scale:E("Transform.Scale")},Rt.transformOuts={matrix:S("Transform.Matrix")};class Lt{constructor(e=new Ve(1/0,1/0,1/0),t=new Ve(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,s=-1/0,r=-1/0,o=-1/0;for(let a=0,l=e.length;as&&(s=l),c>r&&(r=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(s,r,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,r=-1/0,o=-1/0;for(let a=0,l=e.count;as&&(s=l),c>r&&(r=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(s,r,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Dt),Dt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bt),jt.subVectors(this.max,Bt),It.subVectors(e.a,Bt),kt.subVectors(e.b,Bt),zt.subVectors(e.c,Bt),Ut.subVectors(kt,It),Vt.subVectors(zt,kt),Ft.subVectors(It,zt);let t=[0,-Ut.z,Ut.y,0,-Vt.z,Vt.y,0,-Ft.z,Ft.y,Ut.z,0,-Ut.x,Vt.z,0,-Vt.x,Ft.z,0,-Ft.x,-Ut.y,Ut.x,0,-Vt.y,Vt.x,0,-Ft.y,Ft.x,0];return!!Gt(t,It,kt,zt,jt)&&(t=[1,0,0,0,1,0,0,0,1],!!Gt(t,It,kt,zt,jt)&&($t.crossVectors(Ut,Vt),t=[$t.x,$t.y,$t.z],Gt(t,It,kt,zt,jt)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Dt.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(Dt).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Nt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Nt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Nt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Nt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Nt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Nt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Nt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Nt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Nt)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Lt.prototype.isBox3=!0;const Nt=[new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve],Dt=new Ve,Ot=new Lt,It=new Ve,kt=new Ve,zt=new Ve,Ut=new Ve,Vt=new Ve,Ft=new Ve,Bt=new Ve,jt=new Ve,$t=new Ve,Ht=new Ve;function Gt(e,t,n,i,s){for(let r=0,o=e.length-3;r<=o;r+=3){Ht.fromArray(e,r);const o=s.x*Math.abs(Ht.x)+s.y*Math.abs(Ht.y)+s.z*Math.abs(Ht.z),a=t.dot(Ht),l=n.dot(Ht),c=i.dot(Ht);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Wt=new Ve,qt=new Ve,Xt=new Ve,Yt=new Ve,Kt=new Ve,Jt=new Ve,Zt=new Ve;class Qt{constructor(e=new Ve,t=new Ve(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Wt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Wt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Wt.copy(this.direction).multiplyScalar(t).add(this.origin),Wt.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){qt.copy(e).add(t).multiplyScalar(.5),Xt.copy(t).sub(e).normalize(),Yt.copy(this.origin).sub(qt);const s=.5*e.distanceTo(t),r=-this.direction.dot(Xt),o=Yt.dot(this.direction),a=-Yt.dot(Xt),l=Yt.lengthSq(),c=Math.abs(1-r*r);let h,u,d,p;if(c>0)if(h=r*a-o,u=r*o-a,p=s*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+r*u+2*o)+u*(r*h+u+2*a)+l}else u=s,h=Math.max(0,-(r*u+o)),d=-h*h+u*(u+2*a)+l;else u=-s,h=Math.max(0,-(r*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-r*s+o)),u=h>0?-s:Math.min(Math.max(-s,-a),s),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-s,-a),s),d=u*(u+2*a)+l):(h=Math.max(0,-(r*s+o)),u=h>0?s:Math.min(Math.max(-s,-a),s),d=-h*h+u*(u+2*a)+l);else u=r>0?-s:s,h=Math.max(0,-(r*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Xt).multiplyScalar(u).add(qt),d}intersectSphere(e,t){Wt.subVectors(e.center,this.origin);const n=Wt.dot(this.direction),i=Wt.dot(Wt)-n*n,s=e.radius*e.radius;if(i>s)return null;const r=Math.sqrt(s-i),o=n-r,a=n+r;return o<0&&a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,r,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(s=(e.min.y-u.y)*c,r=(e.max.y-u.y)*c):(s=(e.max.y-u.y)*c,r=(e.min.y-u.y)*c),n>r||s>i?null:((s>n||n!=n)&&(n=s),(r=0?(o=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Wt)}intersectTriangle(e,t,n,i,s){Kt.subVectors(t,e),Jt.subVectors(n,e),Zt.crossVectors(Kt,Jt);let r,o=this.direction.dot(Zt);if(o>0){if(i)return null;r=1}else{if(!(o<0))return null;r=-1,o=-o}Yt.subVectors(this.origin,e);const a=r*this.direction.dot(Jt.crossVectors(Yt,Jt));if(a<0)return null;const l=r*this.direction.dot(Kt.cross(Yt));if(l<0)return null;if(a+l>o)return null;const c=-r*Yt.dot(Zt);return c<0?null:this.at(c/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class en{constructor(e,t,n=0,i=1/0){this.ray=new Qt(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new et,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return nn(e,this,n,t),n.sort(tn),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){ln.subVectors(e,this.center);const t=ln.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(ln.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?an.set(0,0,1).multiplyScalar(e.radius):an.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(on.copy(e.center).add(an)),this.expandByPoint(on.copy(e.center).sub(an)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const hn=new Ve,un=new Ve,dn=new Ve,pn=new Ve,mn=new Ve,fn=new Ve,gn=new Ve,vn=new Ve,yn=new Ve,bn=new Ve;class xn{constructor(e=new Ve,t=new Ve,n=new Ve){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),hn.subVectors(e,t),i.cross(hn);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){hn.subVectors(i,t),un.subVectors(n,t),dn.subVectors(e,t);const r=hn.dot(hn),o=hn.dot(un),a=hn.dot(dn),l=un.dot(un),c=un.dot(dn),h=r*l-o*o;if(0===h)return s.set(-2,-1,-1);const u=1/h,d=(l*a-o*c)*u,p=(r*c-o*a)*u;return s.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,pn),pn.x>=0&&pn.y>=0&&pn.x+pn.y<=1}static getUV(e,t,n,i,s,r,o,a){return this.getBarycoord(e,t,n,i,pn),a.set(0,0),a.addScaledVector(s,pn.x),a.addScaledVector(r,pn.y),a.addScaledVector(o,pn.z),a}static isFrontFacing(e,t,n,i){return hn.subVectors(n,t),un.subVectors(e,t),hn.cross(un).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return hn.subVectors(this.c,this.b),un.subVectors(this.a,this.b),.5*hn.cross(un).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return xn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return xn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return xn.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return xn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return xn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let r,o;mn.subVectors(i,n),fn.subVectors(s,n),vn.subVectors(e,n);const a=mn.dot(vn),l=fn.dot(vn);if(a<=0&&l<=0)return t.copy(n);yn.subVectors(e,i);const c=mn.dot(yn),h=fn.dot(yn);if(c>=0&&h<=c)return t.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return r=a/(a-c),t.copy(n).addScaledVector(mn,r);bn.subVectors(e,s);const d=mn.dot(bn),p=fn.dot(bn);if(p>=0&&d<=p)return t.copy(s);const m=d*l-a*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(fn,o);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return gn.subVectors(s,i),o=(h-c)/(h-c+(d-p)),t.copy(i).addScaledVector(gn,o);const g=1/(f+m+u);return r=m*g,o=u*g,t.copy(n).addScaledVector(mn,r).addScaledVector(fn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let _n=0;class wn extends Qe{constructor(){super(),Object.defineProperty(this,"id",{value:_n++}),this.uuid=Ne(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=H,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_e,this.stencilZFail=_e,this.stencilZPass=_e,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),s=i(e.images);t.length>0&&(n.textures=t),s.length>0&&(n.images=s)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}wn.prototype.isMaterial=!0;const Sn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Mn={h:0,s:0,l:0},En={h:0,s:0,l:0};function Tn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Cn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function An(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class Pn{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Oe(e,1),t=De(t,0,1),n=De(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,s=2*n-i;this.r=Tn(s,i,e+1/3),this.g=Tn(s,i,e),this.b=Tn(s,i,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const i=n[1],s=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const n=parseFloat(e[1])/360,i=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,i,s)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===t)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Sn[e.toLowerCase()];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Cn(e.r),this.g=Cn(e.g),this.b=Cn(e.b),this}copyLinearToSRGB(e){return this.r=An(e.r),this.g=An(e.g),this.b=An(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,s=Math.max(t,n,i),r=Math.min(t,n,i);let o,a;const l=(r+s)/2;if(r===s)o=0,a=0;else{const e=s-r;switch(a=l<=.5?e/(s+r):e/(2-s-r),s){case t:o=(n-i)/e+(na&&e>v?ev?a=0;--t)if(e[t]>65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function Vn(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}let Fn=0;const Bn=new je,jn=new ft,$n=new Ve,Hn=new Lt,Gn=new Lt,Wn=new Ve;class qn extends Qe{constructor(){super(),Object.defineProperty(this,"id",{value:Fn++}),this.uuid=Ne(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Un(e)?kn:In)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new tt).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return Bn.makeRotationFromQuaternion(e),this.applyMatrix4(Bn),this}rotateX(e){return Bn.makeRotationX(e),this.applyMatrix4(Bn),this}rotateY(e){return Bn.makeRotationY(e),this.applyMatrix4(Bn),this}rotateZ(e){return Bn.makeRotationZ(e),this.applyMatrix4(Bn),this}translate(e,t,n){return Bn.makeTranslation(e,t,n),this.applyMatrix4(Bn),this}scale(e,t,n){return Bn.makeScale(e,t,n),this.applyMatrix4(Bn),this}lookAt(e){return jn.lookAt(e),jn.updateMatrix(),this.applyMatrix4(jn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter($n).negate(),this.translate($n.x,$n.y,$n.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let s=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],r=[];for(let t=0,i=n.length;t0&&(i[t]=r,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const s=e.morphAttributes;for(const e in s){const n=[],i=s[e];for(let e=0,s=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Kn.copy(n.boundingSphere),Kn.applyMatrix4(s),!1===e.ray.intersectsSphere(Kn))return;if(Xn.copy(s).invert(),Yn.copy(e.ray).applyMatrix4(Xn),null!==n.boundingBox&&!1===Yn.intersectsBox(n.boundingBox))return;let r;if(n.isBufferGeometry){const s=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==s)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:hi.clone(),object:e}}(e,t,n,i,Jn,Zn,Qn,ci);if(p){a&&(oi.fromBufferAttribute(a,c),ai.fromBufferAttribute(a,h),li.fromBufferAttribute(a,u),p.uv=xn.getUV(ci,Jn,Zn,Qn,oi,ai,li,new sn)),l&&(oi.fromBufferAttribute(l,c),ai.fromBufferAttribute(l,h),li.fromBufferAttribute(l,u),p.uv2=xn.getUV(ci,Jn,Zn,Qn,oi,ai,li,new sn));const e={a:c,b:h,c:u,normal:new Ve,materialIndex:0};xn.getNormal(Jn,Zn,Qn,e.normal),p.face=e}return p}ui.prototype.isMesh=!0;class pi extends qn{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,r=t/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=e/o,u=t/a,d=[],p=[],m=[],f=[];for(let e=0;e0)){l=i;break}l=i-1}if(i=l,n[i]===r)return i/(s-1);const c=n[i];return(i+(r-c)/(n[i+1]-c))/(s-1)}getTangent(e,t){const n=1e-4;let i=e-n,s=e+n;i<0&&(i=0),s>1&&(s=1);const r=this.getPoint(i),o=this.getPoint(s),a=t||(r.isVector2?new sn:new Ve);return a.copy(o).sub(r).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Ve,i=[],s=[],r=[],o=new Ve,a=new je;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Ve)}s[0]=new Ve,r[0]=new Ve;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),r[0].crossVectors(i[0],s[0]);for(let t=1;t<=e;t++){if(s[t]=s[t-1].clone(),r[t]=r[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(De(i[t-1].dot(i[t]),-1,1));s[t].applyMatrix4(a.makeRotationAxis(o,e))}r[t].crossVectors(i[t],s[t])}if(!0===t){let t=Math.acos(De(s[0].dot(s[e]),-1,1));t/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(t=-t);for(let n=1;n<=e;n++)s[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),r[n].crossVectors(i[n],s[n])}return{tangents:i,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class fi extends mi{constructor(e=0,t=0,n=1,i=1,s=0,r=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=o,this.aRotation=a}getPoint(e,t){const n=t||new sn,i=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(l)/s)+1)*s:0===c&&l===s-1&&(l=s-2,c=1),this.closed||l>0?o=i[(l-1)%s]:(yi.subVectors(i[0],i[1]).add(i[0]),o=yi);const h=i[l%s],u=i[(l+1)%s];if(this.closed||l+2i.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2];return n.set(Si(o,a.x,l.x,c.x,h.x),Si(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[s]-n,r=this.curves[s],o=r.getLength(),a=0===o?0:1-e/o;return r.getPointAt(a,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ii extends Oi{constructor(e){super(e),this.uuid=Ne(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*n){a=c=e[0],l=h=e[1];for(let t=n;tc&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return Vi(r,o,n,a,l,p),o};function zi(e,t,n,i,s){let r,o;if(s===function(e,t,n,i){let s=0;for(let r=t,o=n-i;r0)for(r=t;r=t;r-=i)o=ss(r,e[r],e[r+1],o);return o&&Zi(o,o.next)&&(rs(o),o=o.next),o}function Ui(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Zi(i,i.next)&&0!==Ji(i.prev,i,i.next))i=i.next;else{if(rs(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Vi(e,t,n,i,s,r,o){if(!e)return;!o&&r&&function(e,t,n,i){let s=e;do{null===s.z&&(s.z=qi(s.x,s.y,t,n,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,function(e){let t,n,i,s,r,o,a,l,c=1;do{for(n=e,e=null,r=null,o=0;n;){for(o++,i=n,a=0,t=0;t0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(s=n,n=n.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:e=s,s.prevZ=r,r=s;n=i}r.nextZ=null,c*=2}while(o>1)}(s)}(e,i,s,r);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,r?Bi(e,i,s,r):Fi(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),rs(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Vi(e=ji(Ui(e),t,n),t,n,i,s,r,2):2===o&&$i(e,t,n,i,s,r):Vi(Ui(e),t,n,i,s,r,1);break}}function Fi(e){const t=e.prev,n=e,i=e.next;if(Ji(t,n,i)>=0)return!1;let s=e.next.next;for(;s!==e.prev;){if(Yi(t.x,t.y,n.x,n.y,i.x,i.y,s.x,s.y)&&Ji(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function Bi(e,t,n,i){const s=e.prev,r=e,o=e.next;if(Ji(s,r,o)>=0)return!1;const a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,h=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,u=qi(a,l,t,n,i),d=qi(c,h,t,n,i);let p=e.prevZ,m=e.nextZ;for(;p&&p.z>=u&&m&&m.z<=d;){if(p!==e.prev&&p!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&Ji(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==e.prev&&m!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&Ji(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&Ji(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==e.prev&&m!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&Ji(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function ji(e,t,n){let i=e;do{const s=i.prev,r=i.next.next;!Zi(s,r)&&Qi(s,i,i.next,r)&&ns(s,r)&&ns(r,s)&&(t.push(s.i/n),t.push(i.i/n),t.push(r.i/n),rs(i),rs(i.next),i=e=r),i=i.next}while(i!==e);return Ui(i)}function $i(e,t,n,i,s,r){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Ki(o,e)){let a=is(o,e);return o=Ui(o,o.next),a=Ui(a,a.next),Vi(o,t,n,i,s,r),void Vi(a,t,n,i,s,r)}e=e.next}o=o.next}while(o!==e)}function Hi(e,t){return e.x-t.x}function Gi(e,t){if(t=function(e,t){let n=t;const i=e.x,s=e.y;let r,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const e=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>o){if(o=e,e===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x=n.x&&n.x>=l&&i!==n.x&&Yi(sr.x||n.x===r.x&&Wi(r,n)))&&(r=n,u=h)),n=n.next}while(n!==a);return r}(e,t),t){const n=is(t,e);Ui(t,t.next),Ui(n,n.next)}}function Wi(e,t){return Ji(e.prev,e,t.prev)<0&&Ji(t.next,e,e.next)<0}function qi(e,t,n,i,s){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Xi(e){let t=e,n=e;do{(t.x=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(r-a)-(s-o)*(i-a)>=0}function Ki(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Qi(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(ns(e,t)&&ns(t,e)&&function(e,t){let n=e,i=!1;const s=(e.x+t.x)/2,r=(e.y+t.y)/2;do{n.y>r!=n.next.y>r&&n.next.y!==n.y&&s<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Ji(e.prev,e,t.prev)||Ji(e,t.prev,t))||Zi(e,t)&&Ji(e.prev,e,e.next)>0&&Ji(t.prev,t,t.next)>0)}function Ji(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Zi(e,t){return e.x===t.x&&e.y===t.y}function Qi(e,t,n,i){const s=ts(Ji(e,t,n)),r=ts(Ji(e,t,i)),o=ts(Ji(n,i,e)),a=ts(Ji(n,i,t));return s!==r&&o!==a||(!(0!==s||!es(e,n,t))||(!(0!==r||!es(e,i,t))||(!(0!==o||!es(n,e,i))||!(0!==a||!es(n,t,i)))))}function es(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ts(e){return e>0?1:e<0?-1:0}function ns(e,t){return Ji(e.prev,e,e.next)<0?Ji(e,t,e.next)>=0&&Ji(e,e.prev,t)>=0:Ji(e,t,e.prev)<0||Ji(e,e.next,t)<0}function is(e,t){const n=new os(e.i,e.x,e.y),i=new os(t.i,t.x,t.y),s=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function ss(e,t,n,i){const s=new os(e,t,n);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function rs(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function os(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class as{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s2&&e[t-1].equals(e[0])&&e.pop()}function cs(e,t){for(let n=0;n{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t})(),ps=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,ms=(()=>{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))})(),fs=(/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent));var gs,vs,ys;!function(e){e[e.mm=0]="mm",e[e.cm=1]="cm",e[e.m=2]="m",e[e.km=3]="km",e[e.in=4]="in",e[e.ft=5]="ft",e[e.yd=6]="yd",e[e.mi=7]="mi"}(gs||(gs={})),function(e){e[e.EN=0]="EN",e[e.ES=1]="ES",e[e.DE=2]="DE"}(vs||(vs={})),function(e){e.EN="English",e.ES="Spanish (Español)",e.DE="German (Deutsche)"}(ys||(ys={}));const bs=new Ve,xs=new Ve,_s=new je,ws=new Ue,Ss=new Ze;class Ms extends Rt{get settingProperties(){return[this.ins.position,this.ins.rotation,this.ins.scale]}get snapshotProperties(){return[this.ins.position,this.ins.rotation,this.ins.scale]}fromData(e){const{position:t,rotation:n,order:i,scale:s}=this.ins,r=Pt[i.getValidatedValue()];e.matrix?(_s.fromArray(e.matrix),_s.decompose(bs,ws,xs),bs.toArray(t.value),Ss.setFromQuaternion(ws,r),Ss.toVector3(bs).multiplyScalar(Le).toArray(n.value),xs.toArray(s.value),t.set(),n.set(),s.set()):(e.translation&&t.setValue(e.translation.slice()),e.rotation&&(ws.fromArray(e.rotation),Ss.setFromQuaternion(ws,r),Ss.toVector3(bs).multiplyScalar(Le).toArray(n.value),n.set()),e.scale&&s.setValue(e.scale.slice()),this.transform.changed=!0)}toData(){this.object3D.matrix.decompose(bs,ws,xs);const e={};return 0===bs.x&&0===bs.y&&0===bs.z||(e.translation=bs.toArray()),0===ws.x&&0===ws.y&&0===ws.z&&1===ws.w||(e.rotation=ws.toArray()),1===xs.x&&1===xs.y&&1===xs.z||(e.scale=xs.toArray()),e}}Ms.typeName="CVNode",Ms.text="Transform",Ms.icon="";class Es extends ft{constructor(){super(),this.type="Group"}}Es.prototype.isGroup=!0;class Ts extends wn{constructor(e){super(),this.type="LineBasicMaterial",this.color=new Pn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}Ts.prototype.isLineBasicMaterial=!0;const Cs=new Ve,As=new Ve,Ps=new je,Rs=new Qt,Ls=new cn;class Ns extends ft{constructor(e=new qn,t=new Ts){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;ea)continue;u.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(u);de.far||t.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,r.start),i=Math.min(s.count,r.start+r.count)-1;na)continue;u.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ns.prototype.isLine=!0;const Ds=new Ve,Os=new Ve;class Is extends Ns{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}},Vs=`{{lit-${String(Math.random()).slice(2)}}}`,Fs=`\x3c!--${Vs}--\x3e`,Bs=new RegExp(`${Vs}|${Fs}`),js="$lit$";class $s{constructor(e,t){this.parts=[],this.element=t;const n=[],i=[],s=document.createTreeWalker(t.content,133,null,!1);let r=0,o=-1,a=0;const{strings:l,values:{length:c}}=e;for(;a0;){const t=l[a],n=qs.exec(t)[2],i=n.toLowerCase()+js,s=e.getAttribute(i);e.removeAttribute(i);const r=s.split(Bs);this.parts.push({type:"attribute",index:o,name:n,strings:r}),a+=r.length-1}}"TEMPLATE"===e.tagName&&(i.push(e),s.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(Vs)>=0){const i=e.parentNode,s=t.split(Bs),r=s.length-1;for(let t=0;t{const n=e.length-t.length;return n>=0&&e.slice(n)===t},Gs=e=>-1!==e.index,Ws=()=>document.createComment(""),qs=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Xs(e,t){const{element:{content:n},parts:i}=e,s=document.createTreeWalker(n,133,null,!1);let r=Ks(i),o=i[r],a=-1,l=0;const c=[];let h=null;for(;s.nextNode();){a++;const e=s.currentNode;for(e.previousSibling===h&&(h=null),t.has(e)&&(c.push(e),null===h&&(h=e)),null!==h&&l++;void 0!==o&&o.index===a;)o.index=null!==h?-1:o.index-l,r=Ks(i,r),o=i[r]}c.forEach((e=>e.parentNode.removeChild(e)))}const Ys=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},Ks=(e,t=-1)=>{for(let n=t+1;n"function"==typeof e&&Js.has(e),Qs={},er={};class tr{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=zs?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let s,r=0,o=0,a=i.nextNode();for(;re}),ir=` ${Vs} `;class sr{constructor(e,t,n,i){this.strings=e,this.values=t,this.type=n,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let i=0;i-1||n)&&-1===e.indexOf("--\x3e",s+1);const r=qs.exec(e);t+=null===r?e+(n?ir:Fs):e.substr(0,r.index)+r[1]+r[2]+js+r[3]+Vs}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==nr&&(t=nr.createHTML(t)),e.innerHTML=t,e}}const rr=e=>null===e||!("object"==typeof e||"function"==typeof e),or=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class ar{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e{try{const e={get capture(){return pr=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class mr{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;Zs(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Qs,e(this)}if(this.__pendingValue===Qs)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=fr(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=Qs}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const fr=e=>e&&(pr?{capture:e.capture,passive:e.passive,once:e.once}:e.capture);function gr(e){let t=vr.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},vr.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const i=e.strings.join(Vs);return n=t.keyString.get(i),void 0===n&&(n=new $s(e,e.getTemplateElement()),t.keyString.set(i,n)),t.stringsArray.set(e.strings,n),n}const vr=new Map,yr=new WeakMap,br=(e,t,n)=>{let i=yr.get(t);void 0===i&&(Us(t,t.firstChild),yr.set(t,i=new cr(Object.assign({templateFactory:gr},n))),i.appendInto(t)),i.setValue(e),i.commit()};const xr=new class{handleAttributeExpressions(e,t,n,i){const s=t[0];if("."===s){return new ur(e,t.slice(1),n).parts}if("@"===s)return[new mr(e,t.slice(1),i.eventContext)];if("?"===s)return[new hr(e,t.slice(1),n)];return new ar(e,t,n).parts}handleTextExpression(e){return new cr(e)}};"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const _r=(e,...t)=>new sr(e,t,"html",xr),wr=(e,t)=>`${e}--${t}`;let Sr=!0;void 0===window.ShadyCSS?Sr=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Sr=!1);const Mr=e=>t=>{const n=wr(t.type,e);let i=vr.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},vr.set(n,i));let s=i.stringsArray.get(t.strings);if(void 0!==s)return s;const r=t.strings.join(Vs);if(s=i.keyString.get(r),void 0===s){const n=t.getTemplateElement();Sr&&window.ShadyCSS.prepareTemplateDom(n,e),s=new $s(t,n),i.keyString.set(r,s)}return i.stringsArray.set(t.strings,s),s},Er=["html","svg"],Tr=new Set,Cr=(e,t,n)=>{Tr.add(e);const i=n?n.element:document.createElement("template"),s=t.querySelectorAll("style"),{length:r}=s;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(i,e);const o=document.createElement("style");for(let e=0;e{Er.forEach((t=>{const n=vr.get(wr(t,e));void 0!==n&&n.keyString.forEach((e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{n.add(e)})),Xs(e,n)}))}))})(e);const a=i.content;n?function(e,t,n=null){const{element:{content:i},parts:s}=e;if(null==n)return void i.appendChild(t);const r=document.createTreeWalker(i,133,null,!1);let o=Ks(s),a=0,l=-1;for(;r.nextNode();)for(l++,r.currentNode===n&&(a=Ys(t),n.parentNode.insertBefore(t,n));-1!==o&&s[o].index===l;){if(a>0){for(;-1!==o;)s[o].index+=a,o=Ks(s,o);return}o=Ks(s,o)}}(n,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(n){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),Xs(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const Ar={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Pr=(e,t)=>t!==e&&(t==t||e==e),Rr={attribute:!0,type:String,converter:Ar,reflect:!1,hasChanged:Pr},Lr="finalized";class Nr extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,n)=>{const i=this._attributeNameForProperty(n,t);void 0!==i&&(this._attributeToPropertyMap.set(i,n),e.push(i))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=Rr){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this.requestUpdateInternal(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Rr}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Lr)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=Pr){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,i=t.converter||Ar,s="function"==typeof i?i:i.fromAttribute;return s?s(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,i=t.converter;return(i&&i.toAttribute||Ar.toAttribute)(e,n)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=Rr){const i=this.constructor,s=i._attributeNameForProperty(e,n);if(void 0!==s){const e=i._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(s):this.setAttribute(s,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){const e=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,n){let i=!0;if(void 0!==e){const s=this.constructor;n=n||s.getPropertyOptions(e),s._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}Nr.finalized=!0;const Dr=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(n){n.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(n){n.createProperty(t.key,e)}};function Or(e){return(t,n)=>void 0!==n?((e,t,n)=>{t.constructor.createProperty(n,e)})(e,t,n):Dr(e,t)}const Ir=Element.prototype;Ir.msMatchesSelector||Ir.webkitMatchesSelector;const kr=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zr=Symbol();class Ur{constructor(e,t){if(t!==zr)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(kr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const Vr={};class Fr extends Nr{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight(((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e)),n),n=t(e,new Set),i=[];n.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!kr){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new Ur(String(t),zr)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?kr?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==Vr&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return Vr}}Fr.finalized=!0,Fr.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const i=n.scopeName,s=yr.has(t),r=Sr&&11===t.nodeType&&!!t.host,o=r&&!Tr.has(i),a=o?document.createDocumentFragment():t;if(br(e,a,Object.assign({templateFactory:Mr(i)},n)),o){const e=yr.get(a);yr.delete(a);const n=e.value instanceof tr?e.value.template:void 0;Cr(i,a,n),Us(t,t.firstChild),t.appendChild(a),yr.set(t,e)}!s&&r&&window.ShadyCSS.styleElement(t.host)},Fr.shadowRootOptions={mode:"open"};const Br=(e,t)=>{const n=e.startNode.parentNode,i=void 0===t?e.endNode:t.startNode,s=n.insertBefore(Ws(),i);n.insertBefore(Ws(),i);const r=new cr(e.options);return r.insertAfterNode(s),r},jr=(e,t)=>(e.setValue(t),e.commit(),e),$r=(e,t,n)=>{const i=e.startNode.parentNode,s=n?n.startNode:e.endNode,r=t.endNode.nextSibling;r!==s&&((e,t,n=null,i=null)=>{for(;t!==n;){const n=t.nextSibling;e.insertBefore(t,i),t=n}})(i,t.startNode,r,s)},Hr=e=>{Us(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},Gr=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Wr=new WeakMap,qr=new WeakMap;Xr=(e,t,n)=>{let i;return void 0===n?n=t:void 0!==t&&(i=t),t=>{if(!(t instanceof cr))throw new Error("repeat can only be used in text bindings");const s=Wr.get(t)||[],r=qr.get(t)||[],o=[],a=[],l=[];let c,h,u=0;for(const t of e)l[u]=i?i(t,u):u,a[u]=n(t,u),u++;let d=0,p=s.length-1,m=0,f=a.length-1;for(;d<=p&&m<=f;)if(null===s[d])d++;else if(null===s[p])p--;else if(r[d]===l[m])o[m]=jr(s[d],a[m]),d++,m++;else if(r[p]===l[f])o[f]=jr(s[p],a[f]),p--,f--;else if(r[d]===l[f])o[f]=jr(s[d],a[f]),$r(t,s[d],o[f+1]),d++,f--;else if(r[p]===l[m])o[m]=jr(s[p],a[m]),$r(t,s[p],s[d]),p--,m++;else if(void 0===c&&(c=Gr(l,m,f),h=Gr(r,d,p)),c.has(r[d]))if(c.has(r[p])){const e=h.get(l[m]),n=void 0!==e?s[e]:null;if(null===n){const e=Br(t,s[d]);jr(e,a[m]),o[m]=e}else o[m]=jr(n,a[m]),$r(t,n,s[d]),s[e]=null;m++}else Hr(s[p]),p--;else Hr(s[d]),d++;for(;m<=f;){const e=Br(t,o[f+1]);jr(e,a[m]),o[m++]=e}for(;d<=p;){const e=s[d++];null!==e&&Hr(e)}Wr.set(t,o),qr.set(t,l)}};var Xr,Yr,Kr=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Jr=Yr=class extends Fr{constructor(){super(...arguments),this._isFirstConnected=!1}static setStyle(e,t){Object.assign(e.style,t)}static setAttribs(e,t){for(let n in t)e.setAttribute(n,t[n])}get shady(){return this.constructor.shady}appendTo(e){return e.appendChild(this),this}removeChildren(){for(;this.firstChild;)this.removeChild(this.firstChild)}getChildrenArray(){return Array.from(this.children)}appendElement(e,t){return this.createElement(e,t,this)}createElement(e,t,n){let i;return i="string"==typeof e?document.createElement(e):e instanceof HTMLElement?e:new e,t&&Object.assign(i.style,t),n&&n.appendChild(i),i}setStyle(e){return Yr.setStyle(this,e),this}setAttribute(e,t){return super.setAttribute(e,t),this}setAttributes(e){return Yr.setAttribs(this,e),this}addClass(...e){return e.forEach((e=>this.classList.add(e))),this}removeClass(...e){return e.forEach((e=>this.classList.remove(e))),this}setClass(e,t){return t?this.classList.add(e):this.classList.remove(e),this}hasFocus(){return document.activeElement===this}on(e,t,n){return this.addEventListener(e,t,n),this}off(e,t,n){return this.removeEventListener(e,t,n),this}connectedCallback(){this._isFirstConnected||(this._isFirstConnected=!0,this.firstConnected()),this.connected(),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.disconnected()}createRenderRoot(){return this.shady?super.createRenderRoot():this}firstConnected(){}connected(){}disconnected(){}onUpdate(){this.requestUpdate()}};Jr.tagName="ff-custom-element",Jr.shady=!1,Jr=Yr=Kr([Qr("ff-custom-element")],Jr);const Zr=Jr;function Qr(e){return t=>(t.tagName=e,customElements.define(t.tagName,t),t)}var eo,to=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let no=eo=class extends Zr{constructor(e){super(),this.template=null,this.name=e||""}static add(e,t){if(eo.templates[e])throw new Error(`icon already registered: '${e}'`);eo.templates[e]=t}static getTemplateNames(){return Object.keys(eo.templates)}firstConnected(){this.classList.add("ff-icon")}render(){if(this.name){const e=this.constructor.templates[this.name];return e||console.warn(`icon not found: '${this.name}'`),e}return this.template?this.template:_r`[icon undefined]`}};no.templates={},to([Or({attribute:!1})],no.prototype,"template",void 0),to([Or({type:String})],no.prototype,"name",void 0),no=eo=to([Qr("ff-icon")],no);const io=no;no.add("empty",_r``),no.add("check",_r``),no.add("close",_r``),no.add("grip",_r``),no.add("up",_r``),no.add("down",_r``),no.add("caret-up",_r``),no.add("caret-down",_r``),no.add("folder",_r``),no.add("file",_r``),no.add("info",_r``),no.add("warning",_r``),no.add("error",_r``),no.add("prompt",_r``);var so,ro=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const oo={info:"ff-info",success:"ff-success",warning:"ff-warning",error:"ff-error"},ao={info:"info",success:"check",warning:"warning",error:"error"},lo={info:2e3,success:2e3,warning:5e3,error:0};let co=so=class extends Zr{constructor(e,t,n){super(),this._handler=0,this.on("transitionend",this.remove.bind(this)),this.message=e||"",this.level=t||"info",this.timeout=void 0!==n?n:lo[this.level];const i=(so.shadowRootNode||document).getElementById(so.stackId);i?i.appendChild(this):console.warn(`element '#${so.stackId}' not found`)}static show(e,t,n){new so(e,t,n)}close(){this._handler>0&&(window.clearTimeout(this._handler),this._handler=0),this.classList.add("ff-out")}firstUpdated(){this.classList.add("ff-notification",oo[this.level]),this.timeout>0&&(this._handler=window.setTimeout((()=>this.close()),this.timeout))}render(){const e=ao[this.level];return _r` +
${this.message}
+ `}onClose(e){e.stopPropagation(),this.close()}};co.stackId="ff-notification-stack",co.shadowRootNode=null,ro([Or({type:String})],co.prototype,"message",void 0),ro([Or({type:String})],co.prototype,"level",void 0),ro([Or({type:Number})],co.prototype,"timeout",void 0),co=so=ro([Qr("ff-notification")],co);const ho=co;let uo;class po{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===uo&&(uo=Vn("canvas")),uo.width=e.width,uo.height=e.height;const n=uo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=uo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Vn("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let e=0;e1)switch(this.wrapS){case Y:e.x=e.x-Math.floor(e.x);break;case K:e.x=e.x<0?0:1;break;case J:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Y:e.y=e.y-Math.floor(e.y);break;case K:e.y=e.y<0?0:1;break;case J:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function go(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?po.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}fo.DEFAULT_IMAGE=void 0,fo.DEFAULT_MAPPING=300,fo.prototype.isTexture=!0;class vo extends Qe{constructor(e,t,n={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new Ln(0,0,e,t),this.scissorTest=!1,this.viewport=new Ln(0,0,e,t),this.texture=new fo(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:te,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=Object.assign({},e.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}function yo(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const s=e[n][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?t[n][i]=s.clone():Array.isArray(s)?t[n][i]=s.slice():t[n][i]=s}}return t}function bo(e){const t={};for(let n=0;n0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}_o.prototype.isShaderMaterial=!0;class wo extends _o{constructor(){super(...arguments),this.isIndexShader=!0,this.uniformsNeedUpdate=!1,this.lights=!1,this.uniforms={index:{value:[0,0,0]}},this.vertexShader=["void main() {"," #include "," #include ","}"].join("\n"),this.fragmentShader=["uniform vec3 index;","void main() {"," gl_FragColor = vec4(index, 1.0);","}"].join("\n")}static indexFromPixel(e){return e[0]+e[1]<<8+e[2]<<16}static zoneFromPixel(e){return e[3]}setIndex(e){const t=e>>16,n=(e>>8)-(t<<8),i=e-(t<<16)-(n<<8),s=this.uniforms.index.value;s[0]=i/255,s[1]=n/255,s[2]=t/255,this.uniformsNeedUpdate=!0}}class So extends _o{constructor(){super(...arguments),this.isPositionShader=!0,this.uniforms={index:{value:0},range:{value:[-1,1]}},this.vertexShader=["varying vec3 vLocalPosition;","void main() {"," #include "," #include "," vLocalPosition = vec3(position);","}"].join("\n"),this.fragmentShader=["uniform float index;","uniform vec2 range;","varying vec3 vLocalPosition;","vec4 toVec4(float v) {"," float vn = (v - range.x) / (range.y - range.x);"," float b0 = floor(vn * 255.0) / 255.0; vn = (vn - b0) * 256.0;"," float b1 = floor(vn * 255.0) / 255.0; vn = (vn - b1) * 256.0;"," float b2 = floor(vn * 255.0) / 255.0; vn = (vn - b2) * 256.0;"," float b3 = floor(vn * 255.0) / 255.0;"," return vec4(clamp(b0, 0.0, 1.0), clamp(b1, 0.0, 1.0), clamp(b2, 0.0, 1.0), clamp(b3, 0.0, 1.0));","}","void main() {"," gl_FragColor = (index == 0.0 ? toVec4(vLocalPosition.x)"," : (index == 1.0 ? toVec4(vLocalPosition.y) : toVec4(vLocalPosition.z)));","}"].join("\n")}}class Mo extends _o{constructor(){super(...arguments),this.isNormalShader=!0,this.uniforms={index:{value:0}},this.vertexShader=["varying vec3 vLocalNormal;","void main() {"," #include "," #include "," #include "," vLocalNormal = vec3(normal);","}"].join("\n"),this.fragmentShader=["uniform vec3 index;","varying vec3 vLocalNormal;","void main() {"," vec3 normal = normalize(vLocalNormal);"," gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);","}"].join("\n")}}const Eo=new Ve,To=new Pn,Co=1e4,Ao=new Lt(new Ve(-1e4,-1e4,-1e4),new Ve(Co,Co,Co));class Po{constructor(e){this.renderer=e,this.pickTextures=[];for(let e=0;e<3;++e)this.pickTextures[e]=new vo(1,1,{stencilBuffer:!1});this.pickBuffer=new Uint8Array(4),this.indexShader=new wo,this.positionShader=new So,this.normalShader=new Mo}static add(e,t){const n=e=>{e.material&&(e.onBeforeRender=function(t,n,i,s,r){r.isIndexShader&&r.setIndex(e.id)})};t?e.traverse((e=>n(e))):n(e)}static remove(e,t){const n=e=>{e.material&&(e.onBeforeRender=null)};t?e.traverse((e=>n(e))):n(e)}pickObject(e,t,n){const i=this.pickIndex(e,t,n);if(i>0)return e.getObjectById(i)}pickIndex(e,t,n){const i=n.viewport;(t=i.updateCamera(t)).layers.disable(1);const s=e.overrideMaterial;e.overrideMaterial=this.indexShader;const r=this.renderer,o=this.pickTextures[0];r.getClearColor(To),i.applyPickViewport(o,n),r.setRenderTarget(o),r.setClearColor(0);const a=r.xr.enabled;r.xr.enabled=!1,r.clear(),r.render(e,t),r.xr.enabled=a,r.setRenderTarget(null),r.setClearColor(To),e.overrideMaterial=s,t.layers.enable(1);const l=this.pickBuffer;return r.readRenderTargetPixels(o,0,0,1,1,l),l[0]+256*l[1]+65536*l[2]}pickPosition(e,t,n,i,s){i=i||Ao,s=s||new Ve;const r=n.viewport;(t=r.updateCamera(t)).layers.disable(1);const o=e.overrideMaterial,a=e.overrideMaterial=this.positionShader,l=this.renderer,c=this.pickTextures;l.getClearColor(To),l.setClearColor(0);for(let s=0;s<3;++s)a.uniforms.index.value=s,a.uniforms.range.value[0]=i.min.getComponent(s),a.uniforms.range.value[1]=i.max.getComponent(s),r.applyPickViewport(c[s],n),l.setRenderTarget(c[s]),l.clear(),l.render(e,t);l.setRenderTarget(null),l.setClearColor(To),e.overrideMaterial=o,t.layers.enable(1);const h=this.pickBuffer;for(let e=0;e<3;++e)l.readRenderTargetPixels(c[e],0,0,1,1,h),s.setComponent(e,2.337437050015319e-10*h[3]+5.983838848039216e-8*h[2]+1531862745098039e-20*h[1]+.003921568627451*h[0]);return i.getSize(Eo),s.multiply(Eo).add(i.min)}pickNormal(e,t,n,i){i=i||new Ve;const s=n.viewport;(t=s.updateCamera(t)).layers.disable(1);const r=e.overrideMaterial;e.overrideMaterial=this.normalShader;const o=this.renderer,a=this.pickTextures[0];o.getClearColor(To),s.applyPickViewport(a,n),o.setRenderTarget(a),o.setClearColor(0),o.clear(),o.render(e,t),o.setRenderTarget(null),o.setClearColor(To),e.overrideMaterial=r,t.layers.enable(1);const l=this.pickBuffer;return o.readRenderTargetPixels(a,0,0,1,1,l),i.set(l[0]/255*2-1,l[1]/255*2-1,l[2]/255*2-1).normalize()}}class Ro extends ft{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}Ro.prototype.isScene=!0;const Lo={view:null,viewport:null,renderer:null,scene:null,camera:null},No={type:"before-render",component:null,context:Lo},Do={type:"after-render",component:null,context:Lo},Oo={activate:D("Scene.Activate")};class Io extends Rt{constructor(e,t){super(e,t),this._activeCameraComponent=null,this._preRenderList=[],this._postRenderList=[],this._renderListsNeedUpdate=!0,this.ins=this.addInputs(Oo,0),this.addEvents("before-render","after-render","active-camera")}get scene(){return this.object3D}get activeCameraComponent(){return this._activeCameraComponent}set activeCameraComponent(e){if(e!==this._activeCameraComponent){const t=this._activeCameraComponent;this._activeCameraComponent=e;const n={type:"active-camera",previous:t,next:e};this.emit(n)}}get activeCamera(){return this._activeCameraComponent?this._activeCameraComponent.camera:null}get renderer(){return this.getMainComponent(Ae)}create(){super.create(),this.on("hierarchy",this.shouldUpdateRenderLists,this),this.on("child",this.shouldUpdateRenderLists,this);const e=this.renderer;e&&!e.activeSceneComponent&&(e.activeSceneComponent=this)}update(e){if(super.update(e),this.ins.activate.changed){const e=this.renderer;e&&(e.activeSceneComponent=this)}return!0}tick(e){return this._renderListsNeedUpdate&&(this.updateRenderLists(),this._renderListsNeedUpdate=!1),!1}dispose(){const e=this.renderer;e&&e.activeSceneComponent===this&&(e.activeSceneComponent=null),this.off("hierarchy",this.shouldUpdateRenderLists,this),this.off("child",this.shouldUpdateRenderLists,this),super.dispose()}preRender(e){const t=this._preRenderList;for(let n=0,i=t.length;n(e.preRender&&this._preRenderList.push(e),e.postRender&&this._postRenderList.push(e),!1))),this.changed=!0}_onBeforeRender(e,t,n){Lo.view=e.__view,Lo.viewport=e.__viewport,Lo.renderer=e,Lo.scene=t,Lo.camera=n,this.preRender(Lo),No.component=this,this.emit(No)}_onAfterRender(e,t,n){Lo.view=e.__view,Lo.viewport=e.__viewport,Lo.renderer=e,Lo.scene=t,Lo.camera=n,this.postRender(Lo),Do.component=this,this.emit(Do)}}Io.typeName="CScene",Io.isGraphSingleton=!0;const ko=new Ve;class zo extends j{constructor(e,t){super(e,t),this.ins=this.addInputs(zo.object3DIns),this.outs=this.addOutputs(zo.object3DOuts),this._object3D=null,this._isPickable=!1,this.addEvent("object"),this.node.components.on(this.parentComponentClass,this._onParent,this)}get parentComponentClass(){return this.constructor.parentComponentClass}get parentComponent(){return this.node.components.get(this.parentComponentClass,!0)}get transform(){return this.node.components.get(Rt,!0)}get scene(){const e=this.transform;return e?e.getParentComponent(Io,!0):void 0}get object3D(){return this._object3D}set object3D(e){const t=this._object3D;if(t&&(t.userData.component=null,this.unregisterPickableObject3D(t,!0),t.parent&&this.onRemoveFromParent(t.parent)),this.emit({type:"object",current:t,next:e}),this._object3D=e,e){e.userData.component=this,e.matrixAutoUpdate=!1,e.visible=this.ins.visible.value,this.registerPickableObject3D(e,!0);const t=this.parentComponent;t&&this.onAddToParent(t.object3D)}}update(e){const{visible:t,pickable:n}=this.ins;return t.changed&&this._object3D&&(this._object3D.visible=t.value),n.changed&&n.value!==this._isPickable&&(this._isPickable=n.value,n.value?this.enablePointerEvents():this.disablePointerEvents()),!0}dispose(){this.object3D=null,this.ins.pickable.value&&this.disablePointerEvents(),this.node.components.off(this.parentComponentClass,this._onParent,this),super.dispose()}preRender(e){}postRender(e){}toString(){return super.toString()+(this._object3D?` - type: ${this._object3D.type}`:" - (null)")}onPointer(e){const t=this.outs;"pointer-down"===e.type?(t.pointerDown.set(),t.pointerActive.setValue(!0)):"pointer-up"===e.type&&(t.pointerUp.set(),t.pointerActive.setValue(!1)),e.stopPropagation=!0}enablePointerEvents(){this.on("pointer-down",this.onPointer,this),this.on("pointer-up",this.onPointer,this)}disablePointerEvents(){this.off("pointer-down",this.onPointer,this),this.off("pointer-up",this.onPointer,this);const e=this.outs;e.pointerActive.value&&(e.pointerUp.set(),e.pointerActive.setValue(!1))}updateTransform(){const e=this._object3D;if(!e)return;const{position:t,rotation:n,order:i,scale:s}=this.ins;if(t.changed||n.changed||i.changed||s.changed){e.position.fromArray(t.value),ko.fromArray(n.value).multiplyScalar(Re);const r=i.getOptionText();e.rotation.setFromVector3(ko,r),e.scale.fromArray(s.value),e.updateMatrix()}return!0}onAddToParent(e){e.add(this._object3D)}onRemoveFromParent(e){e.remove(this._object3D)}addObject3D(e){this._object3D.add(e),this.registerPickableObject3D(e,!0)}removeObject3D(e){this.unregisterPickableObject3D(e,!0),this._object3D.remove(e)}registerPickableObject3D(e,t){Po.add(e,t)}unregisterPickableObject3D(e,t){Po.remove(e,t)}_onParent(e){this._object3D&&!this._object3D.parent&&e.add&&this.onAddToParent(e.object.object3D)}}zo.typeName="CObject3D",zo.parentComponentClass=Rt,zo.object3DIns={visible:C("Object.Visible",!0),pickable:C("Object.Pickable")},zo.object3DOuts={pointerDown:D("Pointer.Down"),pointerUp:D("Pointer.Up"),pointerActive:C("Pointer.Active")},zo.transformIns=Rt.transformIns,zo.prototype.preRender=null,zo.prototype.postRender=null;const Uo=new Ve,Vo=new je,Fo=new Ze;new Ue;function Bo(e,t,n){const i=n||new Ue;return Uo.fromArray(e).multiplyScalar(Re),Fo.setFromVector3(Uo,t),i.setFromEuler(Fo),i}function jo(e,t,n){const i=n||[0,0,0];return Fo.setFromQuaternion(e,t),Fo.toVector3(Uo),Uo.multiplyScalar(Le).toArray(i),i}function $o(e){const t=new Map,n=new Map,i=new Map;e.traverse((e=>{const s=e;if(s.isMesh){const e=s.geometry;e&&t.set(e.uuid,e);const r=s.material;if(r){n.set(r.uuid,r);for(let e in r){const t=r[e];t&&t.isTexture&&i.set(t.uuid,t)}}}}));for(let e of i)e[1].dispose();for(let e of n)e[1].dispose();for(let e of t)e[1].dispose()}function Ho(e,t,n){n||(n=e);const i=e.geometry;if(i&&e.visible){let s=e;for(Vo.identity();s&&s!==n;)Vo.premultiply(s.matrix),s=s.parent;if(i.isGeometry){const e=i.vertices;for(let n=0,i=e.length;n 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\n\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\n\t// project rect onto sphere\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\n\t// calculate vector form factor\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n',bumpmap_pars_fragment:"\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",clipping_planes_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\tbool clipped = true;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\tif ( clipped ) discard;\n\n\t#endif\n\n#endif\n",clipping_planes_pars_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n",clipping_planes_pars_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n",clipping_planes_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n",color_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tdiffuseColor *= vColor;\n\n#elif defined( USE_COLOR )\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif\n",color_pars_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_pars_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvColor = vec4( 1.0 );\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvColor = vec3( 1.0 );\n\n#endif\n\n#ifdef USE_COLOR\n\n\tvColor *= color;\n\n#endif\n\n#ifdef USE_INSTANCING_COLOR\n\n\tvColor.xyz *= instanceColor.xyz;\n\n#endif\n",common:"\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n\treturn fract( sin( sn ) * c );\n\n}\n\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t// dir can be either a direction vector or a normal vector\n\t// upper-left 3x3 of matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nmat3 transposeMat3( const in mat3 m ) {\n\n\tmat3 tmp;\n\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\n\treturn tmp;\n\n}\n\n// https://en.wikipedia.org/wiki/Relative_luminance\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\n\treturn dot( weights, color.rgb );\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n\treturn m[ 2 ][ 3 ] == - 1.0;\n\n}\n\nvec2 equirectUv( in vec3 dir ) {\n\n\t// dir is assumed to be unit length\n\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\treturn vec2( u, v );\n\n}\n",cube_uv_reflection_fragment:"\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\n\t// These shader functions convert between the UV coordinates of a single face of\n\t// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n\t// sampling a textureCube (not generally normalized ).\n\n\tfloat getFace( vec3 direction ) {\n\n\t\tvec3 absDirection = abs( direction );\n\n\t\tfloat face = - 1.0;\n\n\t\tif ( absDirection.x > absDirection.z ) {\n\n\t\t\tif ( absDirection.x > absDirection.y )\n\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t} else {\n\n\t\t\tif ( absDirection.z > absDirection.y )\n\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t}\n\n\t\treturn face;\n\n\t}\n\n\t// RH coordinate system; PMREM face-indexing convention\n\tvec2 getUV( vec3 direction, float face ) {\n\n\t\tvec2 uv;\n\n\t\tif ( face == 0.0 ) {\n\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n\n\t\t} else if ( face == 1.0 ) {\n\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n\n\t\t} else if ( face == 2.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n\n\t\t} else if ( face == 3.0 ) {\n\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n\n\t\t} else if ( face == 4.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n\n\t\t} else {\n\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n\n\t\t}\n\n\t\treturn 0.5 * ( uv + 1.0 );\n\n\t}\n\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\n\t\tfloat face = getFace( direction );\n\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\n\t\tfloat faceSize = exp2( mipInt );\n\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\n\t\tif ( face > 2.0 ) {\n\n\t\t\tuv.y += faceSize;\n\n\t\t\tface -= 3.0;\n\n\t\t}\n\n\t\tuv.x += face * faceSize;\n\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\n\t\t}\n\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\n\t\tuv *= texelSize;\n\n\t\treturn texture2D( envMap, uv ).rgb;\n\n\t}\n\n\t// These defines must match with PMREMGenerator\n\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\n\tfloat roughnessToMip( float roughness ) {\n\n\t\tfloat mip = 0.0;\n\n\t\tif ( roughness >= r1 ) {\n\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\n\t\t} else if ( roughness >= r4 ) {\n\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\n\t\t} else if ( roughness >= r5 ) {\n\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\n\t\t} else if ( roughness >= r6 ) {\n\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\n\t\t} else {\n\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25\n\t\t}\n\n\t\treturn mip;\n\n\t}\n\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\n\t\tfloat mipF = fract( mip );\n\n\t\tfloat mipInt = floor( mip );\n\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\n\t\tif ( mipF == 0.0 ) {\n\n\t\t\treturn vec4( color0, 1.0 );\n\n\t\t} else {\n\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\n\t\t}\n\n\t}\n\n#endif\n",defaultnormal_vertex:"\nvec3 transformedNormal = objectNormal;\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// shear transforms in the instance matrix are not supported\n\n\tmat3 m = mat3( instanceMatrix );\n\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\n\ttransformedNormal = m * transformedNormal;\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#ifdef FLIP_SIDED\n\n\t\ttransformedTangent = - transformedTangent;\n\n\t#endif\n\n#endif\n",displacementmap_pars_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",displacementmap_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n\n#endif\n",emissivemap_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n",emissivemap_pars_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",encodings_fragment:"\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\n\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\n\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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 );\n}\n\n",envmap_fragment:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",envmap_common_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif\n",envmap_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n",envmap_pars_vertex:"\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n",envmap_physical_pars_fragment:"\n#if defined( USE_ENVMAP )\n\n\t#ifdef ENVMAP_MODE_REFRACTION\n\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 reflectVec;\n\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\n\t\t\t\t// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t\t#else\n\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\n\t\t\t#endif\n\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n#endif\n",envmap_vertex:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\n\n\tvFogDepth = - mvPosition.z;\n\n#endif\n",fog_pars_vertex:"\n#ifdef USE_FOG\n\n\tvarying float vFogDepth;\n\n#endif\n",fog_fragment:"\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",fog_pars_fragment:"\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n",gradientmap_pars_fragment:"\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\n\t#else\n\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\n\t#endif\n\n}\n",lightmap_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tlightMapIrradiance *= PI;\n\n\t#endif\n\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n\n#endif\n",lightmap_pars_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n",lights_lambert_vertex:"\nvec3 diffuse = vec3( 1.0 );\n\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\n\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\n\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\n\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n#ifdef DOUBLE_SIDED\n\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n\n#endif\n\n#if NUM_POINT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_SPOT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_DIR_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_HEMI_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n",lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\treturn irradiance;\n\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\n\t\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t\t// page 32, equation 26: E[window1]\n\t\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\t\tif ( cutoffDistance > 0.0 ) {\n\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t\t}\n\n\t\treturn distanceFalloff;\n\n\t#else\n\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t\t}\n\n\t\treturn 1.0;\n\n\t#endif\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",lights_toon_fragment:"\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\n",lights_toon_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct ToonMaterial {\n\n\tvec3 diffuseColor;\n\n};\n\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_phong_fragment:"\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\n\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n\n#ifdef IOR\n\n\t#ifdef SPECULAR\n\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\n\t\t#endif\n\n\t\t#ifdef USE_SPECULARCOLORMAP\n\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\n\t\t#endif\n\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\n\t#else\n\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\n\t#endif\n\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheenColor;\n\n\t#ifdef USE_SHEENCOLORMAP\n\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\n\t#endif\n\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\n\t#ifdef USE_SHEENROUGHNESSMAP\n\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\n\t#endif\n\n#endif\n",lights_physical_pars_fragment:'\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\n\n// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from \n// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found\n// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\n\treturn saturate( DG * RECIPROCAL_PI );\n\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\n\treturn fab;\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid 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 ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\n\t#endif\n\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\n\t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n',lights_fragment_begin:"\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tlightMapIrradiance *= PI;\n\n\t\t#endif\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\n\t#endif\n\n#endif\n",lights_fragment_end:"\n#if defined( RE_IndirectDiffuse )\n\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n\n#endif\n",logdepthbuf_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n",logdepthbuf_pars_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_pars_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\n\t#else\n\n\t\tuniform float logDepthBufFC;\n\n\t#endif\n\n#endif\n",logdepthbuf_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n\t#else\n\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\n\t\t\tgl_Position.z *= gl_Position.w;\n\n\t\t}\n\n\t#endif\n\n#endif\n",map_fragment:"\n#ifdef USE_MAP\n\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved)\n\n\t\tsampledDiffuseColor = 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 );\n\n\t#endif\n\n\tdiffuseColor *= sampledDiffuseColor;\n\n#endif\n",map_pars_fragment:"\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",map_particle_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, uv );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n",map_particle_pars_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tuniform mat3 uvTransform;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n",metalnessmap_pars_fragment:"\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n",morphnormal_vertex:"\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\n\t\t}\n\n\t#else\n\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\n\t#endif\n\n#endif\n",morphtarget_pars_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\tuniform float morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\n\t\t}\n\n\t#else\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\n\t\t#else\n\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",morphtarget_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\n\t\t\t#endif\n\n\t\t}\n\n\t#else\n\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",normal_fragment_begin:"\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n\n\t// Workaround for Adreno GPUs not able to do dFdx( vViewPosition )\n\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\t#ifdef USE_TANGENT\n\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\n\t\t#endif\n\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 geometryNormal = normal;\n\n",normal_fragment_maps:"\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( TANGENTSPACE_NORMALMAP )\n\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tnormal = normalize( vTBN * mapN );\n\n\t#else\n\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\n\t#endif\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n\n#endif\n",normal_pars_fragment:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_pars_vertex:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_vertex:"\n#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n",normalmap_pars_fragment:"\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\n\t// Normal Mapping Without Precomputed Tangents\n\t// http://www.thetenthplanet.de/archives/1180\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 N = surf_norm; // normalized\n\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\n\t}\n\n#endif\n",clearcoat_normal_fragment_begin:"\n#ifdef USE_CLEARCOAT\n\n\tvec3 clearcoatNormal = geometryNormal;\n\n#endif\n",clearcoat_normal_fragment_maps:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\n\t#else\n\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\n\t#endif\n\n#endif\n",clearcoat_pars_fragment:"\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n",output_fragment:"\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n\n// https://github.com/mrdoob/three.js/pull/22425\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\n\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n",packing:"\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\n\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\n\nconst float ShiftRight8 = 1. / 256.;\n\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\n\treturn r * PackUpscale;\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\n\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\n\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"\n#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n",dithering_pars_fragment:"\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift acording to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n",roughnessmap_fragment:"\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n",roughnessmap_pars_fragment:"\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n",shadowmap_pars_fragment:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): create uniforms for area light shadows\n\n\t#endif\n\t*/\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n\t}\n\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n\t\tfloat occlusion = 1.0;\n\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\n\t\tfloat hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n\t\tif (hard_shadow != 1.0 ) {\n\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality\n\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n\t\t}\n\t\treturn occlusion;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#else // no percentage-closer filtering:\n\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn shadow;\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// dp = normalized distance from light to fragment position\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n\t\tdp += shadowBias;\n\n\t\t// bd3D = base direction 3D\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#else // no percentage-closer filtering\n\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t#endif\n\n\t}\n\n#endif\n",shadowmap_pars_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n",shadowmap_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n",shadowmask_pars_fragment:"\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n",skinbase_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif\n",skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",skinning_vertex:"\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",skinnormal_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",specularmap_fragment:"\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n",specularmap_pars_fragment:"\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n",tonemapping_fragment:"\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",tonemapping_pars_fragment:"\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nvec3 RRTAndODTFit( vec3 v ) {\n\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n\n}\n\n// this implementation of ACES is modified to accommodate a brighter viewing environment.\n// the scale factor of 1/0.6 is subjective. see discussion in #19621.\n\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\n\tcolor *= toneMappingExposure / 0.6;\n\n\tcolor = ACESInputMat * color;\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( color );\n\n\tcolor = ACESOutputMat * color;\n\n\t// Clamp to [0, 1]\n\treturn saturate( color );\n\n}\n\nvec3 CustomToneMapping( vec3 color ) { return color; }\n",transmission_fragment:"\n#ifdef USE_TRANSMISSION\n\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\n\t#endif\n\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif\n",transmission_pars_fragment:"\n#ifdef USE_TRANSMISSION\n\n\t// Transmission code is based on glTF-Sampler-Viewer\n\t// https://github.com/KhronosGroup/glTF-Sample-Viewer\n\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tuniform sampler2D transmissionMap;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tuniform sampler2D thicknessMap;\n\n\t#endif\n\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\n\tvarying vec3 vWorldPosition;\n\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\n\t\t// Direction of refracted light.\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\n\t\t// Compute rotation-independant scaling of the model matrix.\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t// The thickness is specified in local space.\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\n\t}\n\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\n\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\n\t}\n\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\n\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\n\t\t#else\n\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\n\t\t#endif\n\n\t}\n\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tif ( attenuationDistance == 0.0 ) {\n\n\t\t\t// Attenuation distance is +∞ (which we indicate by zero), i.e. the transmitted color is not attenuated at all.\n\t\t\treturn radiance;\n\n\t\t} else {\n\n\t\t\t// Compute light attenuation using Beer's law.\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law\n\t\t\treturn transmittance * radiance;\n\n\t\t}\n\n\t}\n\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\n\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\n\t\t// Get the specular component.\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\n\t}\n#endif\n",uv_pars_fragment:"\n#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\n\tvarying vec2 vUv;\n\n#endif\n",uv_pars_vertex:"\n#ifdef USE_UV\n\n\t#ifdef UVS_VERTEX_ONLY\n\n\t\tvec2 vUv;\n\n\t#else\n\n\t\tvarying vec2 vUv;\n\n\t#endif\n\n\tuniform mat3 uvTransform;\n\n#endif\n",uv_vertex:"\n#ifdef USE_UV\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n",uv2_pars_fragment:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif\n",uv2_pars_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n\tuniform mat3 uv2Transform;\n\n#endif\n",uv2_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n\n#endif\n",worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n",background_vert:"\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n",background_frag:"\nuniform sampler2D t2D;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tgl_FragColor = texture2D( t2D, vUv );\n\n\t#include \n\t#include \n\n}\n",cube_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",cube_frag:"\n#include \nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include \n\t#include \n\n}\n",depth_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n",depth_frag:"\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n",distanceRGBA_vert:"\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n",distanceRGBA_frag:"\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main () {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include \n\t#include \n\t#include \n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n",equirect_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n}\n",equirect_frag:"\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV = equirectUv( direction );\n\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t#include \n\t#include \n\n}\n",linedashed_vert:"\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",linedashed_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\n\t#endif\n\n\t#include \n\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\n\t#else\n\n\t\treflectedLight.directDiffuse = vLightFront;\n\n\t#endif\n\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\n\t// modulation\n\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshmatcap_vert:"\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n",meshmatcap_frag:"\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshnormal_vert:"\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n",meshnormal_frag:"\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\n\t#ifdef OPAQUE\n\n\t\tgl_FragColor.a = 1.0;\n\n\t#endif\n\n}\n",meshphong_vert:"\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphong_frag:"\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n",meshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_vert:"\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_frag:"\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_vert:"\nuniform float size;\nuniform float scale;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",shadow_vert:"\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",shadow_frag:"\nuniform vec3 color;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_vert:"\nuniform float rotation;\nuniform vec2 center;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"},ea={common:{diffuse:{value:new Pn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new tt},uv2Transform:{value:new tt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new sn(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tt}},sprite:{diffuse:{value:new Pn(16777215)},opacity:{value:1},center:{value:new sn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tt}}},ta={basic:{uniforms:bo([ea.common,ea.specularmap,ea.envmap,ea.aomap,ea.lightmap,ea.fog]),vertexShader:Qo.meshbasic_vert,fragmentShader:Qo.meshbasic_frag},lambert:{uniforms:bo([ea.common,ea.specularmap,ea.envmap,ea.aomap,ea.lightmap,ea.emissivemap,ea.fog,ea.lights,{emissive:{value:new Pn(0)}}]),vertexShader:Qo.meshlambert_vert,fragmentShader:Qo.meshlambert_frag},phong:{uniforms:bo([ea.common,ea.specularmap,ea.envmap,ea.aomap,ea.lightmap,ea.emissivemap,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.fog,ea.lights,{emissive:{value:new Pn(0)},specular:{value:new Pn(1118481)},shininess:{value:30}}]),vertexShader:Qo.meshphong_vert,fragmentShader:Qo.meshphong_frag},standard:{uniforms:bo([ea.common,ea.envmap,ea.aomap,ea.lightmap,ea.emissivemap,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.roughnessmap,ea.metalnessmap,ea.fog,ea.lights,{emissive:{value:new Pn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qo.meshphysical_vert,fragmentShader:Qo.meshphysical_frag},toon:{uniforms:bo([ea.common,ea.aomap,ea.lightmap,ea.emissivemap,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.gradientmap,ea.fog,ea.lights,{emissive:{value:new Pn(0)}}]),vertexShader:Qo.meshtoon_vert,fragmentShader:Qo.meshtoon_frag},matcap:{uniforms:bo([ea.common,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.fog,{matcap:{value:null}}]),vertexShader:Qo.meshmatcap_vert,fragmentShader:Qo.meshmatcap_frag},points:{uniforms:bo([ea.points,ea.fog]),vertexShader:Qo.points_vert,fragmentShader:Qo.points_frag},dashed:{uniforms:bo([ea.common,ea.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qo.linedashed_vert,fragmentShader:Qo.linedashed_frag},depth:{uniforms:bo([ea.common,ea.displacementmap]),vertexShader:Qo.depth_vert,fragmentShader:Qo.depth_frag},normal:{uniforms:bo([ea.common,ea.bumpmap,ea.normalmap,ea.displacementmap,{opacity:{value:1}}]),vertexShader:Qo.meshnormal_vert,fragmentShader:Qo.meshnormal_frag},sprite:{uniforms:bo([ea.sprite,ea.fog]),vertexShader:Qo.sprite_vert,fragmentShader:Qo.sprite_frag},background:{uniforms:{uvTransform:{value:new tt},t2D:{value:null}},vertexShader:Qo.background_vert,fragmentShader:Qo.background_frag},cube:{uniforms:bo([ea.envmap,{opacity:{value:1}}]),vertexShader:Qo.cube_vert,fragmentShader:Qo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qo.equirect_vert,fragmentShader:Qo.equirect_frag},distanceRGBA:{uniforms:bo([ea.common,ea.displacementmap,{referencePosition:{value:new Ve},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qo.distanceRGBA_vert,fragmentShader:Qo.distanceRGBA_frag},shadow:{uniforms:bo([ea.lights,ea.fog,{color:{value:new Pn(0)},opacity:{value:1}}]),vertexShader:Qo.shadow_vert,fragmentShader:Qo.shadow_frag}};var na,ia,sa,ra,oa;ta.physical={uniforms:bo([ta.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new sn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Pn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new sn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Pn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Pn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Qo.meshphysical_vert,fragmentShader:Qo.meshphysical_frag},function(e){e[e.Default=0]="Default",e[e.Clay=1]="Clay",e[e.XRay=2]="XRay",e[e.Normals=3]="Normals",e[e.Wireframe=4]="Wireframe"}(na||(na={})),function(e){e[e.Solid=0]="Solid",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient"}(ia||(ia={})),function(e){e[e.Orbit=0]="Orbit",e[e.Walk=1]="Walk"}(sa||(sa={})),function(e){e[e.Overlay=0]="Overlay",e[e.Left=1]="Left",e[e.Right=2]="Right"}(ra||(ra={})),function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(oa||(oa={}));const aa=n(8669).Z,la=n(9849).Z;class ca extends Zo{constructor(e){super(),this._clayColor=new Pn("#a67a6c"),this._wireColor=new Pn("#004966"),this._wireEmissiveColor=new Pn("#004966"),this._objectSpaceNormalMap=!1,this._paramCopy={},this._sideCopy=0,this.type="UberPBRMaterial",this.isUberPBRMaterial=!0,this.isMeshStandardMaterial=!0,this.isMeshPhysicalMaterial=!1,this.defines={STANDARD:!0,PHYSICAL:!1,OBJECTSPACE_NORMALMAP:!1,MODE_NORMALS:!1,MODE_XRAY:!1,CUT_PLANE:!1,USE_ZONEMAP:!1},this.uniforms=xo.merge([ta.standard.uniforms,{aoMapMix:{value:new Ve(.25,.25,.25)},cutPlaneDirection:{value:new Ln(0,0,-1,0)},cutPlaneColor:{value:new Ve(1,0,0)},zoneMap:{value:null}}]),this._aoMapMix=this.uniforms.aoMapMix.value,this._cutPlaneDirection=this.uniforms.cutPlaneDirection.value,this._cutPlaneColor=this.uniforms.cutPlaneColor.value,this._zoneMap=this.uniforms.zoneMap.value,this.vertexShader=la,this.fragmentShader=aa,this.color=new Pn(16777215),this.roughness=.7,this.metalness=0,e&&this.setValues(e)}set cutPlaneDirection(e){this._cutPlaneDirection.copy(e)}get cutPlaneDirection(){return this._cutPlaneDirection}set cutPlaneColor(e){this._cutPlaneColor.copy(e)}get cutPlaneColor(){return this._cutPlaneColor}set aoMapMix(e){this._aoMapMix.copy(e)}get aoMapMix(){return this._aoMapMix}set zoneMap(e){this._zoneMap=e,this.uniforms.zoneMap.value=e,this.needsUpdate=!0}get zoneMap(){return this._zoneMap}setShaderMode(e){switch(Object.assign(this,this._paramCopy),this.defines.MODE_NORMALS=!1,this.defines.MODE_XRAY=!1,this.defines.OBJECTSPACE_NORMALMAP=!(!this.normalMap||!this._objectSpaceNormalMap),this.side=this.defines.CUT_PLANE?2:this.side,this.needsUpdate=!0,e){case na.Clay:this._paramCopy={color:this.color,map:this.map,roughness:this.roughness,metalness:this.metalness,aoMapIntensity:this.aoMapIntensity,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.color=this._clayColor,this.map=null,this.roughness=1,this.metalness=0,this.aoMapIntensity*=1,this.blending=0,this.transparent=!1,this.depthWrite=!0;break;case na.Normals:this._paramCopy={blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_NORMALS=!0,this.blending=0,this.transparent=!1,this.depthWrite=!0;break;case na.XRay:this._paramCopy={side:this.side,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_XRAY=!0,this.side=2,this.blending=2,this.transparent=!0,this.depthWrite=!1;break;case na.Wireframe:this._paramCopy={color:this.color,emissive:this.emissive,roughness:this.roughness,metalness:this.metalness,wireframe:this.wireframe,map:this.map,aoMap:this.aoMap,emissiveMap:this.emissiveMap,normalMap:this.normalMap},this.color=this._wireColor,this.emissive=this._wireEmissiveColor,this.roughness=.8,this.metalness=.1,this.wireframe=!0,this.map=null,this.aoMap=null,this.emissiveMap=null,this.normalMap=null,this.defines.OBJECTSPACE_NORMALMAP=!1}}enableCutPlane(e){this.defines.CUT_PLANE=e,e?(this._sideCopy=this.side,this.side=2):this.side=this._sideCopy}enableObjectSpaceNormalMap(e){e!==this._objectSpaceNormalMap&&(this._objectSpaceNormalMap=e),this.normalMap&&(this.defines.OBJECTSPACE_NORMALMAP=e,this.needsUpdate=!0)}enableZoneMap(e){this.defines.USE_ZONEMAP=e}copyStandardMaterial(e){return this.color=e.color,this.opacity=e.opacity,this.transparent=e.opacity<1||!!e.alphaMap||e.transparent,this.alphaTest=e.alphaTest,this.roughness=e.roughness,this.roughnessMap=e.roughnessMap,this.metalness=e.metalness,this.metalnessMap=e.metalnessMap,this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.normalMap=e.normalMap,this.shadowSide=e.shadowSide,this.flatShading=e.flatShading,this}}class ha extends o{constructor(e){super(),this.addEvents("update","dispose"),e?this.fromJSON(e):this._data=this.init()}static generateId(){return I()}get id(){return this._data.id}get data(){return this._data}set(e,t){this._data[e]=t,this.update()}get(e){return this._data[e]}update(){this.emit({type:"update",document:this})}dispose(){this.emit({type:"dispose",document:this}),this._data=null}fromJSON(e){return this._data={},this.inflate(e,this._data),this.update(),this}toJSON(e){return e=e||{},this.deflate(this._data,e),e}init(){return{}}inflate(e,t){Object.assign(t,e)}deflate(e,t){t=t||{},Object.assign(t,this._data)}}class ua extends ha{setModel(e){this.data.uri=e,this.data.type=qo.Model,this.data.mimeType=this.guessAssetMimeType()}setGeometry(e){this.data.uri=e,this.data.type=qo.Geometry,this.data.mimeType=this.guessAssetMimeType()}setTexture(e,t){this.data.uri=e,this.data.type=qo.Image,this.data.mimeType=this.guessAssetMimeType(),this.data.mapType=t}isValid(){return!!this.data.uri&&void 0!==this.data.type}toString(){const e=this.data;return`Asset - type: '${qo[e.type]}', uri: '${e.uri}', mime type: '${e.mimeType||"(not set)"}'`}init(){return{uri:"",mimeType:"",type:void 0,mapType:void 0,byteSize:0,numFaces:0,numVertices:0,imageSize:0}}deflate(e,t){t.uri=e.uri,t.type=qo[e.type],e.mimeType&&(t.mimeType=e.mimeType),void 0!==e.mapType&&(t.mapType=Xo[e.mapType]),e.byteSize>0&&(t.byteSize=e.byteSize),e.type!==qo.Model&&e.type!==qo.Geometry||e.numFaces>0&&(t.numFaces=e.numFaces),e.type!==qo.Model&&e.type!==qo.Image&&e.type!==qo.Texture||e.imageSize>0&&(t.imageSize=e.imageSize)}inflate(e,t){t.uri=e.uri,t.mimeType=e.mimeType||"",t.type=qo[e.type],t.mapType=Xo[e.mapType],t.byteSize=e.byteSize||0,t.numFaces=e.numFaces||0,t.imageSize=e.imageSize||0,void 0===t.type&&(t.type=this.guessAssetType(),void 0===t.type&&console.warn(`failed to determine asset type from asset: ${t.uri}`))}guessAssetType(){const e=this.data;if(void 0!==e.type&&qo[e.type])return e.type;if(e.mimeType){if(e.mimeType===ua.mimeType.gltfJson||e.mimeType===ua.mimeType.gltfBinary)return qo.Model;if(e.mimeType===ua.mimeType.imageJpeg||e.mimeType===ua.mimeType.imagePng)return qo.Image}const t=e.uri.split(".").pop().toLowerCase();return"gltf"===t||"glb"===t?qo.Model:"obj"===t||"ply"===t?qo.Geometry:"jpg"===t||"png"===t?qo.Image:void 0}guessAssetMimeType(){const e=this.data;if(e.mimeType)return e.mimeType;const t=e.uri.split(".").pop().toLowerCase();return"gltf"===t?ua.mimeType.gltfJson:"glb"===t?ua.mimeType.gltfBinary:"jpg"===t?ua.mimeType.imageJpeg:"png"===t?ua.mimeType.imagePng:""}}ua.mimeType={gltfJson:"model/gltf+json",gltfBinary:"model/gltf-binary",imageJpeg:"image/jpeg",imagePng:"image/png"};class da extends ha{constructor(){super(...arguments),this.model=null}static fromJSON(e){return new da(e)}dispose(){this.unload(),super.dispose()}load(e){if(this.data.usage!==Go.Web3D)throw new Error("can't load, not a Web3D derivative");const t=this.findAsset(qo.Model);if(t)return e.getModel(t.data.uri).then((e=>(this.model&&$o(this.model),this.model=e,e)));const n=this.findAsset(qo.Geometry),i=this.findAssets(qo.Image);return n?e.getGeometry(n.data.uri).then((t=>(this.model=new ui(t,new ca),Promise.all(i.map((t=>e.getTexture(t.data.uri)))).catch((e=>(console.warn("failed to load texture files"),[])))))).then((e=>{const t=this.model.material;return this.assignTextures(i,e,t),t.map||(t.color.setScalar(.5),t.roughness=.8,t.metalness=0),this.model})):void 0}unload(){this.model&&($o(this.model),this.model=null)}createAsset(e,t){const n=new ua;return n.data.type=e,n.data.uri=t,this.addAsset(n),n}addAsset(e){if(!e.data.uri)throw new Error("uri must be specified");this.data.assets.push(e),this.update()}removeAsset(e){const t=this.data.assets.indexOf(e);t>=0&&this.data.assets.splice(t,1)}findAsset(e){return this.data.assets.find((t=>t.data.type===e))}findAssets(e){return this.data.assets.filter((t=>t.data.type===e))}toString(e=!1){const t=this.data;return e?`Derivative - usage: '${Go[t.usage]}', quality: '${Wo[t.quality]}'\n `+t.assets.map((e=>e.toString())).join("\n "):`Derivative - usage: '${Go[t.usage]}', quality: '${Wo[t.quality]}', #assets: ${t.assets.length})`}init(){return{usage:Go.Web3D,quality:Wo.Medium,assets:[]}}deflate(e,t){t.usage=Go[e.usage],t.quality=Wo[e.quality],t.assets=e.assets.map((e=>e.toJSON()))}inflate(e,t){if(t.usage=Go[e.usage],void 0===t.usage)throw new Error(`unknown derivative usage: ${e.usage}`);if(t.quality=Wo[e.quality],void 0===t.quality)throw new Error(`unknown derivative quality: ${e.quality}`);t.assets=e.assets.map((e=>new ua(e)))}assignTextures(e,t,n){for(let i=0;i=0;--t){const n=this.get(e,ma[t]);if(n)return console.warn(`derivative quality '${i}' not available, using lower quality`),n}return console.warn(`no suitable derivative found for quality '${i}' and usage '${n}'`),null}getByUsage(e){const t=Go[e];return(this.derivatives[t]||pa).sort(((e,t)=>e.data.qualityt.data.quality?1:0))}getByQuality(e){return this.getArray().filter((t=>t.data.quality===e))}getArray(){return Object.keys(this.derivatives).reduce(((e,t)=>e.concat(this.derivatives[t])),[])}get(e,t){const n=Go[e],i=this.derivatives[n];if(i)for(let e=0,n=i.length;e-1&&t.splice(i,1)}}createModelAsset(e,t){t="string"==typeof t?Wo[t]:t,t=isFinite(t)?t:Wo.Medium;const n=this.getOrCreate(Go.Web3D,t),i=new ua;return i.setModel(e),n.addAsset(i),n}createMeshAsset(e,t,n,i,s){s="string"==typeof s?Wo[s]:s,s=isFinite(s)?s:Wo.Medium;const r=this.getOrCreate(Go.Web3D,s),o=new ua;if(o.setGeometry(e),r.addAsset(o),t){const e=new ua;e.setTexture(t,Xo.Color),r.addAsset(e)}if(n){const e=new ua;e.setTexture(n,Xo.Occlusion),r.addAsset(e)}if(i){const e=new ua;e.setTexture(i,Xo.Normal),r.addAsset(e)}return r}clear(){for(let e in this.derivatives)this.derivatives[e].forEach((e=>e.dispose()));this.derivatives={}}toJSON(){const e=[];for(let t in this.derivatives)this.derivatives[t].forEach((t=>e.push(t.toJSON())));return e}fromJSON(e){this.clear(),e.forEach((e=>{this.getOrCreateBin(Go[e.usage]).push(new da(e))}))}toString(e=!1){const t=this.derivatives,n=Object.keys(t);return e?`Derivatives (${n.length}) \n `+n.map((e=>t[e].map((e=>e.toString(!0))).join("\n "))).join("\n "):`Derivatives (${n.length}) `+n.map((e=>`${e} (${t[e].length})`)).join(", ")}getOrCreateBin(e){const t=Go[e];return this.derivatives[t]||(this.derivatives[t]=[])}}var va=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const ya=new Ve,ba=new Ve,xa=new Ve,_a=new Ve,wa=new sn,Sa=new sn;var Ma;!function(e){e[e.TopRight=0]="TopRight",e[e.TopLeft=1]="TopLeft",e[e.BottomLeft=2]="BottomLeft",e[e.BottomRight=3]="BottomRight"}(Ma||(Ma={}));class Ea extends ft{constructor(){super(),this.isHTMLSprite=!0,this.viewAngle=0,this.orientationAngle=0,this.orientationQuadrant=Ma.TopLeft,this._elements=new Map,this._visible=!0,this.frustumCulled=!1}getVisible(){return this._visible}setVisible(e){e!==this._visible&&this._elements&&(this._visible=e,this._elements.forEach((t=>{t&&t.setVisible(e)})))}dispose(){this._elements.forEach(((e,t)=>{e&&t.removeChild(e)})),this._elements.clear()}disposeHTMLElement(e){const t=this._elements.get(e);t&&(this._elements.delete(e),e.removeChild(t))}update(){this._elements.forEach((e=>{e&&this.updateHTMLElement(e)}))}renderHTMLElement(e,t,n,i,s){i=i||this,ya.set(0,0,0),ya.applyMatrix4(i.modelViewMatrix),s?ba.copy(s):ba.set(0,1,0),ba.applyMatrix4(i.modelViewMatrix),xa.copy(ba).sub(ya).normalize(),_a.set(0,0,1),this.viewAngle=xa.angleTo(_a),ya.applyMatrix4(n.projectionMatrix),ba.applyMatrix4(n.projectionMatrix),Sa.set(ba.x,ba.y),wa.set(ya.x,ya.y),Sa.sub(wa);const r=.5*(ba.x+1)*t.clientWidth,o=.5*(1-ba.y)*t.clientHeight;e.setPosition(r,o);const a=this.orientationAngle=Sa.angle();this.orientationQuadrant=Math.floor(2*a/Math.PI)}getHTMLElement(e){let t=this._elements.get(e);return t||(t=this.createHTMLElement(),t&&(t.setVisible(this._visible),e.appendChild(t),this._elements.set(e,t))),t}createHTMLElement(){return null}updateHTMLElement(e){e.requestUpdate()}}let Ta=class extends Zr{setVisible(e){this.style.display=e?"block":"none"}setOpacity(e){this.style.opacity=e.toString(),this.style.visibility=e>0?"visible":"hidden"}setPosition(e,t){this.style.left=e.toString()+"px",this.style.top=t.toString()+"px"}};Ta=va([Qr("ff-sprite-element")],Ta);class Ca extends ft{constructor(){super(...arguments),this.isHTMLSpriteGroup=!0,this._visible=!0}getVisible(){return this._visible}setVisible(e){if(e!==this._visible){this._visible=e;const t=this.children;for(let n=0,i=t.length;n{e.id&&(this._dict[e.id]=e)}))}get length(){return this._list.length}get ids(){return Object.keys(this._dict)}get items(){return this._list}set items(e){this._list=e,this._dict={},e.forEach((e=>{e.id&&(this._dict[e.id]=e)})),this.emit({type:"update",item:null,what:"update"})}append(e){this._list.push(e),e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"add"})}insertBefore(e,t){const n=this._list.indexOf(t);n>=0&&this.insertAt(e,n)}insertAt(e,t){this._list.splice(t,0,e),e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"add"})}replaceItem(e,t){const n=this._list.indexOf(t);n>=0&&this.replaceAt(e,n)}replaceAt(e,t){const n=this._list[t];n.id&&delete this._dict[n.id],this._list[t]=e,e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"replace"})}moveItem(e,t){const n=this._list.indexOf(e);this.moveAt(n,t)}moveAt(e,t){const n=this._list;if(e+t<0||e+t>=n.length)return;const i=n[e];if(t>0){for(let i=0;it;--i)n[e+i]=n[e+i-1];n[e+t]=i}this.emit({type:"update",item:i,what:"move"})}removeById(e){const t=this._dict[e];return t&&this.removeItem(t),t}removeItem(e){const t=this._list.indexOf(e);return this.removeAt(t),t}removeAt(e){const t=this._list;if(e<0||e>=t.length)return;const n=t[e];return t.splice(e,1),n.id&&delete this._dict[n.id],this.emit({type:"update",item:n,what:"remove"}),n}getAt(e){return this._list[e]}getById(e){return this._dict[e]}getIndexOf(e){return this._list.indexOf(e)}copy(e){this.items=e.slice()}clone(){return this._list.slice()}}Aa.prototype[Symbol.iterator]=function(){return{index:0,list:this._list,next:function(){return this.index{e.id&&(this._dict[e.id]=e)}))}get length(){return this.ids.length}get items(){return this.ids.map((e=>this._dict[e]))}set items(e){e.forEach((e=>{e.id&&(this._dict[e.id]=e)})),this.emit({type:"update",item:null,what:"update"})}get ids(){return Object.keys(this._dict)}get dictionary(){return this._dict}set dictionary(e){this._dict=e,this.emit({type:"update",item:null,what:"update"})}insert(e,t){if(!(t=t||e.id))throw new Error("can't insert, missing id");this._dict[t]=e,this.emit({type:"update",item:e,what:"insert"})}remove(e){const t="string"==typeof e?e:e.id,n=this._dict[t];void 0!==n&&(delete this._dict[t],this.emit({type:"update",item:n,what:"remove"}))}get(e){return this._dict[e]}getOrCreate(e,t){let n=this._dict[e];return n||(n=this._dict[e]=t,this.emit({type:"update",item:n,what:"insert"})),n}copy(e){this.dictionary=Object.assign({},e)}clone(){return Object.assign({},this._dict)}}class Ra extends ha{constructor(){super(...arguments),this._language=vs.EN}static fromJSON(e){return new Ra(e)}toString(){return this.title}get title(){return 0===Object.keys(this.data.titles).length&&(this.data.titles.EN=this.data.title),this.data.titles[vs[this.language]]||"undefined"}set title(e){this.data.titles[vs[this.language]]=e,this.update()}get defaultTitle(){return 0===Object.keys(this.data.titles).length&&(this.data.titles.EN=this.data.title),this.data.titles.EN||"undefined"}get uri(){return 0===Object.keys(this.data.uris).length&&(this.data.uris.EN=this.data.uri),this.data.uris[vs[this.language]]}set uri(e){this.data.uris[vs[this.language]]=e,this.update()}get lead(){return 0===Object.keys(this.data.leads).length&&(this.data.leads.EN=this.data.lead),this.data.leads[vs[this.language]]||""}set lead(e){this.data.leads[vs[this.language]]=e,this.update()}get tags(){return 0===Object.keys(this.data.taglist).length&&this.data.tags.length>0&&(this.data.taglist.EN=this.data.tags),this.data.taglist[vs[this.language]]||[]}set tags(e){this.data.taglist[vs[this.language]]=e,this.update()}get language(){return this._language}set language(e){this._language=e}init(){return{id:ha.generateId(),title:"New Article",titles:{},lead:"",leads:{},tags:[],taglist:{},uri:"",uris:{},mimeType:"",thumbnailUri:""}}deflate(e,t){t.id=e.id,Object.keys(this.data.uris).length>0?(t.uris={},Object.keys(this.data.uris).forEach((n=>{t.uris[n]=e.uris[n]}))):e.uri&&(t.uri=e.uri),Object.keys(this.data.titles).length>0?(t.titles={},Object.keys(this.data.titles).forEach((n=>{t.titles[n]=e.titles[n]}))):e.title&&(t.title=e.title),Object.keys(this.data.leads).length>0?(t.leads={},Object.keys(this.data.leads).forEach((n=>{t.leads[n]=e.leads[n]}))):e.lead&&(t.lead=e.lead),Object.keys(this.data.taglist).length>0?(t.taglist={},Object.keys(this.data.taglist).forEach((n=>{t.taglist[n]=e.taglist[n].slice()}))):e.tags.length>0&&(t.tags=e.tags.slice()),e.mimeType&&(t.mimeType=e.mimeType),e.thumbnailUri&&(t.thumbnailUri=e.thumbnailUri)}inflate(e,t){t.id=e.id,t.uri=e.uri||"",t.uris=e.uris||{},t.title=e.title||"",t.titles=e.titles||{},t.lead=e.lead||"",t.leads=e.leads||{},t.tags=e.tags||[],t.taglist=e.taglist||{},t.mimeType=e.mimeType||"",t.thumbnailUri=e.thumbnailUri||""}}const La=async function(e,t,n){return fetch(e,{headers:{Accept:"text/plain, *","Content-Type":"text/plain"},method:t,credentials:"same-origin",body:n}).then((e=>{if(!e.ok)throw new Error(`status: ${e.status}`);return e.text()})).catch((n=>{throw console.warn(`fetch.text (${t} at '${e}'), error: ${n.message}`),n}))};class Na{constructor(e){this._loadingManager=e}async get(e){return this._loadingManager.itemStart(e),fetch(e,{headers:{Accept:"application/json,*"}}).then((t=>{if(!t.ok)throw this._loadingManager.itemError(e),this._loadingManager.itemEnd(e),new Error(`failed to fetch from '${e}', status: ${t.status} ${t.statusText}`);return this._loadingManager.itemEnd(e),t.json()}))}}class Da{constructor(e,t,n){const i=this;let s,r=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===r&&void 0!==i.onStart&&i.onStart(e,o,a),r=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t{t&&t(s),this.manager.itemEnd(e)}),0),s;if(void 0!==za[e])return void za[e].push({onLoad:t,onProgress:n,onError:i});za[e]=[],za[e].push({onLoad:t,onProgress:n,onError:i});const r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(r).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const n=za[e],i=t.body.getReader(),s=t.headers.get("Content-Length"),r=s?parseInt(s):0,o=0!==r;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:s})=>{if(i)e.close();else{a+=s.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:r});for(let e=0,t=n.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{ka.add(e,t);const n=za[e];delete za[e];for(let e=0,i=n.length;e{const n=za[e];if(void 0===n)throw this.manager.itemError(e),t;delete za[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}const Va=new WeakMap;class Fa extends Ia{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,t,n,i){const s=new Ua(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(e=>{const n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(i)}),n,i)}decodeDracoFile(e,t,n,i){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const e in t.attributeTypes){const n=t.attributeTypes[e];void 0!==n.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=n.name)}const n=JSON.stringify(t);if(Va.has(e)){const t=Va.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,r=e.byteLength,o=this._getWorker(s,r).then((n=>(i=n,new Promise(((n,r)=>{i._callbacks[s]={resolve:n,reject:r},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&s&&this._releaseTask(i,s)})),Va.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new qn;e.index&&t.setIndex(new On(e.index.array,1));for(let n=0;n{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=Ba.toString(),s=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e{const t=e.draco,o=new t.Decoder,a=new t.DecoderBuffer;a.Init(new Int8Array(i),i.byteLength);try{const e=function(e,t,i,s){const r=s.attributeIDs,o=s.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeBufferToMesh(i,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeBufferToPointCloud(i,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in r){const l=self[o[i]];let c,u;if(s.useUniqueIDs)u=r[i],c=t.GetAttributeByUniqueId(a,u);else{if(u=t.GetAttributeId(a,e[r[i]]),-1===u)continue;c=t.GetAttribute(a,u)}h.attributes.push(n(e,t,a,i,l,c))}c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),s=4*i,r=e._malloc(s);t.GetTrianglesUInt32Array(n,s,r);const o=new Uint32Array(e.HEAPF32.buffer,r,i).slice();return e._free(r),{array:o,itemSize:1}}(e,t,a));return e.destroy(a),h}(t,o,a,r),i=e.attributes.map((e=>e.array.buffer));e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(a),t.destroy(o)}}))}}}class ja{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Wa.getNormalMatrix(e),i=this.coplanarPoint(Ha).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}qa.prototype.isPlane=!0;const Xa=new cn,Ya=new Ve;class Ka{constructor(e=new qa,t=new qa,n=new qa,i=new qa,s=new qa,r=new qa){this.planes=[e,t,n,i,s,r]}set(e,t,n,i,s,r){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(r),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],s=n[1],r=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],m=n[11],f=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(o-i,h-a,m-u,y-f).normalize(),t[1].setComponents(o+i,h+a,m+u,y+f).normalize(),t[2].setComponents(o+s,h+l,m+d,y+g).normalize(),t[3].setComponents(o-s,h-l,m-d,y-g).normalize(),t[4].setComponents(o-r,h-c,m-p,y-v).normalize(),t[5].setComponents(o+r,h+c,m+p,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Xa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Xa)}intersectsSprite(e){return Xa.center.set(0,0,0),Xa.radius=.7071067811865476,Xa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xa)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Ya.y=i.normal.y>0?e.max.y:e.min.y,Ya.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ya)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const Ja=new je,Za=new Ve,Qa=new Ve;class el{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new sn(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ka,this._frameExtents=new sn(1,1),this._viewportCount=1,this._viewports=[new Ln(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Za.setFromMatrixPosition(e.matrixWorld),t.position.copy(Za),Qa.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Qa),t.updateMatrixWorld(),Ja.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ja),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class tl extends ft{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new je,this.projectionMatrix=new je,this.projectionMatrixInverse=new je}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}tl.prototype.isCamera=!0;class nl extends tl{constructor(e=-1,t=1,n=1,i=-1,s=.1,r=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,r){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,r=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=e*this.view.offsetX,r=s+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(s,r,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}nl.prototype.isOrthographicCamera=!0;class il extends el{constructor(){super(new nl(-5,5,5,-5,.5,500))}}il.prototype.isDirectionalLightShadow=!0;class sl extends $a{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ft.DefaultUp),this.updateMatrix(),this.target=new ft,this.shadow=new il}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}sl.prototype.isDirectionalLight=!0;class rl extends tl{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Le*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Re*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Le*Math.atan(Math.tan(.5*Re*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,r){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Re*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const r=this.view;if(null!==this.view&&this.view.enabled){const e=r.fullWidth,o=r.fullHeight;s+=r.offsetX*i/e,t-=r.offsetY*n/o,i*=r.width/e,n*=r.height/o}const o=this.filmOffset;0!==o&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}rl.prototype.isPerspectiveCamera=!0;const ol=new je,al=new Ve,ll=new Ve;class cl extends el{constructor(){super(new rl(90,1,.5,500)),this._frameExtents=new sn(4,2),this._viewportCount=6,this._viewports=[new Ln(2,1,1,1),new Ln(0,1,1,1),new Ln(3,1,1,1),new Ln(1,1,1,1),new Ln(3,0,1,1),new Ln(1,0,1,1)],this._cubeDirections=[new Ve(1,0,0),new Ve(-1,0,0),new Ve(0,0,1),new Ve(0,0,-1),new Ve(0,1,0),new Ve(0,-1,0)],this._cubeUps=[new Ve(0,1,0),new Ve(0,1,0),new Ve(0,1,0),new Ve(0,1,0),new Ve(0,0,1),new Ve(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),al.setFromMatrixPosition(e.matrixWorld),n.position.copy(al),ll.copy(n.position),ll.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ll),n.updateMatrixWorld(),i.makeTranslation(-al.x,-al.y,-al.z),ol.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ol)}}cl.prototype.isPointLightShadow=!0;class hl extends $a{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new cl}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}hl.prototype.isPointLight=!0;class ul extends el{constructor(){super(new rl(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=2*Le*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;n===t.fov&&i===t.aspect&&s===t.far||(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}ul.prototype.isSpotLightShadow=!0;class dl extends $a{constructor(e,t,n=0,i=Math.PI/3,s=0,r=1){super(e,t),this.type="SpotLight",this.position.copy(ft.DefaultUp),this.updateMatrix(),this.target=new ft,this.distance=n,this.angle=i,this.penumbra=s,this.decay=r,this.shadow=new ul}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}dl.prototype.isSpotLight=!0;class pl extends Zo{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new sn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return De(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.sheenColor=new Pn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Pn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pn(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}pl.prototype.isMeshPhysicalMaterial=!0;class ml{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let r;n:{i:if(!(e=s)break e;{const o=t[1];e=s)break t}r=n,n=0}}for(;n>>1;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Gl(e,t,n,i,s,r,o){const a=Bl.distanceSqToPoint(e);if(as.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:o})}}Hl.prototype.isPoints=!0;class Wl extends ml{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,r=e+1,o=i[s],a=i[r];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:s=e,o=2*t-n;break;case 2402:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:r=e,a=2*n-t;break;case 2402:r=1,a=n+i[1]-i[0];break;default:r=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(a-n),this._offsetPrev=s*c,this._offsetNext=r*c}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),m=p*p,f=m*p,g=-u*f+2*u*m-u*p,v=(1+u)*f+(-1.5-2*u)*m+(-.5+u)*p+1,y=(-1-d)*f+(1.5+d)*m+.5*p,b=d*f-d*m;for(let e=0;e!==o;++e)s[e]=g*r[c+e]+v*r[l+e]+y*r[a+e]+b*r[h+e];return s}}class ql extends ml{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)s[e]=r[l+e]*h+r[a+e]*c;return s}}class Xl extends ml{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}const Yl={arraySlice:function(e,t,n){return Yl.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,s=new e.constructor(i);for(let r=0,o=0;o!==i;++r){const i=n[r]*t;for(let n=0;n!==t;++n)s[o++]=e[i+n]}return s},flattenJSON:function(e,t,n,i){let s=1,r=e[0];for(;void 0!==r&&void 0===r[i];)r=e[s++];if(void 0===r)return;let o=r[i];if(void 0!==o)if(Array.isArray(o))do{o=r[i],void 0!==o&&(t.push(r.time),n.push.apply(n,o)),r=e[s++]}while(void 0!==r);else if(void 0!==o.toArray)do{o=r[i],void 0!==o&&(t.push(r.time),o.toArray(n,n.length)),r=e[s++]}while(void 0!==r);else do{o=r[i],void 0!==o&&(t.push(r.time),n.push(o)),r=e[s++]}while(void 0!==r)},subclip:function(e,t,n,i,s=30){const r=e.clone();r.name=t;const o=[];for(let e=0;e=i)){l.push(t.times[e]);for(let n=0;nr.tracks[e].times[0]&&(a=r.tracks[e].times[0]);for(let e=0;e=i.times[u]){const e=u*l+a,t=e+l-a;d=Yl.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(r),d=Yl.arraySlice(e.resultBuffer,t,n)}if("quaternion"===s){(new Ue).fromArray(d).normalize().conjugate().toArray(d)}const p=o.times.length;for(let e=0;et;)--r;if(++r,0!==s||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);const e=this.getValueSize();this.times=Yl.arraySlice(n,s,r),this.values=Yl.arraySlice(this.values,s*e,r*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;0===s&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let t=0;t!==s;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==r&&r>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,r),e=!1;break}r=i}if(void 0!==i&&Yl.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=Yl.arraySlice(this.times),t=Yl.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===ye,s=e.length-1;let r=1;for(let o=1;o0){e[r]=e[s];for(let e=s*n,i=r*n,o=0;o!==n;++o)t[i+o]=t[e+o];++r}return r!==e.length?(this.times=Yl.arraySlice(e,0,r),this.values=Yl.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this}clone(){const e=Yl.arraySlice(this.times,0),t=Yl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Kl.prototype.TimeBufferType=Float32Array,Kl.prototype.ValueBufferType=Float32Array,Kl.prototype.DefaultInterpolation=ve;class Jl extends Kl{}Jl.prototype.ValueTypeName="number";class Zl extends ml{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Ue.slerpFlat(s,0,r,l-o,r,l,a);return s}}class Ql extends Kl{InterpolantFactoryMethodLinear(e){return new Zl(this.times,this.values,this.getValueSize(),e)}}Ql.prototype.ValueTypeName="quaternion",Ql.prototype.DefaultInterpolation=ve,Ql.prototype.InterpolantFactoryMethodSmooth=void 0;class ec extends Kl{}ec.prototype.ValueTypeName="vector";class tc extends Kl{}tc.prototype.ValueTypeName="bool",tc.prototype.ValueBufferType=Array,tc.prototype.DefaultInterpolation=ge,tc.prototype.InterpolantFactoryMethodLinear=void 0,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class nc extends Kl{}nc.prototype.ValueTypeName="color";class ic extends Kl{}ic.prototype.ValueTypeName="string",ic.prototype.ValueBufferType=Array,ic.prototype.DefaultInterpolation=ge,ic.prototype.InterpolantFactoryMethodLinear=void 0,ic.prototype.InterpolantFactoryMethodSmooth=void 0;class sc{constructor(e,t=-1,n,i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ne(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,s=n.length;e!==s;++e)t.push(rc(n[e]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(Kl.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,r=[];for(let e=0;e1){const e=r[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const r=[];for(const e in i)r.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return r}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,s){if(0!==n.length){const r=[],o=[];Yl.flattenJSON(n,r,o,i),0!==r.length&&s.push(new e(t,r,o))}},i=[],s=e.name||"default",r=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e=2.0 are supported.")));const l=new oh(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(r),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,s){n.parse(e,t,i,s)}))}}function dc(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const pc={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_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class mc{constructor(e){this.parser=e,this.name=pc.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r,o)}}class Sc{constructor(e){this.parser=e,this.name=pc.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const r=s.extensions[t],o=i.images[r.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(s){if(s)return n.loadTextureImage(e,o,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Mc{constructor(e){this.name=pc.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,s.ready]).then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,r=e.count,o=e.byteStride,a=new ArrayBuffer(r*o),l=new Uint8Array(t[0],n,i);return s.decodeGltfBuffer(new Uint8Array(a),r,o,l,e.mode,e.filter),a}))}return null}}const Ec="glTF",Tc=1313821514,Cc=5130562;class Ac{constructor(e){this.name=pc.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:ja.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ec)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-12,i=new DataView(e,12);let s=0;for(;s",t).replace("#include ",n).replace("#include ",i).replace("#include ",s).replace("#include ",r)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class Nc{constructor(){this.name=pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return Lc}extendParams(e,t,n){const i=t.extensions[this.name];e.color=new Pn(1,1,1),e.opacity=1;const s=[];if(Array.isArray(i.diffuseFactor)){const t=i.diffuseFactor;e.color.fromArray(t),e.opacity=t[3]}if(void 0!==i.diffuseTexture&&s.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new Pn(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Pn(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){const t=i.specularGlossinessTexture;s.push(n.assignTexture(e,"glossinessMap",t)),s.push(n.assignTexture(e,"specularMap",t))}return Promise.all(s)}createMaterial(e){const t=new Lc(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}class Dc{constructor(){this.name=pc.KHR_MESH_QUANTIZATION}}class Oc extends ml{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[s+e];return t}}Oc.prototype.beforeStart_=Oc.prototype.copySampleValue_,Oc.prototype.afterEnd_=Oc.prototype.copySampleValue_,Oc.prototype.interpolate_=function(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-t,h=(n-t)/c,u=h*h,d=u*h,p=e*l,m=p-l,f=-2*d+3*u,g=d-u,v=1-f,y=g-u+h;for(let e=0;e!==o;e++){const t=r[m+e+o],n=r[m+e+a]*c,i=r[p+e+o],l=r[p+e]*c;s[e]=v*t+y*n+f*i+g*l}return s};const Ic=new Ue;class kc extends Oc{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return Ic.fromArray(s).normalize().toArray(s),s}}const zc=0,Uc=1,Vc=2,Fc=3,Bc=4,jc=5,$c=6,Hc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Gc={9728:Z,9729:te,9984:Q,9985:1007,9986:ee,9987:ne},Wc={33071:K,33648:J,10497:Y},qc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Yc={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Kc={CUBICSPLINE:void 0,LINEAR:ve,STEP:ge},Jc="OPAQUE",Zc="MASK",Qc="BLEND";function eh(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function th(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function nh(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())s(i,t.children[n])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,h[e*r+1]),r>=3&&p.setZ(t,h[e*r+2]),r>=4&&p.setW(t,h[e*r+3]),r>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e],s=t.images[i.source];let r=this.textureLoader;if(s.uri){const e=n.manager.getHandler(s.uri);null!==e&&(r=e)}return this.loadTextureImage(e,s,r)}loadTextureImage(e,t,n){const i=this,s=this.json,r=this.options,o=s.textures[e],a=(t.uri||t.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];const l=self.URL||self.webkitURL;let c=t.uri||"",h=!1;if(void 0!==t.bufferView)c=i.getDependency("bufferView",t.bufferView).then((function(e){h=!0;const n=new Blob([e],{type:t.mimeType});return c=l.createObjectURL(n),c}));else if(void 0===t.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then((function(e){return new Promise((function(t,i){let s=t;!0===n.isImageBitmapLoader&&(s=function(e){const n=new fo(e);n.needsUpdate=!0,t(n)}),n.load(ja.resolveURL(e,r.path),s,void 0,i)}))})).then((function(t){!0===h&&l.revokeObjectURL(c),t.flipY=!1,o.name&&(t.name=o.name);const n=(s.samplers||{})[o.sampler]||{};return t.magFilter=Gc[n.magFilter]||te,t.minFilter=Gc[n.minFilter]||ne,t.wrapS=Wc[n.wrapS]||Y,t.wrapT=Wc[n.wrapT]||Y,i.associations.set(t,{textures:e}),t})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",c),null}));return this.textureCache[a]=u,u}assignTexture(e,t,n){const i=this;return this.getDependency("texture",n.index).then((function(s){if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[pc.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[pc.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=i.associations.get(s);s=i.extensions[pc.KHR_TEXTURE_TRANSFORM].extendTexture(s,e),i.associations.set(s,t)}}return e[t]=s,s}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,s=void 0!==t.attributes.color,r=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new _l,wn.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Ts,wn.prototype.copy.call(t,n),t.color.copy(n.color),this.cache.add(e,t)),n=t}if(i||s||r){let e="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(e+="specular-glossiness:"),i&&(e+="derivative-tangents:"),s&&(e+="vertex-colors:"),r&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),s&&(t.vertexColors=!0),r&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n}getMaterialType(){return Zo}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let r;const o={},a=s.extensions||{},l=[];if(a[pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const e=i[pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=e.getMaterialType(),l.push(e.extendParams(o,s,t))}else if(a[pc.KHR_MATERIALS_UNLIT]){const e=i[pc.KHR_MATERIALS_UNLIT];r=e.getMaterialType(),l.push(e.extendParams(o,s,t))}else{const n=s.pbrMetallicRoughness||{};if(o.color=new Pn(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.fromArray(e),o.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(t.assignTexture(o,"map",n.baseColorTexture)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),r=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),l.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===s.doubleSided&&(o.side=2);const c=s.alphaMode||Jc;if(c===Qc?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===Zc&&(o.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&r!==Rn&&(l.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new sn(1,1),void 0!==s.normalTexture.scale)){const e=s.normalTexture.scale;o.normalScale.set(e,e)}return void 0!==s.occlusionTexture&&r!==Rn&&(l.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(o.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&r!==Rn&&(o.emissive=(new Pn).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&r!==Rn&&l.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture)),Promise.all(l).then((function(){let n;return n=r===Lc?i[pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new r(o),s.name&&(n.name=s.name),n.map&&(n.map.encoding=xe),n.emissiveMap&&(n.emissiveMap.encoding=xe),th(n,s),t.associations.set(n,{materials:e}),s.extensions&&eh(i,n,s),n}))}createUniqueName(e){const t=Nl.sanitizeNodeName(e||"");let n=t;for(let e=1;this.nodeNamesUsed[n];++e)n=t+"_"+e;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(e){return n[pc.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return lh(n,e,t)}))}const r=[];for(let n=0,o=e.length;n0&&nh(u,s),u.name=t.createUniqueName(s.name||"mesh_"+e),th(u,s),h.extensions&&eh(i,u,h),t.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;n1?new Es:1===t.length?t[0]:new ft,o!==t[0])for(let e=0,n=t.length;e{const t=new Map;for(const[e,n]of s.associations)(e instanceof wn||e instanceof fo)&&t.set(e,n);return e.traverse((e=>{const n=s.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}}function ah(e,t,n,i){const s=n.nodes[e];return i.getDependency("node",e).then((function(e){if(void 0===s.skin)return e;let t;return i.getDependency("skin",s.skin).then((function(e){t=e;const n=[];for(let e=0,s=t.joints.length;e=0}isValidMimeType(e){return hh.mimeTypes.indexOf(e)>=0}get(e){return new Promise(((t,n)=>{this.gltfLoader.load(e,(e=>{t(this.createModelGroup(e))}),null,(i=>{null===this.gltfLoader||null===this.gltfLoader.dracoLoader?t(null):(console.error(`failed to load '${e}': ${i}`),n(new Error(i)))}))}))}createModelGroup(e){const t=e.scene;return t.traverse((e=>{if("Mesh"===e.type){const t=e;t.castShadow=!0;const n=t.material;n.map&&(n.map.encoding=xe),t.geometry.computeBoundingBox();const i=new ca;"MeshStandardMaterial"===n.type&&i.copyStandardMaterial(n),n.userData.objectSpaceNormals&&i.enableObjectSpaceNormalMap(!0),t.material=i}})),t}}hh.extensions=["gltf","glb"],hh.mimeTypes=["model/gltf+json","model/gltf-binary"];class uh extends wn{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new Pn(16777215),this.specular=new Pn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new sn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}uh.prototype.isMeshPhongMaterial=!0;const dh=/^[og]\s*(.+)?/,ph=/^mtllib /,mh=/^usemtl /,fh=/^usemap /,gh=new Ve,vh=new Ve,yh=new Ve,bh=new Ve,xh=new Ve;function _h(){const e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){const t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){const t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){const e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){const n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){const i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,s=this.object.geometry.normals;gh.fromArray(i,e),vh.fromArray(i,t),yh.fromArray(i,n),xh.subVectors(yh,vh),bh.subVectors(gh,vh),xh.cross(bh),xh.normalize(),s.push(xh.x,xh.y,xh.z),s.push(xh.x,xh.y,xh.z),s.push(xh.x,xh.y,xh.z)},addColor:function(e,t,n){const i=this.colors,s=this.object.geometry.colors;void 0!==i[e]&&s.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&s.push(i[t+0],i[t+1],i[t+2]),void 0!==i[n]&&s.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,s,r,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(e,c),u=this.parseVertexIndex(t,c),d=this.parseVertexIndex(n,c);if(this.addVertex(h,u,d),this.addColor(h,u,d),void 0!==o&&""!==o){const e=this.normals.length;h=this.parseNormalIndex(o,e),u=this.parseNormalIndex(a,e),d=this.parseNormalIndex(l,e),this.addNormal(h,u,d)}else this.addFaceNormal(h,u,d);if(void 0!==i&&""!==i){const e=this.uvs.length;h=this.parseUVIndex(i,e),u=this.parseUVIndex(s,e),d=this.parseUVIndex(r,e),this.addUV(h,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n=7?t.colors.push(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===s){const e=i.substr(1).trim().split(/\s+/),n=[];for(let t=0,i=e.length;t0){const e=i.split("/");n.push(e)}}const s=n[0];for(let e=1,i=n.length-1;e1){const e=o[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;const e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\0"===i)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+i+'"')}t.finalize();const l=new Es;l.materialLibraries=[].concat(t.materialLibraries);if(!0===!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length))for(let e=0,n=t.objects.length;e0&&c.setAttribute("normal",new zn(i.normals,3)),i.colors.length>0&&(a=!0,c.setAttribute("color",new zn(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new zn(i.uvs,2));const h=[];for(let e=0,n=s.length;e1){for(let e=0,t=s.length;e0){const e=new _l({size:1,sizeAttenuation:!1}),n=new qn;n.setAttribute("position",new zn(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new zn(t.colors,3)),e.vertexColors=!0);const i=new Hl(n,e);l.add(i)}return l}}class Sh extends Ia{constructor(e){super(e),this.propertyNameMapping={}}load(e,t,n,i){const s=this,r=new Ua(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,(function(n){try{t(s.parse(n))}catch(t){i?i(t):console.error(t),s.manager.itemError(e)}}),n,i)}setPropertyNameMapping(e){this.propertyNameMapping=e}parse(e){function t(e){let t="",n=0;const i=/^ply([\s\S]*)end_header\r?\n/.exec(e);null!==i&&(t=i[1],n=new Blob([i[0]]).size);const s={comments:[],elements:[],headerLength:n,objInfo:""},r=t.split("\n");let o;function a(e,t){const n={type:e[0]};return"list"===n.type?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t&&(n.name=t[n.name]),n}for(let e=0;e=t.elements[c].count&&(c++,h=0);const r=i(t.elements[c].properties,s);o(n,t.elements[c].name,r),h++}return r(n)}function r(e){let t=new qn;return e.indices.length>0&&t.setIndex(e.indices),t.setAttribute("position",new zn(e.vertices,3)),e.normals.length>0&&t.setAttribute("normal",new zn(e.normals,3)),e.uvs.length>0&&t.setAttribute("uv",new zn(e.uvs,2)),e.colors.length>0&&t.setAttribute("color",new zn(e.colors,3)),e.faceVertexUvs.length>0&&(t=t.toNonIndexed(),t.setAttribute("uv",new zn(e.faceVertexUvs,2))),t.computeBoundingSphere(),t}function o(e,t,n){function i(e){for(let t=0,i=e.length;t=0}get(e){const t=e.split(".").pop().toLowerCase();return new Promise(((n,i)=>{if("obj"===t)this.objLoader.load(e,(t=>{const s=t.children[0].geometry;return s&&"Geometry"===s.type||"BufferGeometry"===s.type?n(s):i(new Error(`Can't parse geometry from '${e}'`))}));else{if("ply"!==t)throw new Error(`Can't load geometry, unknown extension: '${t}' in '${e}'`);this.plyLoader.load(e,(t=>t&&"Geometry"===t.type||"BufferGeometry"===t.type?n(t):i(new Error(`Can't parse geometry from '${e}'`))))}}))}}Mh.extensions=["obj","ply"];class Eh{constructor(e){this.textureLoader=new vl(e)}isValid(e){const t=e.split(".").pop().toLowerCase();return Eh.extensions.indexOf(t)>=0}isValidMimeType(e){return Eh.mimeTypes.indexOf(e)>=0}get(e){return new Promise(((t,n)=>{this.textureLoader.load(e,(e=>{t(e)}),null,(e=>{console.error(e),n(new Error(e.message))}))}))}getImmediate(e){return this.textureLoader.load(e,null,null,(e=>{console.error(e)}))}}Eh.extensions=["jpg","png"],Eh.mimeTypes=["image/jpeg","image/png"];class Th{constructor(e){this._customFontPath=null,this._loadingManager=e,this._textureLoader=new vl(e),this._cache={}}set fontPath(e){this._customFontPath=e}get fontPath(){return this._customFontPath}get(e){return this._cache[e]}async load(e){if(this._cache[e])return Promise.resolve(this._cache[e]);this._loadingManager.itemStart(e);const t=this.fontPath,n=t?t+e+".json":Ph+e+".json",i=t?t+e+".png":Ph+e+".png",s=fetch(n,{headers:{Accept:"application/json"}}).then((t=>{if(!t.ok)throw this._loadingManager.itemError(e),new Error(`failed to load bitmap font descriptor: '${n}', status: ${t.status} ${t.statusText}`);return t.json()})),r=new Promise(((e,t)=>{this._textureLoader.load(i,(n=>n?e(n):t(new Error(`failed to load font texture from '${i}'`))))}));return Promise.all([s,r]).then((t=>{const n={descriptor:t[0],texture:t[1]};return this._cache[e]=n,this._loadingManager.itemEnd(e),n}))}}class Ch extends j{constructor(){super(...arguments),this.ins=this.addInputs(Ch.ins),this.outs=this.addOutputs(Ch.outs),this._loadingManager=new Ah(this),this._baseUrl=window.location.href,this._initialLoad=!1}get loadingManager(){return this._loadingManager}get baseUrl(){return this._baseUrl}set baseUrl(e){this._baseUrl=new URL(e,window.location.href).href}get initialLoad(){return this._initialLoad}set initialLoad(e){this._initialLoad=e}getAssetName(e){return e.split("/").pop()}getAssetUrl(e){const t=new URL(e,this._baseUrl).href;return this.loadingManager.resolveURL(t)}getAssetPath(e){const t=this._baseUrl,n=e.indexOf(t);return n>=0?e.substr(n+t.length):e}getAssetBasePath(e){const t=this.getAssetPath(e).split("/");t.pop();const n=t.join("/");return n?n+"/":n}getRelativeAssetPath(e,t){const n=this.getAssetUrl(e),i=this.getAssetUrl(t),s=n.indexOf(i);return s>=0?n.substr(s+i.length):this.getAssetPath(n)}create(){super.create()}update(){const{ins:e,outs:t}=this;if(e.busy.changed){const n=e.busy.value||this._loadingManager.isBusy;t.busy.setValue(n),n||t.completed.set()}return!0}}Ch.typeName="CVAssetManager",Ch.text="AssetManager",Ch.icon="",Ch.isSystemSingleton=!0,Ch.ins={busy:C("State.Busy"),baseUrlValid:C("Settings.BaseURLValid")},Ch.outs={busy:C("State.Busy"),completed:D("State.Completed")};class Ah extends Da{constructor(e){super(),this._manager=e,this._isBusy=!1,this.onStart=this.onLoadingStart.bind(this),this.onProgress=this.onLoadingProgress.bind(this),this.onLoad=this.onLoadingCompleted.bind(this),this.onError=this.onLoadingError.bind(this)}get isBusy(){return this._isBusy}onLoadingStart(){this._isBusy=!0,this._manager.ins.busy.set()}onLoadingProgress(e,t,n){0}onLoadingCompleted(){this._isBusy=!1,this._manager.ins.busy.set()}onLoadingError(){this._isBusy=!1,this._manager.ins.busy.set()}}const Ph="https://cdn.jsdelivr.net/gh/smithsonian/dpo-voyager@latest/assets/";class Rh extends j{constructor(e,t){super(e,t),this.systemAssetPath=null;const n=this.assetManager.loadingManager;this.jsonLoader=new Na(n),this.modelLoader=new hh(n),this.geometryLoader=new Mh(n),this.textureLoader=new Eh(n),this.fontReader=new Th(n)}dispose(){this.modelLoader.dispose(),super.dispose()}get assetManager(){return this.getMainComponent(Ch)}setDracoPath(e){this.modelLoader.dracoPath=e}setSystemAssetPath(e){this.fontReader.fontPath=e,this.systemAssetPath=e}getSystemAssetUrl(e){return(this.systemAssetPath||Ph)+e}async getJSON(e){const t=this.assetManager.getAssetUrl(e);return this.jsonLoader.get(t)}async getText(e){const t=this.assetManager.getAssetUrl(e);return La(t,"GET")}async getModel(e){const t=this.assetManager.getAssetUrl(e);return this.modelLoader.get(t)}async getGeometry(e){const t=this.assetManager.getAssetUrl(e);return this.geometryLoader.get(t)}async getTexture(e){const t=this.assetManager.getAssetUrl(e);return this.textureLoader.get(t)}async getFont(e){const t=this.assetManager.getAssetUrl(e);return this.fontReader.load(t)}async getSystemTexture(e){const t=this.getSystemAssetUrl(e);return this.textureLoader.get(t)}async getSystemJSON(e){const t=this.getSystemAssetUrl(e);return this.jsonLoader.get(t)}}Rh.typeName="CVAssetReader",Rh.text="AssetReader",Rh.icon="",Rh.isSystemSingleton=!0;class Lh extends j{constructor(){super(...arguments),this._activeLanguages=[],this._translations={},this.ins=this.addInputs(Lh.ins),this.outs=this.addOutputs(Lh.outs),this.updateLanguage=e=>{const{ins:t,outs:n}=this;n.language.setValue(e),this.emit({type:"tag-update"})}}get assetReader(){return this.getMainComponent(Rh)}get activeLanguages(){return this._activeLanguages}toString(){return ys[vs[this.ins.language.value]]}create(){super.create()}update(){const{ins:e,outs:t}=this;if(0==this.activeLanguages.length&&this.addLanguage(t.language.value),e.language.changed&&e.language.value!=t.language.value){const t=e.language.value;this.assetReader.getSystemJSON("language/string.resources."+vs[this.ins.language.value].toLowerCase()+".json").then((e=>{this._translations=e,this.updateLanguage(t)}))}return!0}fromData(e){const{ins:t,outs:n}=this,i=vs[(e=e||{}).language||"EN"];i!=n.language.value&&t.language.value===n.language.value&&(t.language.setValue(isFinite(i)?i:vs.EN),this.updateLanguage(i))}toData(){const e=this.ins;return{language:vs[e.language.getValidatedValue()]}}addLanguage(e){this._activeLanguages.find((t=>t.id===e))||this._activeLanguages.push({id:e,name:ys[vs[e]]})}getLocalizedString(e){const t=this._translations;return void 0===t?e:t[e]||e}}Lh.typeName="CVLanguageManager",Lh.text="Language",Lh.icon="",Lh.isSystemSingleton=!0,Lh.ins={enabled:C("Language.Enabled",!1),language:R("Interface.Language",vs,vs.EN)},Lh.outs={language:R("Interface.Language",vs,vs.EN)};class Nh extends j{constructor(){super(...arguments),this.collection=new Pa,this.process=new Pa,this.images=new Pa,this.articles=new Aa,this.leadArticle=null,this.notes=[],this.audio=new Pa}get language(){return this.getGraphComponent(Lh,!0)}fromDocument(e,t){if(!isFinite(t.meta))throw new Error("info property missing in node");const n=e.metas[t.meta];if(n.collection&&(this.collection.dictionary=n.collection),n.process&&(this.process.dictionary=n.process),n.images){const e={};n.images.forEach((t=>e[t.quality]=t)),this.images.dictionary=e}if(n.articles&&(this.articles.items=n.articles.map((e=>Ra.fromJSON(e))),void 0!==n.leadArticle&&(this.leadArticle=this.articles.getAt(n.leadArticle)),this.articles.items.forEach((e=>{Object.keys(e.data.titles).forEach((e=>{this.language.addLanguage(vs[e])}))}))),n.audio){const e={};n.audio.forEach((t=>e[t.id]=t)),this.audio.dictionary=e}return this.emit("load"),t.meta}toDocument(e,t){let n=null;if(this.collection.length>0&&(n={collection:this.collection.dictionary}),this.process.length>0&&(n=n||{},n.process=this.process.dictionary),this.images.length>0&&(n=n||{},n.images=this.images.items),this.articles.length>0){n=n||{};const e=this.articles.items;n.articles=e.map((e=>e.toJSON())),this.leadArticle&&(n.leadArticle=e.indexOf(this.leadArticle))}if(this.audio.length>0&&(n=n||{},n.audio=this.audio.items),n){e.metas=e.metas||[];const t=e.metas.length;return e.metas.push(n),t}}}Nh.typeName="CVMeta",Nh.text="Meta",Nh.icon="document";class Dh extends j{constructor(){super(...arguments),this._title="Untitled",this._timerStart=0}startTimer(){0===this._timerStart&&(this._timerStart=Date.now())}resetTimer(){this._timerStart=0}getTimerTime(){return this._timerStart>0?Date.now()-this._timerStart:0}setTitle(e){this._title=e}sendProperty(e,t){if("function"==typeof ga){const n=void 0!==t?t.toString():void 0;ga("send","event",this._title,e,n)}}}Dh.typeName="CVAnalytics",Dh.text="Analytics",Dh.icon="",Dh.isSystemSingleton=!0;class Oh extends j{constructor(){super(...arguments),this.ins=this.addInputs(Oh.ins),this.outs=this.addOutputs(Oh.outs)}get settingProperties(){return[this.ins.enabled,this.ins.position]}get snapshotProperties(){return[this.ins.enabled,this.ins.articleId]}get articles(){return Object.keys(this._articles).map((e=>this._articles[e]))}get activeArticle(){return this.outs.article.value}get assetManager(){return this.getMainComponent(Ch)}get assetReader(){return this.getMainComponent(Rh)}get analytics(){return this.getMainComponent(Dh)}get language(){return this.getGraphComponent(Lh)}create(){super.create(),this.getGraphComponents(Nh).forEach((e=>e.on("update",this.updateArticles,this))),this.graph.components.on(Nh,this.onMetaComponent,this),this.graph.components.on(Lh,this.onLanguageComponent,this),this.updateArticles()}dispose(){this.graph.components.off(Lh,this.onLanguageComponent,this),this.graph.components.off(Nh,this.onMetaComponent,this),this.getGraphComponents(Nh).forEach((e=>e.off("update",this.updateArticles,this))),super.dispose()}update(e){const t=this.ins,n=this.outs;if(t.enabled.changed,t.articleId.changed){const e=this._articles[t.articleId.value]||null,i=e&&e.article;n.article.setValue(i),n.content.setValue(""),i&&(this.readArticle(i),this.analytics.sendProperty("Reader.ArticleId",i.defaultTitle))}return!0}readArticle(e){const t=this.outs,n=e.uri;if(n)return this.assetReader.getText(n).then((e=>this.parseArticle(e,n))).then((e=>t.content.setValue(e))).catch((e=>t.content.setValue(`

Article not found at ${n}

`)));t.content.setValue("

Can't display article: no URI.

")}parseArticle(e,t){e=e.replace(/[\n\r]/g,"");const n=this.assetManager.getAssetBasePath(t);return e=e.replace(/(src=\")(.*?)(\")/g,((e,t,i,s)=>(i.startsWith("/")||i.startsWith("http")||(i=this.assetManager.getAssetUrl(n+i)),t+i+s))),Promise.resolve(e)}onMetaComponent(e){e.add&&e.object.articles.on("update",this.updateArticles,this),e.remove&&e.object.articles.off("update",this.updateArticles,this),this.updateArticles()}onLanguageComponent(e){e.add&&e.object.outs.language.on("value",this.updateLanguage,this),e.remove&&e.object.outs.language.off("value",this.updateLanguage,this)}updateArticles(){const e=this.getGraphComponents(Nh),t=this._articles={};e.forEach((e=>{const n=e.articles,i=e.node;n.items.forEach((e=>{t[e.id]={article:e,node:i}}))}));const n=e[0];n&&n.leadArticle?this.ins.articleId.setValue(n.leadArticle.id):this.ins.articleId.setValue("")}updateLanguage(){const e=this.ins;this.articles.forEach((e=>{e.article.language=this.language.outs.language.value})),e.articleId.set()}fromData(e){e=e||{},this.ins.setValues({enabled:!!e.enabled,position:ra[e.position]||ra.Overlay,articleId:e.articleId||""})}toData(){const e=this.ins,t={enabled:e.enabled.value,position:ra[e.position.value]||"Overlay"};return e.articleId.value&&(t.articleId=e.articleId.value),t}}Oh.typeName="CVReader",Oh.text="Reader",Oh.icon="",Oh.ins={enabled:C("Reader.Enabled"),closed:D("Reader.Closed"),position:R("Reader.Position",ra),articleId:A("Article.ID"),focus:C("Reader.Focus")},Oh.outs={article:N("Article.Active",Ra),content:A("Article.Content"),count:x("Article.Count")};class Ih{static registerType(e){if(this.types[e.typeName])throw new Error(`Annotation type '${e.typeName}' already registered.`);this.types[e.typeName]=e}static registerDefaultType(e){this.defaultType=e}static get typeNames(){return[this.defaultTypeName,...Object.keys(this.types).sort()]}static get defaultTypeName(){return this.defaultType.typeName}static getType(e){const t=this.types[e]||this.defaultType;if(!t)throw new Error(`type '${e}' not registered and no default type set.`);return t}static createInstance(e,t,n){return"Circle"===(t=t||e.data.style)?new(this.getType(t))(e,n):new(this.getType(t))(e)}}Ih.types={},Ih.defaultType=null;class kh extends ha{constructor(){super(...arguments),this._language=vs.EN}get title(){return 0===Object.keys(this.data.titles).length&&(this.data.titles.EN=this.data.title),this.data.titles[vs[this.language]]||"undefined"}set title(e){this.data.titles[vs[this.language]]=e,this.update()}get lead(){return 0===Object.keys(this.data.leads).length&&(this.data.leads.EN=this.data.lead),this.data.leads[vs[this.language]]||""}set lead(e){this.data.leads[vs[this.language]]=e,this.update()}get tags(){return 0===Object.keys(this.data.taglist).length&&this.data.tags.length>0&&(this.data.taglist.EN=this.data.tags),this.data.taglist[vs[this.language]]||[]}set tags(e){this.data.taglist[vs[this.language]]=e,this.update()}get language(){return this._language}set language(e){this._language=e}static fromJSON(e){return new kh(e)}init(){return{id:ha.generateId(),title:"New Annotation",titles:{},lead:"",leads:{},marker:"",tags:[],taglist:{},articleId:"",imageUri:"",style:Ih.defaultTypeName,visible:!0,expanded:!1,position:null,direction:null,scale:1,offset:0,tilt:0,azimuth:0,color:[0,.61,.87],zoneIndex:-1}}deflate(e,t){t.id=e.id,Object.keys(this.data.titles).length>0?(t.titles={},Object.keys(this.data.titles).forEach((n=>{t.titles[n]=e.titles[n]}))):e.title&&(t.title=e.title),Object.keys(this.data.leads).length>0?(t.leads={},Object.keys(this.data.leads).forEach((n=>{t.leads[n]=e.leads[n]}))):e.lead&&(t.lead=e.lead),e.marker&&(t.marker=e.marker),Object.keys(this.data.taglist).length>0?(t.taglist={},Object.keys(this.data.taglist).forEach((n=>{t.taglist[n]=e.taglist[n].slice()}))):e.tags.length>0&&(t.tags=e.tags),e.articleId&&(t.articleId=e.articleId),e.imageUri&&(t.imageUri=e.imageUri),e.style!==Ih.defaultTypeName&&(t.style=e.style),!1===e.visible&&(t.visible=e.visible),e.position&&(t.position=e.position.slice()),e.direction&&(t.direction=e.direction.slice()),1!==e.scale&&(t.scale=e.scale),0!==e.offset&&(t.offset=e.offset),0!==e.tilt&&(t.tilt=e.tilt),0!==e.azimuth&&(t.azimuth=e.azimuth);const n=e.color;return!n||1===n[0]&&1===n[1]&&1===n[2]||(t.color=n.slice()),e.zoneIndex>-1&&(t.zoneIndex=e.zoneIndex),e}inflate(e,t){t.id=e.id,t.title=e.title||"",t.titles=e.titles||{},t.lead=e.lead||"",t.leads=e.leads||{},t.marker=e.marker||"",t.tags=e.tags||[],t.taglist=e.taglist||{},t.articleId=e.articleId||"",t.imageUri=e.imageUri||"",t.style=e.style||Ih.defaultTypeName,t.visible=void 0===e.visible||e.visible,t.expanded=!1,t.position=e.position.slice(),t.direction=e.direction.slice(),t.scale=void 0!==e.scale?e.scale:1,t.offset=e.offset||0,t.tilt=e.tilt||0,t.azimuth=e.azimuth||0,t.color=e.color||kh.defaultColor.slice(),t.zoneIndex=void 0!==e.zoneIndex?e.zoneIndex:-1}}kh.defaultColor=[0,.61,.87];class zh{constructor(e,t){this.x=e||0,this.y=t||0}static makeZeros(){return new zh(0,0)}static makeOnes(){return new zh(1,1)}static makeUnitX(){return new zh(1,0)}static makeUnitY(){return new zh(0,1)}static makeCopy(e){return new zh(e.x,e.y)}static makeFromScalar(e){return new zh(e,e)}static makeFromArray(e){return new zh(e[0],e[1])}static toString(e){return`[${e.x}, ${e.y}]`}copy(e){return this.x=e.x,this.y=e.y,this}set(e,t){return this.x=e,this.y=t,this}setFromScalar(e){return this.x=e,this.y=e,this}setFromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}setZeros(){return this.x=0,this.y=0,this}setOnes(){return this.x=1,this.y=1,this}setUnitX(){return this.x=1,this.y=0,this}setUnitY(){return this.x=0,this.y=1,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}mul(e){return this.x*=e.x,this.y*=e.y,this}div(e){return this.x/=e.x,this.y/=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}subScalar(e){return this.x-=e,this.y-=e,this}mulScalar(e){return this.x*=e,this.y*=e,this}divScalar(e){return this.x/=e,this.y/=e,this}translate(e,t){return this.x+=e,this.y+=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.y;return this.x=t*i-n*s,this.y=n*i+t*s,this}scale(e,t){return this.x*=e,this.y*=t,this}invert(){return this.x=1/this.x,this.y=1/this.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y);return this.x*=e,this.y*=e,this}dot(e){return this.x*e.x+this.y*e.y}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}lengthSquared(){const e=this.x,t=this.y;return e*e+t*t}distanceTo(e){const t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)}angle(){return Math.atan2(this.y,this.x)}angleTo(e){const t=this.x,n=this.y,i=e.x,s=e.y;return Math.acos((t*i+n*s)/(Math.sqrt(t*t+n*n)+Math.sqrt(i*i+s*s)))}min(){return this.xthis.y?this.x:this.y}isZero(){return 0===this.x&&0===this.y}clone(){return new zh(this.x,this.y)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e):[this.x,this.y]}toString(){return zh.toString(this)}}zh.zeros=new zh(0,0),zh.ones=new zh(1,1),zh.unitX=new zh(1,0),zh.unitY=new zh(0,1);class Uh{constructor(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}static makeZeros(){return new Uh(0,0,0)}static makeOnes(){return new Uh(1,1,1)}static makeUnitX(){return new Uh(1,0,0)}static makeUnitY(){return new Uh(0,1,0)}static makeUnitZ(){return new Uh(0,0,1)}static makeCopy(e){return new Uh(e.x,e.y,e.z)}static makeFromScalar(e){return new Uh(e,e,e)}static makeFromArray(e){return new Uh(e[0],e[1],e[2])}static toString(e){return`[${e.x}, ${e.y}, ${e.z}]`}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}setFromScalar(e){return this.x=e,this.y=e,this.z=e,this}setFromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}setZeros(){return this.x=0,this.y=0,this.z=0,this}setOnes(){return this.x=1,this.y=1,this.z=1,this}setUnitX(){return this.x=1,this.y=0,this.z=0,this}setUnitY(){return this.x=0,this.y=1,this.z=0,this}setUnitZ(){return this.x=0,this.y=0,this.z=1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}mul(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}div(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}mulScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divScalar(e){return this.x/=e,this.y/=e,this.z/=e,this}translate(e,t,n){return this.x+=e,this.y+=t,this.z+=n,this}rotateX(e){const t=Math.cos(e),n=Math.sin(e),i=this.y,s=this.z;return this.y=t*i-n*s,this.z=n*i+t*s,this}rotateY(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.z;return this.x=t*i+n*s,this.z=-n*i+t*s,this}rotateZ(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.y;return this.x=t*i-n*s,this.y=n*i+t*s,this}scale(e,t,n){return this.x*=e,this.y*=t,this.z*=n,this}invert(){return this.x=1/this.x,this.y=1/this.y,this.z=1/this.z,this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x*=e,this.y*=e,this.z*=e,this}homogenize(){return this.x/=this.z,this.y/=this.z,this.z=1,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){const t=this.y*e.z-this.z*e.y,n=this.z*e.x-this.x*e.z,i=this.x*e.y-this.y*e.x;return this.x=t,this.y=n,this.z=i,this}length(){const e=this.x,t=this.y,n=this.z;return Math.sqrt(e*e+t*t+n*n)}lengthSquared(){const e=this.x,t=this.y,n=this.z;return e*e+t*t+n*n}distanceTo(e){const t=e.x-this.x,n=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+n*n+i*i)}min(){return this.xthis.y?this.x>this.z?this.x:this.z:this.y>this.z?this.y:this.z}isZero(){return 0===this.x&&0===this.y&&0===this.z}clone(){return new Uh(this.x,this.y,this.z)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e):[this.x,this.y,this.z]}toVector2(e){return e?(e.x=this.x,e.y=this.y,e):new zh(this.x,this.y)}toString(){return Uh.toString(this)}}Uh.zeros=new Uh(0,0,0),Uh.ones=new Uh(1,1,1),Uh.unitX=new Uh(1,0,0),Uh.unitY=new Uh(0,1,0),Uh.unitZ=new Uh(0,0,1);class Vh{constructor(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=i||0}static makeZeros(){return new Vh(0,0,0,0)}static makeOnes(){return new Vh(1,1,1,1)}static makeUnitX(){return new Vh(1,0,0,0)}static makeUnitY(){return new Vh(0,1,0,0)}static makeUnitZ(){return new Vh(0,0,1,0)}static makeUnitW(){return new Vh(0,0,0,1)}static makeCopy(e){return new Vh(e.x,e.y,e.z,e.w)}static makeFromScalar(e){return new Vh(e,e,e,e)}static makeFromArray(e){return new Vh(e[0],e[1],e[2],e[3])}static makeFromPosition(e){return new Vh(e.x,e.y,e.z,1)}static makeFromDirection(e){return new Vh(e.x,e.y,e.z,0)}static toString(e){return`[${e.x}, ${e.y}, ${e.z}, ${e.w}]`}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=void 0===i?1:i,this}setFromScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setFromArray(e,t=1){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}setPosition(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=1,this}setDirection(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=0,this}setZeros(){return this.x=0,this.y=0,this.z=0,this.w=0,this}setOnes(){return this.x=1,this.y=1,this.z=1,this.w=1,this}setUnitX(){return this.x=1,this.y=0,this.z=0,this.w=0,this}setUnitY(){return this.x=0,this.y=1,this.z=0,this.w=0,this}setUnitZ(){return this.x=0,this.y=0,this.z=1,this.w=0,this}setUnitW(){return this.x=0,this.y=0,this.z=0,this.w=1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}mul(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}div(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}homogenize(){return this.x/=this.w,this.y/=this.w,this.z/=this.w,this.w=1,this}project(e){const t=this.dot(e)/this.lengthSquared();return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}length(){const e=this.x,t=this.y,n=this.z,i=this.w;return Math.sqrt(e*e+t*t+n*n+i*i)}lengthSquared(){const e=this.x,t=this.y,n=this.z,i=this.w;return e*e+t*t+n*n+i*i}isZero(){return 0===this.x&&0===this.y&&0===this.z&&0===this.w}clone(){return new Vh(this.x,this.y,this.z,this.w)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e):[this.x,this.y,this.z,this.w]}toVector3(e){return e?(e.x=this.x,e.y=this.y,e.z=this.z,e):new Uh(this.x,this.y,this.z)}toString(){return Vh.toString(this)}}Vh.zeros=new Vh(0,0,0,0),Vh.ones=new Vh(1,1,1,1),Vh.unitX=new Vh(1,0,0,0),Vh.unitY=new Vh(0,1,0,0),Vh.unitZ=new Vh(0,0,1,0),Vh.unitW=new Vh(0,0,0,1);class Fh{constructor(e=0,t=0,n=0,i=1){e instanceof Fh?(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):Array.isArray(e)?(this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0,this.w=void 0!==e[3]?e[3]:1):"string"==typeof e?this.setString(e):(this.x=e,this.y=t,this.z=n,this.w=i)}static fromString(e){return(new Fh).setString(e)}static fromArray(e){return new Fh(e)}get r(){return this.x}get g(){return this.y}get b(){return this.z}get a(){return this.w}set r(e){this.x=e}set g(e){this.y=e}set b(e){this.z=e}set a(e){this.w=e}get red(){return this.x}get green(){return this.y}get blue(){return this.z}get alpha(){return this.w}set red(e){this.x=e}set green(e){this.y=e}set blue(e){this.z=e}set alpha(e){this.w=e}get redByte(){return Math.floor(255*this.x)}get greenByte(){return Math.floor(255*this.y)}get blueByte(){return Math.floor(255*this.z)}get alphaByte(){return Math.floor(255*this.w)}set redByte(e){this.x=e/255}set greenByte(e){this.y=e/255}set blueByte(e){this.z=e/255}set alphaByte(e){this.w=e/255}inverseMultiply(e){return this.x=this.x*(1-e)+e,this.y=this.y*(1-e)+e,this.z=this.z*(1-e)+e,this}multiply(e){return this.x*=e,this.y*=e,this.z*=e,this}copy(e){this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w}clone(){return new Fh(this.x,this.y,this.z,this.w)}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=void 0===i?1:i,this}setBytes(e,t,n,i){return this.x=e/255,this.y=t/255,this.z=n/255,this.w=void 0===i?1:i/255,this}setUInt24RGB(e){return this.x=e>>16&255,this.y=e>>8&255,this.z=255&e,this.w=1,this}setUInt32RGBA(e){return this.x=e>>24&255,this.y=e>>16&255,this.z=e>>8&255,this.w=255&e,this.w=1,this}setRed(e){return this.x=e,this}setGreen(e){return this.y=e,this}setBlue(e){return this.z=e,this}setAlpha(e){return this.w=e,this}setRedByte(e){return this.x=e/255,this}setGreenByte(e){return this.y=e/255,this}setBlueByte(e){return this.z=e/255,this}setAlphaByte(e){return this.w=e/255,this}setHSV(e,t=1,n=1,i){"object"==typeof e&&(t=e.y,n=e.z,i=void 0!==e.w?e.w:i,e=e.x);const s=Math.floor(e/60),r=e/60-s,o=n*(1-t),a=n*(1-r*t),l=n*(1-(1-r)*t);let c,h,u;switch(s%6){case 0:c=n,h=l,u=o;break;case 1:c=a,h=n,u=o;break;case 2:c=o,h=n,u=l;break;case 3:c=o,h=a,u=n;break;case 4:c=l,h=o,u=n;break;case 5:c=n,h=o,u=a}return this.x=c,this.y=h,this.z=u,void 0!==i&&(this.w=i),this}setHSL(e,t=1,n=1,i){if("object"==typeof e&&(t=e.y,n=e.z,i=void 0!==e.w?e.w:i,e=e.x),0===t)this.x=this.y=this.z=n;else{function i(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}e/=360;var s=n<.5?n*(1+t):n+t-n*t,r=2*n-s;this.x=i(r,s,e+1/3),this.y=i(r,s,e),this.z=i(r,s,e-1/3)}return void 0!==i&&(this.w=i),this}fromArray(e){this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0,this.w=void 0!==e[3]?e[3]:1}setString(e,t=1,n=!0){e=e.trim().toLowerCase();let i=(e=Fh.presets[e]||e).match(/^#?([0-9a-f]{3})$/i);if(i){const e=i[1],n=1/15;return this.x=Number.parseInt(e.charAt(0),16)*n,this.y=Number.parseInt(e.charAt(1),16)*n,this.z=Number.parseInt(e.charAt(2),16)*n,this.w=t,this}if(i=e.match(/^#?([0-9a-f]{6})$/i),i){const e=i[1],n=1/255;return this.x=Number.parseInt(e.substr(0,2),16)*n,this.y=Number.parseInt(e.substr(2,2),16)*n,this.z=Number.parseInt(e.substr(4,2),16)*n,this.w=t,this}if(0===e.indexOf("rgb")){let n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n){const e=1/255;return this.x=Number.parseInt(n[1])*e,this.y=Number.parseInt(n[2])*e,this.z=Number.parseInt(n[3])*e,this.w=t,this}if(n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+.*\d*)\s*\)$/i),n){const e=1/255;return this.x=Number.parseInt(n[1])*e,this.y=Number.parseInt(n[2])*e,this.z=Number.parseInt(n[3])*e,this.w=Number.parseFloat(n[4]),this}}if(0===e.indexOf("hsl")){let n=e.match(/(\d+(\.\d+)?)/g);return n&&this.setHSL(Number.parseFloat(n[0]),.01*Number.parseFloat(n[1]),.01*Number.parseFloat(n[2]),void 0!==n[3]?Number.parseFloat(n[3]):t),this}if(n)throw new RangeError("failed to parse color from string: "+e);return this}toUInt24RGB(){return Math.floor(255*this.x)<<16+Math.floor(255*this.y)<<8+Math.floor(255*this.z)}toUInt32RGBA(){return Math.floor(255*this.x)<<24+Math.floor(255*this.y)<<16+Math.floor(255*this.z)<<8+Math.floor(255*this.w)}toVector3(e){return e?(e.x=this.r,e.y=this.g,e.z=this.b,e):new Uh(this.r,this.g,this.b)}toVector4(e){return e?(e.x=this.r,e.y=this.g,e.z=this.b,e.w=this.a,e):new Vh(this.r,this.g,this.b,this.a)}toHSV(e){let t=this.x,n=this.y,i=this.z,s=Math.min(t,n,i),r=Math.max(t,n,i),o=r-s,a=0,l=0===r?0:o/r,c=r;return 0!==o&&(a=60*(t===r?(n-i)/o+(n.5?o/(2-r-s):o/(r+s),a=60*(t===r?(n-i)/o+(n=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let jh=class extends Zr{constructor(){super(),this.name="",this.index=0,this.selectedIndex=-1,this.tabbingIndex=0,this.selected=!1,this.selectable=!1,this.disabled=!1,this.icon="",this.role="button",this.caret=!1,this.inline=!1,this.transparent=!1,this.addEventListener("click",(e=>this.onClick(e))),this.addEventListener("keydown",(e=>this.onKeyDown(e)))}firstConnected(){this.tabIndex=this.tabbingIndex,this.setAttribute("role",this.role),this.classList.add("ff-button")}shouldUpdate(e){return(e.has("selectedIndex")||e.has("index"))&&this.selectedIndex>=0&&(this.selected=this.index===this.selectedIndex),e.has("disabled")&&this.setClass("ff-disabled",this.disabled),!0}update(e){this.classList.remove("ff-inline","ff-transparent","ff-control"),this.inline?this.classList.add("ff-inline"):this.transparent?this.classList.add("ff-transparent"):this.classList.add("ff-control"),super.update(e)}render(){return _r`${this.renderIcon()}${this.renderText()}${this.renderCaret()}`}renderIcon(){return this.icon?_r``:null}renderText(){return this.text?_r`
${this.text}
`:null}renderCaret(){return this.caret?_r`
`:null}onClick(e){this.selectable&&(this.selected=!this.selected)}onKeyDown(e){(document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement)!==this||"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),this.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}};Bh([Or({type:String})],jh.prototype,"name",void 0),Bh([Or({type:Number})],jh.prototype,"index",void 0),Bh([Or({type:Number})],jh.prototype,"selectedIndex",void 0),Bh([Or({type:Number})],jh.prototype,"tabbingIndex",void 0),Bh([Or({type:Boolean,reflect:!0})],jh.prototype,"selected",void 0),Bh([Or({type:Boolean})],jh.prototype,"selectable",void 0),Bh([Or({type:Boolean})],jh.prototype,"disabled",void 0),Bh([Or()],jh.prototype,"text",void 0),Bh([Or()],jh.prototype,"icon",void 0),Bh([Or()],jh.prototype,"role",void 0),Bh([Or({type:Boolean})],jh.prototype,"caret",void 0),Bh([Or({type:Boolean})],jh.prototype,"inline",void 0),Bh([Or({type:Boolean})],jh.prototype,"transparent",void 0),jh=Bh([Qr("ff-button")],jh);const $h=jh;class Hh extends rl{constructor(e=[]){super(),this.cameras=e}}Hh.prototype.isArrayCamera=!0;const Gh=new Ve(0,1,0),Wh=new Ve,qh=new Ve,Xh=new Ve;class Yh extends Ea{constructor(e,t){super(),this.isAdaptive=!0,this.annotation=e,this.matrixAutoUpdate=!1}get typeName(){return this.constructor.typeName}update(){super.update();const e=this.annotation.data;this.position.fromArray(e.position),Wh.fromArray(e.direction).normalize(),this.quaternion.setFromUnitVectors(Gh,Wh),this.updateMatrix()}emitClickEvent(){const e={type:"click",annotation:this.annotation,sprite:this};this.dispatchEvent(e)}emitLinkEvent(e){const t={type:"link",annotation:this.annotation,sprite:this,link:e};this.dispatchEvent(t)}isBehindCamera(e,t){let n=null;n=t instanceof Hh&&t.cameras.length>0?t.cameras[0]:t;const i=n.matrixWorld.elements;return e.updateMatrixWorld(),qh.setFromMatrixPosition(e.matrixWorld),Xh.setFromMatrixPosition(n.matrixWorld),Wh.set(-i[8],-i[9],-i[10]).normalize(),Xh.addScaledVector(Wh,n.near),Xh.sub(qh),Xh.angleTo(Wh)<=Math.PI/2}}Yh.typeName="Annotation";class Kh extends Ta{constructor(e){super(),this.sprite=e,this.discardEvent=this.discardEvent.bind(this),this.addEventListener("pointerdown",this.discardEvent),this.addEventListener("pointercancel",this.discardEvent),this.addEventListener("click",this.discardEvent)}firstConnected(){super.firstConnected(),this.classList.add("sv-annotation")}discardEvent(e){e.stopPropagation()}}var Jh=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const Zh=["sv-q0","sv-q1","sv-q2","sv-q3"],Qh=new Fh,eu=new Ve(0,1,0);class tu extends Yh{constructor(e){super(e),this.quadrant=-1,this.adaptive=!0;const t=[];t.push(new Ve(0,0,0)),t.push(new Ve(0,1,0));const n=(new qn).setFromPoints(t),i=new Ts({color:"#009cde",transparent:!0});this.stemLine=new Ns(n,i),this.stemLine.frustumCulled=!1,this.stemLine.matrixAutoUpdate=!1,this.add(this.stemLine),this.update()}update(){const e=this.annotation.data;this.stemLine.scale.setScalar(e.scale),this.stemLine.position.y=e.offset,this.stemLine.updateMatrix();this.stemLine.material.color.fromArray(e.color),super.update()}renderHTMLElement(e,t,n){super.renderHTMLElement(e,t,n,this.stemLine,eu);const i=vt.scaleLimit(this.viewAngle*vt.RAD2DEG,90,100,1,0),s=this.annotation.data.visible?i:0;this.stemLine.material.opacity=s,e.setOpacity(s),this.orientationQuadrant!==this.quadrant&&(e.classList.remove(Zh[this.quadrant]),e.classList.add(Zh[this.orientationQuadrant]),this.quadrant=this.orientationQuadrant),this.adaptive!==this.isAdaptive&&(this.isAdaptive?e.classList.remove("sv-static-width"):e.classList.add("sv-static-width"),this.adaptive=this.isAdaptive),this.setVisible(!this.isBehindCamera(this.stemLine,n))}createHTMLElement(){return new nu(this)}}tu.typeName="Standard",Ih.registerDefaultType(tu);let nu=class extends Kh{constructor(e){super(e),this.onClickTitle=this.onClickTitle.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.titleElement=this.appendElement("div"),this.titleElement.classList.add("sv-title"),this.titleElement.addEventListener("click",this.onClickTitle)}firstConnected(){super.firstConnected(),this.classList.add("sv-standard-annotation")}update(e){super.update(e);const t=this.sprite.annotation.data;this.titleElement.innerText=this.sprite.annotation.title,Qh.fromArray(t.color),this.style.borderColor=Qh.toString()}onClickTitle(e){e.stopPropagation(),this.sprite.emitClickEvent()}onKeyDown(e){"Space"!==e.code&&"Enter"!==e.code||(e.stopPropagation(),this.sprite.emitClickEvent())}};nu=Jh([Qr("sv-standard-annotation")],nu);var iu=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const su=["sv-q0","sv-q1","sv-q2","sv-q3"],ru=new Fh,ou=new Ve(0,1,0);class au extends Yh{constructor(e){super(e),this.quadrant=-1,this.adaptive=!0;const t=[];t.push(new Ve(0,0,0)),t.push(new Ve(0,1,0));const n=(new qn).setFromPoints(t),i=new Ts({color:"#009cde",transparent:!0});this.stemLine=new Ns(n,i),this.stemLine.frustumCulled=!1,this.stemLine.matrixAutoUpdate=!1,this.add(this.stemLine),this.update()}update(){const e=this.annotation.data;this.stemLine.scale.setScalar(e.scale),this.stemLine.position.y=e.offset,this.stemLine.updateMatrix();this.stemLine.material.color.fromArray(e.color),super.update()}renderHTMLElement(e,t,n){super.renderHTMLElement(e,t,n,this.stemLine,ou);const i=vt.scaleLimit(this.viewAngle*vt.RAD2DEG,90,100,1,0),s=this.annotation.data.visible?i:0;this.stemLine.material.opacity=s,e.setOpacity(s),this.orientationQuadrant!==this.quadrant&&(e.classList.remove(su[this.quadrant]),e.classList.add(su[this.orientationQuadrant]),this.quadrant=this.orientationQuadrant),this.adaptive!==this.isAdaptive&&(this.isAdaptive?e.classList.remove("sv-static-width"):e.classList.add("sv-static-width"),this.adaptive=this.isAdaptive),this.setVisible(!this.isBehindCamera(this.stemLine,n))}createHTMLElement(){return new lu(this)}}au.typeName="Extended",Ih.registerType(au);let lu=class extends Kh{constructor(e){super(e),this.handler=0,this.isExpanded=void 0,this.onClickTitle=this.onClickTitle.bind(this),this.onClickArticle=this.onClickArticle.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.titleElement=this.appendElement("div"),this.titleElement.classList.add("sv-title"),this.titleElement.addEventListener("click",this.onClickTitle),this.wrapperElement=this.appendElement("div"),this.contentElement=this.createElement("div",null,this.wrapperElement),this.contentElement.classList.add("sv-content"),this.contentElement.style.display="none"}firstConnected(){super.firstConnected(),this.classList.add("sv-extended-annotation")}update(e){super.update(e);const t=this.sprite.annotation.data;this.titleElement.innerText=this.sprite.annotation.title;const n=_r`

${this.sprite.annotation.lead}

+ ${t.articleId?_r``:null}`;br(n,this.contentElement),ru.fromArray(t.color),this.style.borderColor=ru.toString(),this.isExpanded&&(this.contentElement.style.height="auto"),this.isExpanded!==t.expanded&&(this.isExpanded=t.expanded,window.clearTimeout(this.handler),this.isExpanded?(this.classList.add("sv-expanded"),this.style.minWidth=this.sprite.annotation.lead.length<40?"0":"",this.contentElement.style.display="inherit",this.contentElement.style.height=this.contentElement.scrollHeight+"px"):(this.classList.remove("sv-expanded"),this.contentElement.style.height="0",this.handler=window.setTimeout((()=>this.contentElement.style.display="none"),300)))}onClickTitle(e){e.stopPropagation(),this.sprite.emitClickEvent()}onClickArticle(e){e.stopPropagation(),this.sprite.emitLinkEvent(this.sprite.annotation.data.articleId)}onKeyDown(e){"Space"!==e.code&&"Enter"!==e.code||(e.stopPropagation(),this.sprite.emitClickEvent())}};lu=iu([Qr("sv-extended-annotation")],lu);class cu extends qn{constructor(e=.5,t=1,n=8,i=1,s=0,r=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:r},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=e;const u=(t-e)/(i=Math.max(1,i)),d=new Ve,p=new sn;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=s+e/n*r;d.x=h*Math.cos(i),d.y=h*Math.sin(i),a.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,c.push(p.x,p.y)}h+=u}for(let e=0;e0}));this.visibleGlyphs=r;var o=mu.positions(r),a=mu.uvs(r,i,s,t),l=pu([],{clockwise:!0,type:"uint16",count:r.length});if(this.setIndex(l),this.setAttribute("position",new On(o,2)),this.setAttribute("uv",new On(a,2)),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var c=mu.pages(r);this.setAttribute("page",new On(c,1))}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new cn);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);fu.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Lt);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():fu.computeBox(t,e)}}var vu=n(4439);function yu(e){var t="number"==typeof(e=e||{}).opacity?e.opacity:1,n="number"==typeof e.alphaTest?e.alphaTest:1e-4,i=e.precision||"highp",s=e.color,r=e.map,o="boolean"!=typeof e.negate||e.negate,a=e.isWebGL2||!1;return delete e.map,delete e.color,delete e.precision,delete e.opacity,delete e.negate,delete e.isWebGL2,vu(a?{uniforms:{opacity:{type:"f",value:t},map:{type:"t",value:r||new fo},color:{type:"c",value:new Pn(s)}},vertexShader:["#version 300 es","in vec2 uv;","in vec4 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","out vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * position;","}"].join("\n"),fragmentShader:["#version 300 es","precision "+i+" float;","uniform float opacity;","uniform vec3 color;","uniform sampler2D map;","in vec2 vUv;","out vec4 myOutputColor;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","void main() {"," vec3 s = "+(o?"1.0 - ":"")+"texture(map, vUv).rgb;"," float sigDist = median(s.r, s.g, s.b) - 0.5;"," float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0.0, 1.0);"," myOutputColor = vec4(color.xyz, alpha * opacity);",0===n?"":" if (myOutputColor.a < "+n+") discard;","}"].join("\n")}:{uniforms:{opacity:{type:"f",value:t},map:{type:"t",value:r||new fo},color:{type:"c",value:new Pn(s)}},vertexShader:["attribute vec2 uv;","attribute vec4 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * position;","}"].join("\n"),fragmentShader:["#ifdef GL_OES_standard_derivatives","#extension GL_OES_standard_derivatives : enable","#endif","precision "+i+" float;","uniform float opacity;","uniform vec3 color;","uniform sampler2D map;","varying vec2 vUv;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","void main() {"," vec3 sample = "+(o?"1.0 - ":"")+"texture2D(map, vUv).rgb;"," float sigDist = median(sample.r, sample.g, sample.b) - 0.5;"," float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0.0, 1.0);"," gl_FragColor = vec4(color.xyz, alpha * opacity);",0===n?"":" if (gl_FragColor.a < "+n+") discard;","}"].join("\n")},e)}var bu=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const xu=new Ve,_u=new Ve,wu=new Ue,Su=new je;class Mu extends Yh{constructor(e,t){super(e),this._isExpanded=!1,this.xrScale=1,this.isWebGL2=!1,this._isExpanded=e.data.expanded,this.offset=new Es,this.offset.matrixAutoUpdate=!1,this.add(this.offset),this.ringGeometry=new cu(.45,.5,32),this.ringMaterialA=new Rn,this.ringMaterialB=new Rn({depthFunc:6,depthWrite:!1,opacity:Mu.behindOpacity,transparent:!0}),this.ringMesh=new ui(this.ringGeometry,this.ringMaterialA);const n=new ui(this.ringGeometry,this.ringMaterialB),i=new ui(new hu(.45,32),new Rn({color:0,opacity:.65,transparent:!0}));i.matrixAutoUpdate=!1,i.position.set(0,0,.005),i.updateMatrix(),this.anchorMesh=new ui(new qn,new Rn),this.anchorMesh.frustumCulled=!1,this.offset.add(this.anchorMesh,this.ringMesh,n,i),this.markerGeometry=null,this.markerA=null,this.markerB=null,t.fontReader.load("fonts/Roboto-Bold").then((e=>{var t;this.markerMaterialA=new uu(yu({map:e.texture,transparent:!0,color:16777215,isWebGL2:this.isWebGL2})),this.markerMaterialB=new uu(yu({map:e.texture,transparent:!0,opacity:Mu.behindOpacity,color:16777215,depthFunc:6,depthWrite:!1,isWebGL2:this.isWebGL2})),this.markerGeometry=(t={font:e.descriptor},new gu(t)),this.markerA=new ui(this.markerGeometry,this.markerMaterialA),this.markerA.matrixAutoUpdate=!1,this.markerB=new ui(this.markerGeometry,this.markerMaterialB),this.markerB.matrixAutoUpdate=!1,Po.add(this.markerA,!1),Po.add(this.markerB,!1),this.offset.add(this.markerA,this.markerB),this.update()})),this.update()}dispose(){this.offset=null,this.anchorMesh=null,this.ringMesh=null,this.ringGeometry=null,this.ringMaterialA=null,this.ringMaterialB=null,this.markerGeometry=null,this.markerMaterialA=null,this.markerMaterialB=null,this.markerA=null,this.markerB=null,super.dispose()}update(){const e=this.annotation.data,t=e.color;if(this.ringMaterialA.color.setRGB(t[0],t[1],t[2]),this.ringMaterialB.color.setRGB(t[0],t[1],t[2]),this.markerA){const t=e.marker.length>1?.013:.016,n=this.markerGeometry;n.update(e.marker),n.computeBoundingBox(),n.boundingBox.getCenter(xu),this.markerA.position.set(-t*(xu.x+1),t*xu.y,.01),this.markerA.scale.set(t,-t,-1),this.markerA.updateMatrix(),this.markerB.position.set(-t*(xu.x+1),t*xu.y,.01),this.markerB.scale.set(t,-t,-1),this.markerB.updateMatrix()}super.update()}renderHTMLElement(e,t,n){const i=this.annotation.data;let s=null;const r=this.annotation.data.visible;n instanceof Hh&&(s=n.cameras[0]),s?Su.copy(s.matrixWorldInverse):Su.copy(n.matrixWorldInverse),Su.multiply(this.matrixWorld),Su.decompose(xu,wu,_u),this.offset.quaternion.copy(wu.invert()),this.offset.parent.matrixWorld.decompose(xu,wu,_u);const o=1/_u.x*(1/i.scale)*this.xrScale,a=t.offsetHeight+250,l=55*i.scale/a*o;let c=1;if(n.isPerspectiveCamera){const e=-xu.set(0,0,0).applyMatrix4(Su).z,t=n.fov*Re*.5;c=Math.tan(t)*e*l}else c=.5*n.size*l;if(this.offset.scale.setScalar(c),this.offset.position.set(0,(i.offset+1)*c*.5,0),this.offset.updateMatrix(),this.setVisible(!this.isBehindCamera(this.offset,n)&&r),this.getVisible()||e.setVisible(this.getVisible()),i.expanded){xu.set(0,0,0).applyMatrix4(this.anchorMesh.modelViewMatrix).applyMatrix4(n.projectionMatrix),_u.set(.6,.5,0).applyMatrix4(this.anchorMesh.modelViewMatrix).applyMatrix4(n.projectionMatrix);const i=.5*(xu.x+1)*t.clientWidth,s=.5*(1-xu.y)*t.clientHeight,r=.5*(_u.x+1)*t.clientWidth-i,o=.5*(1-_u.y)*t.clientHeight-s;let a=i+r,l=s+o;e.classList.remove("sv-align-right","sv-align-bottom"),a+e.offsetWidth>=t.offsetWidth&&(a=i-r,e.classList.add("sv-align-right")),l+e.offsetHeight>=t.offsetHeight&&(l=s-o,e.classList.add("sv-align-bottom")),e.setPosition(a,l)}this._isExpanded!==i.expanded&&(e.style.visibility="",this._isExpanded=i.expanded)}createHTMLElement(){return new Eu(this)}updateHTMLElement(e){e.setVisible(this.getVisible()),this.annotation.data.expanded&&this._isExpanded!==this.annotation.data.expanded&&(e.style.visibility="hidden"),e.requestUpdate()}}Mu.typeName="Circle",Mu.behindOpacity=.2,Ih.registerType(Mu);let Eu=class extends Kh{constructor(e){super(e)}setVisible(e){super.setVisible(e&&this.sprite.annotation.data.expanded)}firstConnected(){super.firstConnected(),this.classList.add("sv-circle-annotation")}render(){const e=this.sprite.annotation,t=e.data;return _r`
${e.title}
+

${e.lead}

+ ${t.articleId?_r``:null}`}onClickArticle(e){e.stopPropagation(),this.sprite.emitLinkEvent(this.sprite.annotation.data.articleId)}};Eu=bu([Qr("sv-circle-annotation")],Eu);class Tu extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(Tu.ins),this._activeAnnotation=null,this._annotations={},this._viewports=new Set,this._sprites={},this.addEvents("active-annotation","group"),this.onSpriteClick=this.onSpriteClick.bind(this),this.onSpriteLink=this.onSpriteLink.bind(this),this.on("pointer-up",this.onPointerUp,this),this.system.on("pointer-up",this.onSystemPointerUp,this),this.arManager.outs.isPresenting.on("value",this.handleARStateChange,this),this.language.outs.language.on("value",this.updateLanguage,this),this.object3D=new Ca}get model(){return this.getComponent(Zd)}get meta(){return this.getComponent(Nh,!0)}get reader(){return this.getGraphComponent(Oh,!0)}get language(){return this.getGraphComponent(Lh,!0)}get articles(){const e=this.meta;return e?e.articles:null}get arManager(){return this.system.getMainComponent(gp)}get renderer(){return this.getMainComponent(Ae)}get assetReader(){return this.getMainComponent(Rh)}get activeAnnotation(){return this._activeAnnotation}set activeAnnotation(e){if(e!==this._activeAnnotation){const t=this._activeAnnotation;t&&(t.set("expanded",!1),this.updateSprite(t)),this._activeAnnotation=e,e&&(e.set("expanded",!0),this.updateSprite(e));const n=this.ins;n.marker.setValue(e?e.data.marker:"",!0),n.title.setValue(e?e.title:"",!0),n.lead.setValue(e?e.lead:"",!0),n.tags.setValue(e?e.tags.join(", "):"",!0),n.style.setOption(e?e.data.style:Ih.defaultTypeName,!0),n.scale.setValue(e?100*e.data.scale*Jo(this.model.ins.localUnits.getValidatedValue(),gs.m):1,!0),n.offset.setValue(e?100*e.data.offset*Jo(this.model.ins.localUnits.getValidatedValue(),gs.m):0,!0),n.tilt.setValue(e?e.data.tilt:0,!0),n.azimuth.setValue(e?e.data.azimuth:0,!0),n.color.setValue(e?e.data.color.slice():[1,1,1],!0);const i=this.articles;if(i){const t=i.items.map((e=>e.title));t.unshift("(none)"),n.article.setOptions(t);const s=e?i.getById(e.data.articleId):null;n.article.setValue(s?i.getIndexOf(s)+1:0,!0)}else n.article.setOptions(["(none)"]),n.article.setValue(0);n.image.setValue(e?e.data.imageUri:"",!0),this.emit({type:"annotation-update",annotation:e})}}get hasAnnotations(){return Object.keys(this._annotations).length>0}setActiveAnnotationById(e){this.activeAnnotation=this._annotations[e]}update(e){super.update(e);const t=this.ins,n=this.object3D,i=this.activeAnnotation;if(t.unitScale.changed&&(n.scale.setScalar(t.unitScale.value),n.updateMatrix()),t.activeTags.changed){const e=t.activeTags.value.split(",").map((e=>e.trim())).filter((e=>e));for(const t in this._annotations){const n=this._annotations[t],i=n.tags;let s=0===i.length;e.forEach((e=>{i.indexOf(e)>=0&&(s=!0)})),n.set("visible",s),this.updateSprite(n)}}if(t.visible.changed&&n.setVisible(t.visible.value),i){if(t.marker.changed&&i.set("marker",t.marker.value),t.title.changed&&(i.title=t.title.value),t.lead.changed&&(i.lead=t.lead.value),t.tags.changed&&(i.tags=t.tags.value.split(",").map((e=>e.trim())).filter((e=>e)),this.emit({type:"tag-update"})),t.style.changed&&(i.set("style",t.style.getOptionText()),this.createSprite(i)),t.scale.changed&&i.set("scale",t.scale.value*Jo(gs.m,this.model.ins.localUnits.getValidatedValue())*.01),t.offset.changed&&i.set("offset",t.offset.value*Jo(gs.m,this.model.ins.localUnits.getValidatedValue())*.01),t.tilt.changed&&i.set("tilt",t.tilt.value),t.azimuth.changed&&i.set("azimuth",t.azimuth.value),t.color.changed&&i.set("color",t.color.value.slice()),t.image.changed&&i.set("imageUri",t.image.value),t.article.changed){const e=this.articles,n=e&&e.getAt(t.article.getValidatedValue()-1);i.set("articleId",n?n.id:"")}this.updateSprite(i),this.emit({type:"annotation-update",annotation:i})}return!0}tock(){if(this.updated)return!0}postRender(e){const t=e.viewport;this._viewports.has(t)||(t.on("dispose",this.onViewportDispose,this),this._viewports.add(t));this.object3D.render(t.overlay,e.camera)}dispose(){this.object3D.dispose(),this.off("pointer-up",this.onPointerUp,this),this.system.off("pointer-up",this.onSystemPointerUp,this),this.arManager.outs.isPresenting.off("value",this.handleARStateChange,this),this.language.outs.language.off("value",this.updateLanguage,this),this._viewports.forEach((e=>e.off("dispose",this.onViewportDispose,this))),this._viewports.clear(),super.dispose()}getAnnotations(){return Object.keys(this._annotations).map((e=>this._annotations[e]))}addAnnotation(e){this._annotations[e.id]=e,this.createSprite(e),Object.keys(e.data.titles).forEach((e=>{this.language.addLanguage(vs[e])})),Object.keys(e.data.leads).forEach((e=>{this.language.addLanguage(vs[e])})),this.changed=!0}removeAnnotation(e){const t=Object.keys(this._annotations);if(delete this._annotations[e.id],this.removeSprite(e),e===this.activeAnnotation){const n=Math.min(t.indexOf(e.id)+1,t.length-1);this.activeAnnotation=n<0?null:this._annotations[t[n]],e.tags.length>0&&this.emit({type:"tag-update"})}this.changed=!0}updateAnnotation(e){this.changed=!0}toJSON(){const e=super.toJSON(),t=this.toData();return t&&(e.data=t),e}fromJSON(e){e.data&&this.fromData(e.data)}toData(){const e=Object.keys(this._annotations);return 0===e.length?null:e.map((e=>this._annotations[e].toJSON()))}fromData(e){e.forEach((e=>this.addAnnotation(new kh(e)))),this.emit({type:"tag-update"})}setXRScale(e){for(const t in this._annotations){const n=this._annotations[t];if("Circle"===n.get("style")){const t=this._sprites[n.id];t&&(t.xrScale=e)}}}handleARStateChange(){for(const e in this._annotations){const t=this._annotations[e];this._sprites[t.id].isAdaptive=!this.arManager.outs.isPresenting.value}}onPointerUp(e){if(e.isDragging)return;let t=e.object3D;for(;t&&!t.isHTMLSprite;)t=t.parent;const n=t&&t.annotation;n&&(this.emit({type:"click",sprite:t,annotation:n}),e.stopPropagation=!0)}onSystemPointerUp(e){e.isDragging||this.emit({type:"click",sprite:null,annotation:null})}onViewportDispose(e){this.object3D.disposeHTMLElements(e.viewport.overlay)}onSpriteClick(e){this.emit(e)}onSpriteLink(e){this.reader&&(this.reader.ins.articleId.setValue(e.annotation.data.articleId),this.reader.ins.enabled.setValue(!0))}createSprite(e){this.removeSprite(e);const t="Circle"===e.data.style,n=t?Ih.createInstance(e,"Circle",this.assetReader):Ih.createInstance(e);n.addEventListener("click",this.onSpriteClick),n.addEventListener("link",this.onSpriteLink),this._sprites[e.id]=n,this.object3D.add(n),this.registerPickableObject3D(n,!0),t&&(n.isWebGL2=this.renderer.views[0].renderer.capabilities.isWebGL2)}removeSprite(e){const t=this._sprites[e.id];t&&(t.removeEventListener("click",this.onSpriteClick),t.removeEventListener("link",this.onSpriteLink),t.dispose(),this._sprites[e.id]=void 0,this.object3D.remove(t),this.unregisterPickableObject3D(t,!0))}updateSprite(e){const t=this._sprites[e.id];t&&t.update()}updateLanguage(){const e=this.ins,t=this._activeAnnotation,n=this.language;this.getAnnotations().forEach((e=>{e.language=n.outs.language.value})),e.activeTags.set();for(const e in this._annotations){const t=this._annotations[e],n=this._sprites[t.id];n&&n.update()}e.title.setValue(t?t.title:"",!0),e.lead.setValue(t?t.lead:"",!0),e.tags.setValue(t?t.tags.join(", "):"")}}Tu.typeName="CVAnnotationView",Tu.ins={unitScale:b("Transform.UnitScale",{preset:1,precision:5}),activeTags:A("Tags.Active"),title:A("Annotation.Title"),lead:A("Annotation.Lead"),marker:A("Annotation.Marker"),tags:A("Annotation.Tags"),style:L("Annotation.Style",Ih.typeNames),scale:M("Annotation.Scale",{preset:1,precision:3}),offset:b("Annotation.Offset",{preset:0,precision:3}),article:L("Annotation.Article",[]),image:A("Annotation.Image"),tilt:b("Annotation.Tilt"),azimuth:b("Annotation.Azimuth"),color:T("Annotation.Color")};const Cu=["Footprint_Court_1k_TMap.jpg","spruit_sunrise_1k_LDR.jpg","campbell_env.jpg"];class Au extends j{constructor(){super(...arguments),this.ins=this.addInputs(Au.envIns),this._texture=null,this._currentIdx=0,this.shouldUseEnvMap=!1}get assetReader(){return this.getMainComponent(Rh)}update(){const e=this.ins,t=this.getGraphComponent(op);return e.dirty.changed&&(this.shouldUseEnvMap=!1,t.models.forEach((t=>{t.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(n.roughnessMap||n.metalnessMap)&&(this.shouldUseEnvMap=!0,null!==this._texture&&(this._texture.dispose(),this._texture=null),e.imageIndex.set())}))}))),e.imageIndex.changed&&this.shouldUseEnvMap&&(e.imageIndex.value==this._currentIdx&&null!==this._texture||(null!==this._texture&&this._texture.dispose(),this.assetReader.getSystemTexture("images/"+Cu[e.imageIndex.value]).then((e=>{t.models.forEach((t=>{t.object3D.traverse((t=>{const n=t.material;"Group"!==t.type&&n&&n.isUberPBRMaterial&&(this._texture=e,this._texture.mapping=q,n.envMap=this._texture,n.needsUpdate=!0)}))}))})),this._currentIdx=e.imageIndex.value)),!0}fromData(e){this.ins.copyValues({imageIndex:e.index})}toData(){return{index:this.ins.imageIndex.cloneValue()}}}var Pu;Au.typeName="CVEnvironment",Au.text="Environment",Au.envIns={imageIndex:x("Environment.Index",{preset:0,options:Cu.map((function(e,t){return t.toString()}))}),dirty:D("Environment.Dirty")},function(e){e[e.none=0]="none",e[e.menu=1]="menu",e[e.title=2]="title",e[e.logo=4]="logo",e[e.language=8]="language"}(Pu||(Pu={}));class Ru extends j{constructor(){super(...arguments),this.ins=this.addInputs(Ru.ins),this.outs=this.addOutputs(Ru.outs)}update(e){return!0}fromData(e){e=e||{},this.ins.setValues({visible:void 0===e.visible||e.visible,logo:void 0===e.logo||e.logo,menu:void 0===e.menu||e.menu,tools:void 0===e.tools||e.tools})}toData(){const e=this.ins;return{visible:e.visible.value,logo:e.logo.value,menu:e.menu.value,tools:e.tools.value}}isShowing(e){return(e&this.ins.visibleElements.value)===e}}Ru.typeName="CVInterface",Ru.ins={visible:C("Interface.Visible",!0),logo:C("Interface.Logo",!0),menu:C("Interface.Menu",!0),tools:C("Interface.Tools",!0),visibleElements:b("Interface.VisibleElements",15)},Ru.outs={documentTitle:A("Document.Title")};class Lu extends j{constructor(){super(...arguments),this._rootElement=null,this.ins=this.addInputs(Lu.ins),this.outs=this.addOutputs(Lu.outs)}get settingProperties(){return[this.ins.annotationsVisible,this.ins.activeTags,this.ins.sortedTags,this.ins.radioTags,this.ins.shader,this.ins.toneMapping,this.ins.exposure,this.ins.gamma]}get snapshotProperties(){return[this.ins.annotationsVisible,this.ins.activeAnnotation,this.ins.activeTags,this.ins.shader,this.ins.exposure]}get analytics(){return this.getMainComponent(Dh)}get renderer(){return this.getMainComponent(Ae)}get rootElement(){return this._rootElement}set rootElement(e){this._rootElement=e}create(){super.create(),this.graph.components.on(Zd,this.onModelComponent,this),this.graph.components.on(Tu,this.onAnnotationsComponent,this),this.graph.components.on(Lh,this.onLanguageComponent,this)}dispose(){this.graph.components.off(Zd,this.onModelComponent,this),this.graph.components.off(Tu,this.onAnnotationsComponent,this),this.graph.components.off(Lh,this.onLanguageComponent,this),super.dispose()}update(e){const t=this.ins;if(t.shader.changed){const e=t.shader.getValidatedValue();this.getGraphComponents(Zd).forEach((t=>t.ins.shader.setValue(e)))}if(t.exposure.changed&&this.renderer.ins.exposure.setValue(t.exposure.value),t.toneMapping.changed){this.renderer.views.forEach((e=>e.renderer.toneMapping=t.toneMapping.value?4:0));const e=this.renderer.activeScene;e&&e.traverse((e=>{const t=e;t.isMesh&&(Array.isArray(t.material)?t.material.forEach((e=>e.needsUpdate=!0)):t.material.needsUpdate=!0)}))}if(t.gamma.changed,t.quality.changed){const e=t.quality.getValidatedValue();this.getGraphComponents(Zd).forEach((t=>t.ins.quality.setValue(e)))}if(t.activeAnnotation.changed){const e=t.activeAnnotation.value;this.getGraphComponents(Tu).forEach((t=>t.setActiveAnnotationById(e)))}if(t.annotationsVisible.changed){const e=t.annotationsVisible.value;this.getGraphComponents(Tu).forEach((t=>t.ins.visible.setValue(e)))}if(t.activeTags.changed){const e=t.activeTags.value;this.getGraphComponents(Tu).forEach((t=>t.ins.activeTags.setValue(e))),this.getGraphComponents(Zd).forEach((t=>t.ins.activeTags.setValue(e)))}return t.sortedTags.changed&&this.refreshTagCloud(),!0}fromData(e){const t=this.ins;t.copyValues({shader:na[e.shader]||na.Default,exposure:void 0!==e.exposure?e.exposure:t.exposure.schema.preset,toneMapping:e.toneMapping||!1,gamma:void 0!==e.gamma?e.gamma:t.gamma.schema.preset,annotationsVisible:!!e.annotationsVisible,activeTags:e.activeTags||"",sortedTags:e.sortedTags||"",radioTags:void 0!==e.radioTags?!!e.radioTags:t.radioTags.schema.preset})}toData(){const e=this.ins,t={shader:na[e.shader.value],exposure:e.exposure.value,toneMapping:e.toneMapping.value,gamma:e.gamma.value};return e.annotationsVisible.value&&(t.annotationsVisible=!0),e.activeTags.value&&(t.activeTags=e.activeTags.value),e.sortedTags.value&&(t.sortedTags=e.sortedTags.value),e.radioTags.value&&(t.radioTags=e.radioTags.value),t}refreshTagCloud(){const e=new Set;this.getGraphComponents(Zd).forEach((t=>{t.ins.tags.value.split(",").map((e=>e.trim())).filter((e=>e)).forEach((t=>e.add(t)))}));const t=this.getGraphComponents(Tu),n=this.outs.tagCloud.value.split(",").map((e=>e.trim())).filter((e=>e));t.forEach((t=>{t.getAnnotations().forEach((t=>{t.tags.forEach((t=>{n.includes(t)||this.ins.activeTags.setValue(this.ins.activeTags.value+", "+t),e.add(t)}))}))}));const i=Array.from(e),s=this.ins.sortedTags.value.split(",").map((e=>e.trim())).filter((e=>e));i.sort(((e,t)=>{const n=s.indexOf(e),i=s.indexOf(t);return ni?1:0})),this.outs.tagCloud.setValue(i.join(", ")),this.ins.activeTags.set(),this.ins.annotationsVisible.set()}onAnnotationClick(e){const t=e.annotation?e.annotation.id:"";this.ins.activeAnnotation.setValue(t),this.rootElement.dispatchEvent(new CustomEvent("annotation-active",{detail:t}))}onModelComponent(e){const t=e.object;e.add?(t.on("tag-update",this.refreshTagCloud,this),t.on("model-load",this.onModelLoad,this)):e.remove&&(t.off("tag-update",this.refreshTagCloud,this),t.off("model-load",this.onModelLoad,this))}onAnnotationsComponent(e){const t=e.object;e.add?(t.on("tag-update",this.refreshTagCloud,this),t.on("click",this.onAnnotationClick,this),t.ins.visible.setValue(this.ins.annotationsVisible.value)):e.remove&&(t.off("tag-update",this.refreshTagCloud,this),t.off("click",this.onAnnotationClick,this))}onLanguageComponent(e){const t=e.object;e.add?t.on("tag-update",this.refreshTagCloud,this):e.remove&&t.off("tag-update",this.refreshTagCloud,this)}onModelLoad(e){this.rootElement.dispatchEvent(new CustomEvent("model-load",{detail:Wo[e.quality]}))}}Lu.typeName="CVViewer",Lu.text="Viewer",Lu.icon="",Lu.ins={annotationsVisible:C("Annotations.Visible"),activeAnnotation:A("Annotations.ActiveId"),activeTags:A("Tags.Active"),sortedTags:A("Tags.Sorted"),radioTags:C("Tags.Radio"),shader:R("Renderer.Shader",na),toneMapping:C("Renderer.ToneMapping",!1),exposure:b("Renderer.Exposure",1),gamma:b("Renderer.Gamma",2),quality:R("Models.Quality",Wo,Wo.High)},Lu.outs={tagCloud:A("Tags.Cloud")};const Nu=new Ln,Du=(new Ln,new Ve),Ou=new Ve,Iu=new je,ku=new Ze,zu=new Ue,Uu={PI:3.141592653589793,DOUBLE_PI:6.283185307179586,HALF_PI:1.5707963267948966,QUARTER_PI:.7853981633974483,DEG2RAD:.017453292519943295,RAD2DEG:57.29577951308232,composeOrbitMatrix:function(e,t,n){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z,c=Math.sin(i),h=Math.cos(i),u=Math.sin(s),d=Math.cos(s),p=Math.sin(r),m=Math.cos(r),f=d*m,g=m*u*c-p*h,v=m*u*h+p*c,y=d*p,b=c*u*p+m*h,x=p*u*h-m*c,_=-u,w=d*c,S=d*h,M=(n=n||new je).elements;return M[0]=f,M[1]=y,M[2]=_,M[3]=0,M[4]=g,M[5]=b,M[6]=w,M[7]=0,M[8]=v,M[9]=x,M[10]=S,M[11]=0,M[12]=o*f+a*g+l*v,M[13]=o*y+a*b+l*x,M[14]=o*_+a*w+l*S,M[15]=1,n},decomposeOrbitMatrix:function(e,t,n){ku.setFromRotationMatrix(e,"ZYX"),ku.toVector3(t),Iu.copy(e).invert(),Nu.set(0,0,0,1),Nu.applyMatrix4(Iu),n.x=-Nu.x,n.y=-Nu.y,n.z=-Nu.z},isMatrix4Identity:function(e){const t=e.elements;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]},decomposeTransformMatrix:function(e,t,n,i){Iu.fromArray(e),Iu.decompose(Du,zu,Ou),ku.setFromQuaternion(zu,"XYZ"),Du.toArray(t),Ou.toArray(i),ku.toVector3(Du),Nu.multiplyScalar(vt.RAD2DEG),Du.toArray(n)}},Vu=new je,Fu=new Lt,Bu=new Ve,ju=new Ve;var $u,Hu,Gu;!function(e){e[e.Orbit=0]="Orbit",e[e.FirstPerson=1]="FirstPerson"}($u||($u={})),function(e){e[e.Off=0]="Off",e[e.Pan=1]="Pan",e[e.Orbit=2]="Orbit",e[e.Dolly=3]="Dolly",e[e.Zoom=4]="Zoom",e[e.PanDolly=5]="PanDolly",e[e.Roll=6]="Roll"}(Hu||(Hu={})),function(e){e[e.Off=0]="Off",e[e.Active=1]="Active",e[e.Release=2]="Release"}(Gu||(Gu={}));class Wu{constructor(e){this.orbit=new Ve(0,0,0),this.offset=new Ve(0,0,50),this.minOrbit=new Ve(-90,-1/0,-1/0),this.maxOrbit=new Ve(90,1/0,1/0),this.minOffset=new Ve(-1/0,-1/0,.1),this.maxOffset=new Ve(1/0,1/0,1e3),this.orientationEnabled=!0,this.offsetEnabled=!0,this.mode=Hu.Off,this.phase=Gu.Off,this.prevPinchDist=0,this.deltaX=0,this.deltaY=0,this.deltaPinch=0,this.deltaWheel=0,this.viewportWidth=100,this.viewportHeight=100,this.camera=e}onPointer(e){if(e.isPrimary)if("pointer-down"===e.type)this.phase=Gu.Active;else if("pointer-up"===e.type)return this.phase=Gu.Release,!0;"pointer-down"===e.type&&(this.mode=this.getModeFromEvent(e));if(this.deltaX+=1*e.movementX,this.deltaY+=1*e.movementY,2===e.pointerCount){const t=e.activePositions,n=t[1].clientX-t[0].clientX,i=t[1].clientY-t[0].clientY,s=Math.sqrt(n*n+i*i),r=this.prevPinchDist||s;this.deltaPinch*=r>0?s/r:1,this.prevPinchDist=s}else this.deltaPinch=1,this.prevPinchDist=0;return!0}onTrigger(e){return"wheel"===e.type&&(this.deltaWheel+=vt.limit(e.wheel,-1,1),!0)}setViewportSize(e,t){this.viewportWidth=e,this.viewportHeight=t}updateController(e,t){const n=this.camera;e=e||n;const i=this.orbit,s=this.offset;Uu.decomposeOrbitMatrix(e.matrix,i,s),this.orbit.multiplyScalar(Uu.RAD2DEG),t&&(this.minOffset.min(s),this.maxOffset.max(s))}zoomExtents(e){const t=this.camera,n=this.offset;if(!t)return void console.warn("CameraController.zoomExtents - camera not set");Bu.copy(this.orbit).multiplyScalar(vt.DEG2RAD),ju.setScalar(0),Uu.composeOrbitMatrix(Bu,ju,Vu),Fu.copy(e).applyMatrix4(Vu.transpose()),Fu.getSize(Bu),Fu.getCenter(ju),n.x=ju.x,n.y=ju.y;const i=Math.max(Bu.x/t.aspect,Bu.y);if(t.isOrthographicCamera)n.z=1.1*i;else{const e=1/(2*Math.tan(t.fov*vt.DEG2RAD*.5));n.z=ju.z+i*e+.25*Bu.z}n.z>this.maxOffset.z&&(this.maxOffset.z=2*n.length())}updateCamera(e,t){const n=this.camera;return e=e||n,!(!this.update()&&!t)&&(Bu.copy(this.orbit).multiplyScalar(vt.DEG2RAD),ju.copy(this.offset),n.isOrthographicCamera&&(ju.z=this.maxOffset.z,n.size=this.offset.z,n.far=2*this.maxOffset.z,n.updateProjectionMatrix()),Uu.composeOrbitMatrix(Bu,ju,e.matrix),e.matrixWorldNeedsUpdate=!0,!0)}update(){if(this.phase===Gu.Off&&0===this.deltaWheel)return!1;if(0!==this.deltaWheel)return this.updatePose(0,0,.07*this.deltaWheel+1,0,0,0),this.deltaWheel=0,!0;if(this.phase===Gu.Active)return(0!==this.deltaX||0!==this.deltaY||1!==this.deltaPinch)&&(this.updateByMode(),this.deltaX=0,this.deltaY=0,this.deltaPinch=1,!0);if(this.phase===Gu.Release){this.deltaX*=.85,this.deltaY*=.85,this.deltaPinch=1,this.updateByMode();return Math.abs(this.deltaX)+Math.abs(this.deltaY)<.1&&(this.mode=Hu.Off,this.phase=Gu.Off),!0}return!1}updateByMode(){switch(this.mode){case Hu.Orbit:this.updatePose(0,0,1,this.deltaY,this.deltaX,0);break;case Hu.Pan:this.updatePose(this.deltaX,this.deltaY,1,0,0,0);break;case Hu.Roll:this.updatePose(0,0,1,0,0,this.deltaX);break;case Hu.Dolly:this.updatePose(0,0,.0075*this.deltaY+1,0,0,0);break;case Hu.PanDolly:const e=.42*(this.deltaPinch-1)+1;this.updatePose(.75*this.deltaX,.75*this.deltaY,1/e,0,0,0)}}updatePose(e,t,n,i,s,r){const{orbit:o,minOrbit:a,maxOrbit:l,offset:c,minOffset:h,maxOffset:u}=this;if(this.orientationEnabled&&(o.x+=-1*i*220/this.viewportHeight,o.y+=-1*s*220/this.viewportHeight,o.z+=-1*r*220/this.viewportHeight,o.x=vt.limit(o.x,a.x,l.x),o.y=vt.limit(o.y,a.y,l.y),o.z=vt.limit(o.z,a.z,l.z)),this.offsetEnabled){const i=c.z=n*c.z;c.x+=e*i*-1/this.viewportHeight,c.y-=t*i*-1/this.viewportHeight,c.x=vt.limit(c.x,h.x,u.x),c.y=vt.limit(c.y,h.y,u.y),c.z=vt.limit(c.z,h.z,u.z)}}getModeFromEvent(e){if("mouse"===e.source){const t=e.originalEvent.button;if(0===t)return e.ctrlKey?Hu.Pan:e.altKey?Hu.Dolly:Hu.Orbit;if(2===t)return e.altKey?Hu.Roll:Hu.Pan;if(1===t)return Hu.Dolly}else if("touch"===e.source){const t=e.pointerCount;return 1===t?Hu.Orbit:2===t?Hu.PanDolly:Hu.Pan}}}const qu=.5*Math.PI,Xu=new Lt,Yu=new Ve,Ku=new Ve,Ju=new Ve,Zu=new je,Qu=(new je,[new Ve(0,-qu,0),new Ve(0,qu,0),new Ve(-qu,0,0),new Ve(qu,0,0),new Ve(0,0,0),new Ve(0,Math.PI,0)]);var ed,td,nd;!function(e){e[e.Perspective=0]="Perspective",e[e.Orthographic=1]="Orthographic"}(ed||(ed={})),function(e){e[e.None=-1]="None",e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Top=2]="Top",e[e.Bottom=3]="Bottom",e[e.Front=4]="Front",e[e.Back=5]="Back"}(td||(td={}));class id extends tl{constructor(e){super(),this.isUniversalCamera=!0,this.fov=50,this.size=20,this.aspect=1,this.distance=20,this.zoom=1,this.near=.1,this.far=2e3,this.focus=10,this.filmGauge=35,this.filmOffset=0,this.view=null,this.setProjection(e)}setProjection(e){e===ed.Orthographic?(this.type="OrthographicCamera",this.isPerspectiveCamera=!1,this.isOrthographicCamera=!0):(this.type="PerspectiveCamera",this.isPerspectiveCamera=!0,this.isOrthographicCamera=!1),this.updateProjectionMatrix()}getProjection(){return this.isOrthographicCamera?ed.Orthographic:ed.Perspective}setPreset(e){e!==td.None?(this.rotation.setFromVector3(Qu[e],"XYZ"),this.position.set(0,0,this.distance).applyQuaternion(this.quaternion)):(this.rotation.set(0,0,0),this.position.set(0,0,0)),this.updateMatrix()}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Le*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Re*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Le*Math.atan(Math.tan(.5*Re*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,r){this.isPerspectiveCamera?rl.prototype.setViewOffset.call(this,e,t,n,i,s,r):nl.prototype.setViewOffset.call(this,e,t,n,i,s,r)}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}zoomToView(){}moveToView(e){this.updateMatrixWorld(!1),Xu.copy(e),Zu.extractRotation(this.matrixWorldInverse),Xu.applyMatrix4(Zu),Xu.getSize(Yu),Xu.getCenter(Ku);const t=Math.max(Yu.x/this.aspect,Yu.y);Ju.set(-Ku.x,-Ku.y,0),this.isPerspectiveCamera?Ju.z=Yu.z/(2*Math.tan(this.fov*vt.DEG2RAD*.5)):(this.size=.5*t,Ju.z=2*Yu.z,this.far=Math.max(this.far,2*Ju.z)),Zu.extractRotation(this.matrixWorld),Ju.applyMatrix4(Zu),this.matrix.decompose(this.position,this.quaternion,this.scale),this.position.copy(Ju),this.updateMatrix()}updateProjectionMatrix(){const e=this.near,t=this.far,n=this.aspect,i=this.zoom,s=this.view;if(this.isOrthographicCamera){const r=this.size,o=r/(2*i),a=o*n;let l=-a,c=a,h=o,u=-o;if(s&&s.enabled){const e=i/(s.width/s.fullWidth),t=i/(s.height/s.fullHeight),o=r*n/s.width,a=r/s.height;l+=o*(s.offsetX/e),c=l+o*(s.width/e),h-=a*(s.offsetY/t),u=h-a*(s.height/t)}this.projectionMatrix.makeOrthographic(l,c,h,u,e,t)}else{let o=e*Math.tan(.5*Re*this.fov)/i,a=2*o,l=n*a,c=-.5*l;s&&s.enabled&&(c+=s.offsetX*l/s.fullWidth,o-=s.offsetY*a/s.fullHeight,l*=s.width/s.fullWidth,a*=s.height/s.fullHeight);var r=this.filmOffset;0!==r&&(c+=e*r/this.getFilmWidth()),this.projectionMatrix.makePerspective(c,c+l,o,o-a,e,t)}this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}copy(e,t){return super.copy(e,t),this.type=e.type,this.isOrthographicCamera=e.isOrthographicCamera,this.isPerspectiveCamera=e.isPerspectiveCamera,this.fov=e.fov,this.size=e.size,this.aspect=e.aspect,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.view=e.view?Object.assign({},e.view):null,this}clone(){return(new this.constructor).copy(this)}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.size=this.size,t.object.aspect=this.aspect,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}!function(e){e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Top=2]="Top",e[e.Bottom=3]="Bottom",e[e.Front=4]="Front",e[e.Back=5]="Back",e[e.None=6]="None"}(nd||(nd={}));const sd=[];sd[nd.Left]=[0,-90,0],sd[nd.Right]=[0,90,0],sd[nd.Front]=[0,0,0],sd[nd.Back]=[0,180,0],sd[nd.Top]=[-90,0,0],sd[nd.Bottom]=[90,0,0];const rd=function(e,t){for(let n=0,i=e.length;ne.outs.updated.changed))&&e.update(null),this._modelBoundingBox=e.outs.boundingBox.value,t.zoomExtents(this._modelBoundingBox),n.ins.zoom.set()}return!0}tick(){const e=this.ins,t=this._scene.activeCameraComponent;if(!e.enabled.value||!t)return;const n=this._controller;n.camera=t.camera;const i=t.transform,s=this.changed;return!!n.updateCamera(i.object3D,s)&&(n.orbit.toArray(e.orbit.value),e.orbit.set(!0),n.offset.toArray(e.offset.value),e.offset.set(!0),e.preset.value===nd.None||e.preset.changed||e.preset.setValue(nd.None,!0),i?i.setPropertiesFromMatrix():t.setPropertiesFromMatrix(),!0)}preRender(e){this._modelBoundingBox&&e.viewport.zoomExtents(this._modelBoundingBox)}setChanged(e){this._hasChanged=e}tock(){return this._modelBoundingBox=null,!1}fromData(e){const t=(e=e||{}).orbit||{orbit:[-25,-25,0],offset:[0,0,100],minOrbit:[-90,-1/0,-1/0],minOffset:[-1/0,-1/0,.1],maxOrbit:[90,1/0,1/0],maxOffset:[1/0,1/0,1/0]};this.ins.copyValues({enabled:!!e.enabled,autoZoom:!!e.autoZoom,autoRotation:!!e.autoRotation,lightsFollowCamera:!!e.lightsFollowCamera,orbit:t.orbit,offset:t.offset,minOrbit:rd(t.minOrbit,-1/0),maxOrbit:rd(t.maxOrbit,1/0),minOffset:rd(t.minOffset,-1/0),maxOffset:rd(t.maxOffset,1/0)})}toData(){const e=this.ins,t={};return t.enabled=e.enabled.value,t.autoZoom=e.autoZoom.value,t.autoRotation=e.autoRotation.value,t.lightsFollowCamera=e.lightsFollowCamera.value,t.type="Orbit",t.orbit={orbit:e.orbit.cloneValue(),offset:e.offset.cloneValue(),minOrbit:e.minOrbit.cloneValue(),maxOrbit:e.maxOrbit.cloneValue(),minOffset:e.minOffset.cloneValue(),maxOffset:e.maxOffset.cloneValue()},t}getLightTransform(){const e=this.graph.findNodeByName("Lights");return e&&e.getComponent(Rt,!0)}onPointer(e){const t=e.viewport;t.camera||(this.ins.enabled.value&&this._scene.activeCameraComponent&&(this._controller.setViewportSize(t.width,t.height),this._controller.onPointer(e),e.stopPropagation=!0),this._hasChanged=!0)}onTrigger(e){const t=e.viewport;t.camera||(this.ins.enabled.value&&this._scene.activeCameraComponent&&(this._controller.setViewportSize(t.width,t.height),this._controller.onTrigger(e),e.stopPropagation=!0),this._hasChanged=!0)}onLoadingCompleted(e){this.ins.autoZoom.value&&!this._hasChanged&&this.ins.zoomExtents.set()}}var ad;od.typeName="CVOrbitNavigation",od.text="Orbit Navigation",od.icon="",od.ins={enabled:C("Settings.Enabled",!0),pointerEnabled:C("Settings.PointerEnabled",!0),preset:R("Camera.ViewPreset",nd,nd.None),projection:R("Camera.Projection",ed,ed.Perspective),lightsFollowCamera:C("Navigation.LightsFollowCam",!0),autoRotation:C("Navigation.AutoRotation",!1),zoomExtents:D("Settings.ZoomExtents"),autoZoom:C("Settings.AutoZoom",!0),orbit:w("Current.Orbit",[-25,-25,0]),offset:w("Current.Offset",[0,0,100]),minOrbit:w("Limits.Min.Orbit",[-90,-1/0,-1/0]),minOffset:w("Limits.Min.Offset",[-1/0,-1/0,.1]),maxOrbit:w("Limits.Max.Orbit",[90,1/0,1/0]),maxOffset:w("Limits.Max.Offset",[1/0,1/0,1/0])},function(e){e[e.Solid=0]="Solid",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient"}(ad||(ad={}));class ld extends ui{constructor(){super(new cd,new hd),this.frustumCulled=!1,this.renderOrder=-1/0,this.matrixAutoUpdate=!1}dispose(){this.geometry.dispose(),this.material.dispose()}updateMatrixWorld(e){}}class cd extends qn{constructor(){super();const e=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),t=new yl(e,5);this.setIndex([0,1,2,0,2,3]),this.setAttribute("position",new xl(t,3,0,!1)),this.setAttribute("uv",new xl(t,2,3,!1))}}class hd extends uu{constructor(){super(...arguments),this.depthTest=!1,this.depthWrite=!1,this.transparent=!1,this.uniforms={style:{value:ad.LinearGradient},color0:{value:new Ve(.15,.2,.25)},color1:{value:new Ve(0,0,0)},noise:{value:.02}},this.vertexShader=["precision highp float;","attribute vec3 position;","attribute vec2 uv;","varying vec2 ndc;","void main() {"," ndc = position.xy;"," gl_Position = vec4(position, 1.0);","}"].join("\n"),this.fragmentShader=["precision highp float;","uniform vec3 color0;","uniform vec3 color1;","uniform float noise;","uniform int style;","varying vec2 ndc;","float rand(vec2 co) {","float dt = dot(co.xy ,vec2(12.9898, 78.233));","float sn = mod(dt, 3.14);","return fract(sin(sn) * 43758.5453);","}","void main() {"," float f = style == 0 ? 0.0 : (style == 1 ? ndc.y * 0.5 + 0.5 : length(ndc) * 0.707);"," gl_FragColor = vec4(mix(color0, color1, f) + noise * rand(ndc), 1.0);","}"].join("\n")}set style(e){this.uniforms.style.value=e}get style(){return this.uniforms.style.value}set color0(e){if(e instanceof Pn){const t=this.uniforms.color0.value;t.x=e.r,t.y=e.g,t.z=e.b}else this.uniforms.color0.value.copy(e)}get color0(){return this.uniforms.color0.value}set color1(e){if(e instanceof Pn){const t=this.uniforms.color1.value;t.x=e.r,t.y=e.g,t.z=e.b}else this.uniforms.color1.value.copy(e)}get color1(){return this.uniforms.color1.value}set noise(e){this.uniforms.noise.value=e}get noise(){return this.uniforms.noise.value}}class ud extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(ud.backgroundIns),this.object3D=new ld}get background(){return this.object3D}update(e){super.update(e);const t=this.ins,n=this.background.material;return t.style.changed&&(n.style=t.style.getValidatedValue()),t.color0.changed&&n.color0.fromArray(t.color0.value),t.color1.changed&&n.color1.fromArray(t.color1.value),t.noise.changed&&(n.noise=t.noise.value),!0}dispose(){this.background.dispose(),super.dispose()}}ud.typeName="CBackground",ud.backgroundIns={style:R("Background.Style",ad,ad.RadialGradient),color0:T("Background.Color0",[.2,.25,.3]),color1:T("Background.Color1",[.01,.03,.05]),noise:b("Background.Noise",{min:0,max:1,bar:!0,preset:.02})};class dd extends ud{constructor(e,t){super(e,t),this.background.layers.set(1)}get settingProperties(){return[this.ins.style,this.ins.color0,this.ins.color1]}get snapshotProperties(){return[this.ins.color0,this.ins.color1]}hide(){this.background.visible=!1}show(){this.background.visible=!0}fromData(e){this.ins.copyValues({style:ad[e.style]||ad.Solid,color0:e.color0||[.2,.25,.3],color1:e.color1||[.01,.03,.05]})}toData(){const e=this.ins;return{style:ad[e.style.value],color0:e.color0.cloneValue(),color1:e.color1.cloneValue()}}}dd.typeName="CVBackground";const pd=n(3523).Z,md=n(2001).Z;class fd extends ui{constructor(){super(new pi(2,2,1,1),new gd),this.geometry.rotateX(-90*Re),this.receiveShadow=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class gd extends uh{constructor(e){super(e),this.defines={},this.type="FloorMaterial",this.isMeshPhongMaterial=!0,this.isFloorMaterial=!0,this.defines={},this.uniforms=xo.merge([ta.phong.uniforms]),this.vertexShader=md,this.fragmentShader=pd,this.transparent=!0,this.shininess=0}}class vd extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(vd.floorIns),this.object3D=new fd}get floor(){return this.object3D}update(e){super.update(e);const t=this.ins,n=this.floor;return(t.position.changed||t.radius.changed)&&(n.position.fromArray(t.position.value),n.scale.setScalar(t.radius.value),n.updateMatrix()),t.color.changed&&n.material.color.fromArray(t.color.value),t.opacity.changed&&(n.material.opacity=t.opacity.value),!0}dispose(){this.floor.dispose(),super.dispose()}}vd.typeName="CFloor",vd.floorIns={position:w("Floor.Position",[0,-25,0]),radius:b("Floor.Radius",50),color:T("Floor.Color",[.6,.75,.8]),opacity:_("Floor.Opacity",.5),castShadow:C("Shadow.Cast"),receiveShadow:C("Shadow.Receive")};const yd=new Ve;class bd extends vd{constructor(e,t){super(e,t),this.addIns=this.addInputs(bd.floorAddIns),this.ins.visible.setValue(!1),this.ins.receiveShadow.setValue(!0),this.floor.renderOrder=-1}get settingProperties(){return[this.ins.visible,this.ins.position,this.ins.radius,this.ins.color,this.ins.opacity,this.ins.receiveShadow,this.addIns.autoSize]}get snapshotProperties(){return[this.ins.opacity]}get sceneNode(){return this.getSystemComponent(op)}create(){super.create(),this.sceneNode.outs.boundingBox.on("value",this.recalculateSize,this)}dispose(){this.sceneNode.outs.boundingBox.off("value",this.recalculateSize,this),super.dispose()}update(e){const t=this.addIns;return t.autoSize.changed&&t.autoSize.value&&this.recalculateSize(),super.update(e),!0}recalculateSize(){const{addIns:e}=this;if(e.autoSize.value){const e=this.sceneNode.outs.boundingBox.value;e.getSize(yd);const t=Math.max(yd.x,yd.y,yd.z),{min:n,max:i}=e;this.ins.radius.setValue(t),this.ins.position.setValue([(n.x+i.x)/2,n.y,(n.z+i.z)/2])}}fromData(e){e=e||{},this.ins.copyValues({visible:!!e.visible,position:e.position||[0,-25,0],radius:void 0!==e.size?e.size:50,color:e.color||[.6,.75,.8],opacity:void 0!==e.opacity?e.opacity:.5,receiveShadow:!!e.receiveShadow})}toData(){const e=this.ins;return{visible:e.visible.value,position:e.position.cloneValue(),size:e.radius.value,color:e.color.cloneValue(),opacity:e.opacity.value,receiveShadow:e.receiveShadow.value}}}bd.typeName="CVFloor",bd.text="Floor",bd.icon="",bd.floorAddIns={autoSize:C("Floor.AutoSize",!0)};class xd extends Is{constructor(e){super(xd.generate(e),new Ts({color:4294967295,vertexColors:!0}))}set opacity(e){this.material.opacity=e,this.material.transparent=e<1}update(e){this.geometry&&this.geometry.dispose(),this.geometry=xd.generate(e)}static generate(e){const t=new Pn(e.mainColor),n=new Pn(e.subColor),i=e.mainDivisions*e.subDivisions,s=e.size/i,r=.5*e.size,o=[],a=[];for(let l=0,c=0,h=-r;l<=i;++l,h+=s){o.push(-r,0,h,r,0,h),o.push(h,0,-r,h,0,r);const i=l%e.subDivisions==0?t:n;i.toArray(a,c),c+=3,i.toArray(a,c),c+=3,i.toArray(a,c),c+=3,i.toArray(a,c),c+=3}const l=new qn;return l.setAttribute("position",new zn(o,3)),l.setAttribute("color",new zn(a,3)),l}}const _d=new Ve,wd=new Ve,Sd=(new je).makeRotationX(.5*Math.PI),Md=new je;class Ed extends zo{constructor(){super(...arguments),this.ins=this.addInputs(Ed.gridIns),this.outs=this.addOutputs(Ed.gridOuts),this._lastViewport=null,this._gridProps={size:20,mainDivisions:2,subDivisions:10,mainColor:new Pn(.5,.7,.8),subColor:new Pn(.25,.35,.4)}}get settingProperties(){return[this.ins.visible,this.ins.color,this.ins.opacity]}get snapshotProperties(){return[this.ins.opacity]}get grid(){return this.object3D}create(){this.ins.pickable.setValue(!1),this.ins.visible.setValue(!1),super.create()}activate(){this.getGraphComponent(op).outs.boundingBox.linkTo(this.ins.boundingBox)}update(){const e=this.ins;if(e.color.changed||e.boundingBox.changed){const t=this._gridProps;if(e.color.changed){const n=t.mainColor,i=t.subColor;n.fromArray(e.color.value),i.r=.5*n.r,i.g=.5*n.g,i.b=.5*n.b}if(e.boundingBox.changed){const e=this.getGraphComponent(op),n=e.outs.boundingBox.value,i=e.ins.units.value;n.getSize(_d);let s=Math.max(_d.x,_d.y,_d.z),r=1;for(;s/r>5;)r*=10;s=Math.ceil(s/r)*r*2,t.size=s,this.outs.size.setValue(s),this.outs.units.setValue(i),t.mainDivisions=s/r,t.subDivisions=10,wd.set(0,n.min.y,0)}this.object3D?this.grid.update(t):this.object3D=new xd(t),e.boundingBox.changed&&(this.grid.position.copy(wd),this.grid.updateMatrix())}return e.visible.changed&&(this.grid.visible=e.visible.value),e.opacity.changed&&(this.grid.opacity=e.opacity.value),!0}preRender(e){const t=e.viewport,n=this.object3D;if(t!==this._lastViewport){this._lastViewport=t;const i=e.viewport.camera;i?n.matrix.extractRotation(i.matrixWorld).multiply(Sd):n.matrix.extractRotation(Md),n.updateMatrixWorld(!0)}}postRender(e){this.object3D.matrix.extractRotation(Md)}fromData(e){e=e||{},this.ins.copyValues({visible:!!e.visible,color:e.color||[.5,.7,.8]})}toData(){const e=this.ins;return{visible:e.visible.cloneValue(),color:e.color.cloneValue()}}}Ed.typeName="CVGrid",Ed.text="Grid",Ed.icon="",Ed.gridIns={color:T("Grid.Color",[.5,.7,.8]),opacity:_("Grid.Opacity",1),boundingBox:N("Scene.BoundingBox",Lt)},Ed.gridOuts={size:b("Size"),units:R("Units",gs)};class Td extends qn{constructor(e=[new sn(0,.5),new sn(.5,0),new sn(0,-.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=De(i,0,2*Math.PI);const s=[],r=[],o=[],a=[],l=[],c=1/t,h=new Ve,u=new sn,d=new Ve,p=new Ve,m=new Ve;let f=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case e.length-1:a.push(m.x,m.y,m.z);break;default:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),a.push(d.x,d.y,d.z),m.copy(p)}for(let s=0;s<=t;s++){const d=n+s*c*i,p=Math.sin(d),m=Math.cos(d);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*m,r.push(h.x,h.y,h.z),u.x=s/t,u.y=n/(e.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*m;l.push(i,c,d)}}for(let n=0;n{e.object3D.traverse((e=>{if(e.isMesh){const t=e.material;t.isUberPBRMaterial&&this.updateMaterial(t)}}))})),!0}fromData(e){e=e||{},this.ins.setValues({enabled:e.enabled||!1,axis:oa[e.axis]||oa.X,position:e.position||0,inverted:e.inverted||!1})}toData(){const e=this.ins;return{enabled:e.enabled.value,axis:oa[e.axis.getValidatedValue()],position:e.position.value,inverted:e.inverted.value}}updateMaterial(e){const t=this.ins;t.enabled.changed&&(e.enableCutPlane(t.enabled.value),e.needsUpdate=!0),e.cutPlaneDirection.fromArray(this.plane),e.cutPlaneColor.fromArray(t.color.value)}}Id.typeName="CVSlicer",Id.text="Slicer",Id.icon="",Id.ins={enabled:C("Slice.Enabled"),axis:R("Slice.Axis",oa),position:b("Slice.Position",{min:0,max:1,preset:.5}),inverted:C("Slice.Inverted"),color:T("Slice.Color",[0,.61,.87]),boundingBox:N("Scene.BoundingBox",Lt)};const kd=Math.PI,zd=.5*kd;var Ud;!function(e){e[e.Linear=0]="Linear",e[e.EaseQuad=1]="EaseQuad",e[e.EaseInQuad=2]="EaseInQuad",e[e.EaseOutQuad=3]="EaseOutQuad",e[e.EaseCubic=4]="EaseCubic",e[e.EaseInCubic=5]="EaseInCubic",e[e.EaseOutCubic=6]="EaseOutCubic",e[e.EaseQuart=7]="EaseQuart",e[e.EaseInQuart=8]="EaseInQuart",e[e.EaseOutQuart=9]="EaseOutQuart",e[e.EaseQuint=10]="EaseQuint",e[e.EaseInQuint=11]="EaseInQuint",e[e.EaseOutQuint=12]="EaseOutQuint",e[e.EaseSine=13]="EaseSine",e[e.EaseInSine=14]="EaseInSine",e[e.EaseOutSine=15]="EaseOutSine"}(Ud||(Ud={}));const Vd={Linear:function(e){return e},EaseQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},EaseInQuad:function(e){return e*e},EaseOutQuad:function(e){return e*(2-e)},EaseCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},EaseInCubic:function(e){return e*e*e},EaseOutCubic:function(e){return--e*e*e+1},EaseQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},EaseInQuart:function(e){return e*e*e*e},EaseOutQuart:function(e){return 1- --e*e*e*e},EaseQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},EaseInQuint:function(e){return e*e*e*e*e},EaseOutQuint:function(e){return 1+--e*e*e*e*e},EaseSine:function(e){return-.5*(Math.cos(e*kd)-1)},EaseInSine:function(e){return 1-Math.cos(e*zd)},EaseOutSine:function(e){return Math.sin(e*zd)}};class Fd extends j{constructor(){super(...arguments),this.ins=this.addInputs(Fd.ins),this.outs=this.addOutputs(Fd.outs),this.targets=[],this.states={},this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null}getState(e){return this.states[e]}setState(e){return e.id=e.id||I(6),this.states[e.id]=e,e.id}deleteState(e){delete this.states[e]}clear(){this.targets.forEach((e=>e.property.off("dispose",this.onPropertyDispose,this))),this.targets.length=0,this.states={},this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null}dispose(){this.clear(),super.dispose()}tweenTo(e,t){const n=this.states[e],i=this.outs;if(n)return this._targetState=n,this._currentValues=this.getCurrentValues(),this._startTime=t,this._easingFunction=(s=n.curve,Vd[Ud[s]]),i.switched.setValue(!1),i.tweening.setValue(!0),i.start.set(),!0;var s}update(e){const t=this.ins,n=this.states,i=t.id.value,s=n[i];if(s){if((t.tween.changed||t.recall.changed)&&(t.curve.setValue(s.curve),t.duration.setValue(s.duration),t.threshold.setValue(s.threshold)),t.tween.changed)return this.tweenTo(i,e.secondsElapsed),!0;if(t.recall.changed)return this.setValues(s.values),!0;(t.curve.changed||t.duration.changed||t.threshold.changed)&&(s.curve=t.curve.value,s.duration=t.duration.value,s.threshold=t.threshold.value),t.store.changed&&(s.values=this.getCurrentValues()),t.delete.changed&&delete n[i]}else if(i&&t.store.changed){const e={id:this.ins.id.value,curve:this.ins.curve.getValidatedValue(),duration:this.ins.duration.value,threshold:this.ins.threshold.value,values:this.getCurrentValues()};n[e.id]=e}return!0}tick(e){const t=this._targetState;if(!t)return!1;const n=this.outs,i=this._currentValues,s=this._startTime,r=e.secondsElapsed-s,o=r/t.duration;if(o<1){const e=this._easingFunction(o),s=o>=t.threshold&&!n.switched.value;this.setValues(i,t.values,e,s),n.time.setValue(r),n.completed.setValue(o),s&&(n.switched.setValue(!0),n.switch.set())}else this.setValues(i,t.values,1,!n.switched.value),n.tweening.setValue(!1),n.time.setValue(t.duration),n.completed.setValue(1),n.end.set(),n.switched.value||n.switched.setValue(!0),this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null;return!0}addTargetProperty(e){if("object"===e.type||e.schema.event)throw new Error("can't add object or event properties");if(this.getTarget(e))throw new Error("can't add, target already exists");e.on("dispose",this.onPropertyDispose,this);const t="number"===e.type&&!e.schema.options,n=e.isArray();this.targets.push({property:e,isNumber:t,isArray:n});const i=this.states,s=Object.keys(i);for(let t=0,n=s.length;t{const t=this.getProperty(e.id,e.key);return{property:t,isNumber:!!t&&"number"===t.type&&!t.schema.options,isArray:!!t&&t.isArray()}}))),e.states&&e.states.forEach((e=>this.states[e.id]=e)),this._startTime=0}toJSON(){const e=super.toJSON(),t=this.stateToJSON();return t&&(e.state=t),e}stateToJSON(){const e={},t=this.targets;t.length>0&&(e.targets=t.map((e=>({id:e.property.group.linkable.id,key:e.property.key}))));const n=Object.keys(this.states);return n.length>0&&(e.states=n.map((e=>this.states[e]))),e}getTargetProperties(){return this.targets.map((e=>e.property))}onPropertyDispose(e){e.property.off("dispose",this.onPropertyDispose,this);const t=this.getTarget(e.property);this.removeTarget(t)}removeTarget(e){const t=this.targets.indexOf(e);this.targets.splice(t,1),this.removeChannel(t)}removeChannel(e){const t=this.states,n=Object.keys(t);for(let i=0,s=n.length;it.property===e))}getProperty(e,t){const n=this.system.components.getById(e);return n?n.ins[t]:null}setValues(e,t,n,i){const s=this.targets;for(let r=0,o=s.length;r{this.targetFeatures[e]=!1})),this.targetFeatures.models=!1,this.targetFeatures.lights=!1,this.initializeTargetFeatures()}initializeTargetFeatures(){const e=this.targetFeatures;Object.keys(e).forEach((t=>e[t]=!1)),e.navigation=!0,e.reader=!0,this.updateTargets()}updateTargets(){const e=this.targetFeatures,t=this.getGraphComponent(qd);Object.keys(e).forEach((n=>{const i=t[n],s=e[n];i&&this.updateComponentTarget(i,s)}));this.getGraphComponents(Zd).forEach((t=>this.updateComponentTarget(t.transform,!!e.models)));this.getGraphComponents($d).forEach((t=>this.updateComponentTarget(t,!!e.lights)))}updateComponentTarget(e,t){const n=e.snapshotProperties;n&&n.forEach((e=>{if(!e.schema.event&&"object"!==e.type){const n=this.hasTargetProperty(e);t&&!n?this.addTargetProperty(e):!t&&n&&this.removeTargetProperty(e)}}))}fromData(e,t){this.clear();const n=this.targetFeatures,i=Object.keys(n);e.features?i.forEach((t=>n[t]=e.features.indexOf(t)>=0)):this.initializeTargetFeatures();const s=new Set;e.targets.forEach(((e,n)=>{const i=e.lastIndexOf("/"),r=e.substr(0,i),o=e.substr(i+1),a=t.get(r),l=a?a.ins[o]:null;l?this.addTargetProperty(l):(console.warn(`missing snapshot target property for '${e}'`),s.add(n))})),e.states.forEach((e=>{this.setState({id:e.id,curve:void 0!==e.curve?Ud[e.curve]:Ud.EaseQuad,duration:void 0!==e.duration?e.duration:2,threshold:void 0!==e.threshold?e.threshold:.5,values:e.values.filter(((e,t)=>!s.has(t)))})}))}toData(e){const t=this.targetFeatures,n={features:Object.keys(t).filter((e=>t[e])),targets:this.targets.map((t=>{const n=t.property.group.linkable,i=t.property.key,s=e.get(n);if(!s)throw new Error(`snapshot path not registered for component '${n.displayName}'`);return s+"/"+i})),states:Object.keys(this.states).map((e=>{const t=this.states[e],n={id:t.id,values:t.values};return t.curve!==Ud.EaseQuad&&(n.curve=Ud[t.curve]),2!==t.duration&&(n.duration=t.duration),.5!==t.threshold&&(n.threshold=t.threshold),n}))};return n.targets.length>0&&n.states.length>0?n:null}}Hd.typeName="CVSnapshots";class Gd extends j{constructor(){super(...arguments),this.ins=this.addInputs(Gd.ins),this.outs=this.addOutputs(Gd.outs),this._tours=[]}get analytics(){return this.getMainComponent(Dh)}get language(){return this.getGraphComponent(Lh)}get setup(){return this.getGraphComponent(qd)}get snapshots(){return this.getComponent(Hd)}get tours(){return this._tours}get activeSteps(){const e=this.activeTour;return e?e.steps:null}get activeTour(){return this._tours[this.outs.tourIndex.value]}get activeStep(){const e=this.activeTour;return e?e.steps[this.outs.stepIndex.value]:null}get title(){const e=this.activeTour;return 0===Object.keys(e.titles).length&&(e.titles.EN=e.title),e.titles[vs[this.language.outs.language.value]]||"undefined"}set title(e){this.activeTour.titles[vs[this.language.outs.language.value]]=e}get lead(){const e=this.activeTour;return 0===Object.keys(e.leads).length&&(e.leads.EN=e.lead),e.leads[vs[this.language.outs.language.value]]||""}set lead(e){this.activeTour.leads[vs[this.language.outs.language.value]]=e}get taglist(){const e=this.activeTour;return 0===Object.keys(e.taglist).length&&e.tags.length>0&&(e.taglist.EN=e.tags),e.taglist[vs[this.language.outs.language.value]]||[]}set taglist(e){this.activeTour.taglist[vs[this.language.outs.language.value]]=e}get stepTitle(){const e=this.activeStep;return e?(0===Object.keys(e.titles).length&&(e.titles.EN=e.title),e.titles[vs[this.language.outs.language.value]]||"undefined"):null}set stepTitle(e){const t=this.activeStep;t&&(t.titles[vs[this.language.outs.language.value]]=e)}create(){super.create(),this.language.outs.language.on("value",this.update,this)}dispose(){this.language.outs.language.off("value",this.update,this),super.dispose()}update(e){const{ins:t,outs:n}=this,i=this._tours,s=this.snapshots,r=this.setup.navigation;if(t.enabled.changed){if(!t.enabled.value)return n.tourIndex.set(),s.tweenTo(Gd.sceneSnapshotId,e.secondsElapsed),s.deleteState(Gd.sceneSnapshotId),!0;{const e={id:Gd.sceneSnapshotId,curve:Ud.EaseOutQuad,duration:1,threshold:0,values:s.getCurrentValues()};s.setState(e)}}const o=Math.min(i.length-1,Math.max(-1,t.tourIndex.value)),a=i[o],l=a?a.steps.length:0;n.stepCount.setValue(l);let c=-1;if((t.tourIndex.changed||t.enabled.changed)&&(o!==n.tourIndex.value&&(c=0),n.tourIndex.setValue(o),n.tourTitle.setValue(a?this.title:""),n.tourLead.setValue(a?this.lead:"")),0===l)return n.stepIndex.setValue(-1),n.stepTitle.setValue(""),!0;let h=!0;if(t.enabled.changed&&(c=n.stepIndex.value),t.stepIndex.changed&&(c=Math.min(a.steps.length-1,Math.max(0,t.stepIndex.value)),h=!1),t.first.changed&&(c=0),t.next.changed&&(c=n.stepIndex.value+1,c>=l&&(n.ending.setValue(!0),n.tourIndex.setValue(-1),n.tourTitle.setValue(""),n.tourLead.setValue(""),n.stepIndex.set(),c=-1)),t.previous.changed&&(c=(n.stepIndex.value+l-1)%l),c>=0){r.setChanged(!0);const e=a.steps[c];n.stepIndex.setValue(c),n.stepTitle.setValue(this.stepTitle||"undefined"),s.ins.id.setValue(e.id),h?s.ins.tween.set():s.ins.recall.set()}return!0}fromData(e){this._tours=e.map((e=>({title:e.title,titles:e.titles||{},steps:e.steps.map((e=>({title:e.title,titles:e.titles||{},id:e.id}))),lead:e.lead||"",leads:e.leads||{},tags:e.tags||[],taglist:e.taglist||{}}))),this._tours.forEach((e=>{Object.keys(e.titles).forEach((e=>{this.language.addLanguage(vs[e])})),e.steps.forEach((e=>{0==Object.keys(e.titles).length&&(e.titles.EN=e.title||null)}))})),this.ins.tourIndex.setValue(-1),this.outs.count.setValue(this._tours.length)}toData(){return 0===this._tours.length?null:this._tours.map((e=>{const t={steps:e.steps.map((e=>{const t={};return t.id=e.id,Object.keys(e.titles).length>0?t.titles=e.titles:e.title&&(t.title=e.title),t}))};return Object.keys(e.titles).length>0?t.titles=e.titles:e.title&&(t.title=e.title),Object.keys(e.leads).length>0?t.leads=e.leads:e.lead&&(t.lead=e.lead),Object.keys(e.taglist).length>0?t.taglist=e.taglist:e.tags.length>0&&(t.tags=e.tags),t}))}}Gd.typeName="CVTours",Gd.sceneSnapshotId="scene-default",Gd.ins={enabled:C("Tours.Enabled"),tourIndex:x("Tours.Index",-1),closed:D("Tours.Closed"),stepIndex:x("Step.Index"),next:D("Step.Next"),previous:D("Step.Previous"),first:D("Step.First")},Gd.outs={count:x("Tours.Count"),tourIndex:x("Tour.Index",-1),tourTitle:A("Tour.Title"),tourLead:A("Tour.Lead"),stepCount:x("Tour.Steps"),ending:C("Tour.Ending"),stepIndex:x("Step.Index"),stepTitle:A("Step.Title")};class Wd extends j{constructor(){super(...arguments),this._narrationId=null,this.audioClips={},this.audioPlayer=null,this.isPlaying=!1,this.ins=this.addInputs(Wd.ins),this.outs=this.addOutputs(Wd.outs),this.onEnd=()=>{const{outs:e}=this;this.isPlaying=!1,e.narrationPlaying.setValue(!1)}}get assetManager(){return this.getMainComponent(Ch)}get language(){return this.getGraphComponent(Lh,!0)}get narrationId(){return this._narrationId||""}set narrationId(e){this._narrationId=e}create(){super.create(),this.graph.components.on(Nh,this.onMetaComponent,this)}dispose(){this.graph.components.off(Nh,this.onMetaComponent,this),super.dispose()}update(){const{ins:e,outs:t}=this;return e.playNarration.changed&&this.audioPlayer&&this._narrationId&&(this.isPlaying?this.stop():this.play(this._narrationId)),!0}getAudioList(){return Object.keys(this.audioClips).map((e=>this.audioClips[e]))}getAudioClip(e){return this.audioClips[e]}addAudioClip(e){this.audioClips[e.id]=e}removeAudioClip(e){delete this.audioClips[e]}onMetaComponent(e){const t=e.object;e.add&&t.once("load",(()=>{this.audioClips=t.audio.dictionary||{}}))}fromData(e){const{outs:t}=this;e=e||{},this._narrationId=e.narrationId||null,t.narrationEnabled.setValue(null!=this._narrationId),this.audioClips[this._narrationId]||(t.narrationEnabled.setValue(!1),console.warn("Invalid narration audio ID"))}toData(){let e=null;return null!==this._narrationId&&(e={narrationId:this._narrationId}),e}play(e){if(!this.audioPlayer)return void ho.show("Error - Audio Player not initialized.","error");const{outs:t}=this,n=this.audioClips[e].uris[vs[this.language.outs.language.getValidatedValue()]];this.audioPlayer.setAttribute("src",this.assetManager.getAssetUrl(n)),this.audioPlayer.play().then((()=>{this.isPlaying=!0,t.narrationPlaying.setValue(!0)})).catch((e=>ho.show(`Failed to play audio at '${this.audioPlayer.getAttribute("src")}':${e}`,"warning")))}stop(){this.audioPlayer.pause(),this.audioPlayer.currentTime=0,this.onEnd()}setupAudio(){null===this.audioPlayer&&(this.audioPlayer=document.createElement("audio"),this.audioPlayer.onended=this.onEnd)}}Wd.typeName="CVAudioManager",Wd.text="Audio",Wd.icon="",Wd.isSystemSingleton=!0,Wd.ins={playNarration:D("Audio.PlayNarration")},Wd.outs={narrationEnabled:C("Audio.NarrationEnabled",!1),narrationPlaying:C("Audio.NarrationPlaying",!1)};class qd extends j{constructor(){super(...arguments),this._savedSetupData={},this.ins=this.addInputs(qd.ins)}get featureMap(){return this.constructor.featureMap}get transform(){return this.getComponent(Rt)}create(){super.create();const e=this.node,t=qd.featureMap;for(const n in t)this[n]=e.createComponent(t[n]);this.snapshots=e.createComponent(Hd)}update(){const e=this.ins;return e.saveState.changed&&this.cacheSetupState(),e.restoreState.changed&&this.restoreSetupState(),!0}fromDocument(e,t,n){const i=e.scenes[t];if(!isFinite(i.setup))throw new Error("setup property missing in node");const s=this._savedSetupData=e.setups[i.setup],r=qd.featureMap;for(const e in r){n.set(`scenes/${t}/setup/${e}`,this[e]);const i=s[e];i&&this[e].fromData(i)}s.snapshots&&this.snapshots.fromData(s.snapshots,n)}toDocument(e,t,n){const i=this._savedSetupData,s=qd.featureMap;for(const e in s)n.set(this[e],`scenes/${t}/setup/${e}`);const r=this.tours.toData();r&&(i.tours=r);const o=this.snapshots.toData(n);if(o&&(i.snapshots=o),i){e.setups=e.setups||[];const n=e.setups.length;e.setups.push(i),e.scenes[t].setup=n}}cacheSetupState(){const e=qd.featureMap;for(const t in e){const e=this[t].toData();e&&(this._savedSetupData[t]=e)}}restoreSetupState(){const e=this._savedSetupData,t=qd.featureMap;for(const n in t){const t=e[n];t&&"tours"!==n&&this[n].fromData(t)}}}qd.typeName="CVSetup",qd.ins={saveState:D("Setup.SaveState"),restoreState:D("Setup.RestoreState")},qd.featureMap={interface:Ru,reader:Oh,viewer:Lu,navigation:od,background:dd,environment:Au,language:Lh,floor:bd,grid:Ed,tape:Dd,slicer:Id,tours:Gd,audio:Wd};const Xd=new Ve,Yd=new Ve,Kd=new Ue,Jd=new Lt;class Zd extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(Zd.ins),this.outs=this.addOutputs(Zd.outs),this._derivatives=new fa,this._activeDerivative=null,this._visible=!0,this._boxFrame=null,this._localBoundingBox=new Lt,this.object3D=new Es}get settingProperties(){return[this.ins.name,this.ins.visible,this.ins.quality,this.ins.localUnits,this.ins.tags,this.ins.renderOrder,this.ins.shadowSide,this.ins.shader,this.ins.overlayMap,this.ins.override,this.ins.color,this.ins.opacity,this.ins.hiddenOpacity,this.ins.roughness,this.ins.metalness,this.ins.occlusion,this.ins.doubleSided]}get snapshotProperties(){return[this.ins.visible,this.ins.quality,this.ins.overlayMap]}get derivatives(){return this._derivatives}get activeDerivative(){return this._activeDerivative}get localBoundingBox(){return this._localBoundingBox}get assetManager(){return this.getMainComponent(Ch)}get assetReader(){return this.getMainComponent(Rh)}get renderer(){return this.getMainComponent(Ae)}create(){super.create();this.node.createComponent(Tu).ins.unitScale.linkFrom(this.outs.unitScale);const e=this.renderer.outs.maxTextureSize.value;e<2048?this.ins.quality.setValue(Wo.Low):e<4096?this.ins.quality.setValue(Wo.Medium):this.ins.quality.setValue(Wo.High)}update(){const e=this.ins;if(e.name.changed&&(this.node.name=e.name.value),e.tags.changed||e.activeTags.changed||e.visible.changed){let t=e.visible.value;if(t){const n=e.tags.value.split(",").map((e=>e.trim())).filter((e=>e)),i=e.activeTags.value.split(",").map((e=>e.trim())).filter((e=>e));t=!n.length,i.forEach((e=>{n.indexOf(e)>=0&&(t=!0)}))}const n=this.ins.override.value;this._visible=t,t?(this.object3D.visible=!0,n&&this.updateMaterial()):e.visible.value&&n&&this.ins.hiddenOpacity.value>0?(this.object3D.visible=!0,this.updateMaterial()):this.object3D.visible=!1}if(e.tags.changed&&this.emit({type:"tag-update"}),!this.activeDerivative&&e.autoLoad.changed&&e.autoLoad.value)this.autoLoad(e.quality.value);else if(e.quality.changed){const t=this.derivatives.select(Go.Web3D,e.quality.value);t&&t!==this.activeDerivative&&this.loadDerivative(t).catch((e=>{console.warn("Model.update - failed to load derivative"),console.warn(e)}))}return e.renderOrder.changed&&this.updateRenderOrder(this.object3D,e.renderOrder.value),(e.localUnits.changed||e.globalUnits.changed)&&this.updateUnitScale(),e.shader.changed&&this.updateShader(),e.overlayMap.changed&&this.updateOverlayMap(),e.override.value&&e.shader.value===na.Default&&(e.override.changed||e.color.changed||e.opacity.changed||e.roughness.changed||e.metalness.changed||e.occlusion.changed)&&this.updateMaterial(),e.center.changed&&this.center(),(e.position.changed||e.rotation.changed)&&this.updateMatrixFromProps(),e.dumpDerivatives.changed&&console.log(this.derivatives.toString(!0)),!0}dispose(){this.derivatives.clear(),this._activeDerivative=null,super.dispose()}center(){const e=this.object3D,t=this.ins.position;e.matrix.decompose(Xd,Kd,Yd),e.matrix.makeRotationFromQuaternion(Kd),Jd.makeEmpty(),Ho(e,Jd,e.parent),Jd.getCenter(Xd),Xd.multiplyScalar(-1).toArray(t.value),t.set()}setFromMatrix(e){const t=this.ins;e.decompose(Xd,Kd,Yd),Xd.multiplyScalar(1/this.outs.unitScale.value).toArray(t.position.value),t.position.set(),jo(Kd,Zd.rotationOrder,t.rotation.value),t.rotation.set()}fromDocument(e,t){const{ins:n,outs:i}=this;if(!isFinite(t.model))throw new Error("model property missing in node");const s=e.models[t.model];n.name.setValue(t.name);const r=gs[s.units||"cm"];n.localUnits.setValue(isFinite(r)?r:gs.cm),n.visible.setValue(void 0===s.visible||s.visible),n.tags.setValue(s.tags||""),n.renderOrder.setValue(void 0!==s.renderOrder?s.renderOrder:0);const o=Yo[s.shadowSide||"Back"];if(n.shadowSide.setValue(isFinite(o)?o:Yo.Back),n.position.reset(),n.rotation.reset(),s.translation&&n.position.copyValue(s.translation),s.rotation&&(Kd.fromArray(s.rotation),jo(Kd,Zd.rotationOrder,n.rotation.value),n.rotation.set()),s.boundingBox){const e=this._localBoundingBox;e.min.fromArray(s.boundingBox.min),e.max.fromArray(s.boundingBox.max),this._boxFrame=new ks(e,"#009cde"),this.addObject3D(this._boxFrame),this._boxFrame.updateMatrixWorld(!0);const t=this.getGraphComponent(qd);t.navigation.ins.autoZoom.value&&t.navigation.ins.zoomExtents.set(),i.updated.set(),this.updateUnitScale()}if(s.derivatives&&this.derivatives.fromJSON(s.derivatives),s.material){const e=s.material;n.copyValues({override:!0,color:e.color||n.color.schema.preset,opacity:void 0!==e.opacity?e.opacity:n.opacity.schema.preset,hiddenOpacity:void 0!==e.hiddenOpacity?e.hiddenOpacity:n.hiddenOpacity.schema.preset,roughness:void 0!==e.roughness?e.roughness:n.roughness.schema.preset,metalness:void 0!==e.metalness?e.metalness:n.metalness.schema.preset,occlusion:void 0!==e.occlusion?e.occlusion:n.occlusion.schema.preset,doubleSided:void 0!==e.doubleSided?e.doubleSided:n.doubleSided.schema.preset})}return s.annotations&&this.getComponent(Tu).fromData(s.annotations),this.emit({type:"tag-update"}),this.ins.autoLoad.set(),t.model}toDocument(e,t){const n={units:gs[this.ins.localUnits.getValidatedValue()]},i=this.ins;i.visible.value||(n.visible=!1),i.tags.value&&(n.tags=i.tags.value),0!==i.renderOrder.value&&(n.renderOrder=i.renderOrder.value),i.shadowSide.value!=Yo.Back&&(n.shadowSide=Yo[this.ins.shadowSide.getValidatedValue()]);const s=i.position.value;0===s[0]&&0===s[1]&&0===s[2]||(n.translation=i.position.value);const r=i.rotation.value;0===r[0]&&0===r[1]&&0===r[2]||(Bo(r,Zd.rotationOrder,Kd),n.rotation=Kd.toArray()),i.override.value&&(n.material={color:i.color.value,opacity:i.opacity.value,hiddenOpacity:i.hiddenOpacity.value,roughness:i.roughness.value,metalness:i.metalness.value,occlusion:i.occlusion.value,doubleSided:i.doubleSided.value}),n.boundingBox={min:this._localBoundingBox.min.toArray(),max:this._localBoundingBox.max.toArray()},n.derivatives=this.derivatives.toJSON();const o=this.getComponent(Tu).toData();o&&o.length>0&&(n.annotations=o),e.models=e.models||[];const a=e.models.length;return e.models.push(n),a}updateShader(){const e=this.ins.shader.getValidatedValue();this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&n.setShaderMode(e)}))}updateOverlayMap(){const e=this.getGraphComponent(qd,!0);if(e&&e.snapshots.outs.tweening.value)return void e.snapshots.outs.end.once("value",(()=>{this.ins.overlayMap.set(),this.update()}));const t=this.ins.overlayMap.getOptionText();"None"!==t?this.assetReader.getTexture(t).then((e=>{this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(e.flipY=!1,n.zoneMap=e,n.enableZoneMap(!0))}))})):this.object3D.traverse((e=>{const t=e.material;t&&t.isUberPBRMaterial&&(t.enableZoneMap(!1),t.zoneMap=null)}))}updateMaterial(){const e=this.ins;this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(n.aoMapMix.setScalar(e.occlusion.value),n.color.fromArray(e.color.value),n.opacity=this._visible?e.opacity.value:e.hiddenOpacity.value,n.transparent=n.opacity<1||!!n.alphaMap,n.roughness=e.roughness.value,n.metalness=e.metalness.value,n.side=e.doubleSided.value?2:0)}))}updateUnitScale(){const e=this.ins.localUnits.getValidatedValue(),t=this.ins.globalUnits.getValidatedValue();this.outs.unitScale.setValue(Jo(e,t)),this.updateMatrixFromProps()}updateMatrixFromProps(){const e=this.ins,t=this.outs.unitScale.value,n=this.object3D;Xd.fromArray(e.position.value).multiplyScalar(t),Bo(e.rotation.value,Zd.rotationOrder,Kd),Yd.setScalar(t),n.matrix.compose(Xd,Kd,Yd),n.matrixWorldNeedsUpdate=!0,this.outs.updated.set()}updateRenderOrder(e,t){e.renderOrder=t,e.children.forEach((e=>this.updateRenderOrder(e,t)))}autoLoad(e){const t=[],n=this.derivatives.select(Go.Web3D,Wo.Thumb);n&&t.push(n);const i=this.derivatives.select(Go.Web3D,e);return i&&i!==n&&t.push(i),0===t.length?(ho.show(`No 3D derivatives available for '${this.displayName}'.`),Promise.resolve()):t.reduce(((e,t)=>e.then((()=>{this.loadDerivative(t)}))),Promise.resolve())}loadDerivative(e){if(this.node&&this.assetReader)return e.load(this.assetReader).then((()=>{if(!e.model)return;this.assetManager.initialLoad||this._activeDerivative||(this.assetManager.initialLoad=!0),this._activeDerivative&&(this.removeObject3D(this._activeDerivative.model),this._activeDerivative.unload()),this._activeDerivative=e,this.addObject3D(e.model),this.renderer.activeSceneComponent.scene.updateMatrixWorld(!0),this._boxFrame&&(this.removeObject3D(this._boxFrame),this._boxFrame.geometry.dispose(),this._boxFrame=null),this._localBoundingBox.makeEmpty(),Ho(e.model,this._localBoundingBox),this.outs.updated.set(),this.outs.quality.setValue(e.data.quality),this.ins.override.value&&this.updateMaterial(),this.ins.shadowSide.value!=Yo.Back&&this.object3D.traverse((e=>{const t=e.material;t&&t.isUberPBRMaterial&&(this.ins.shadowSide.value==Yo.Front?t.shadowSide=0:t.shadowSide=1)})),this.getGraphComponent(Au).ins.dirty.set(),0!==this.ins.renderOrder.value&&this.updateRenderOrder(this.object3D,this.ins.renderOrder.value);const t=["None"];t.push(...e.findAssets(qo.Image).filter((e=>e.data.mapType===Xo.Zone)).map((e=>e.data.uri))),this.ins.overlayMap.setOptions(t),this.emit({type:"model-load",quality:e.data.quality})})).catch((e=>ho.show(`Failed to load model derivative: ${e.message}`)));console.warn("Model load interrupted.")}addObject3D(e){this.object3D.add(e),this.object3D.traverse((e=>{"Mesh"===e.type&&this.registerPickableObject3D(e,!0)}))}}Zd.typeName="CVModel2",Zd.text="Model",Zd.icon="cube",Zd.rotationOrder="ZYX",Zd.ins={name:A("Model.Name"),globalUnits:R("Model.GlobalUnits",gs,gs.cm),localUnits:R("Model.LocalUnits",gs,gs.cm),quality:R("Model.Quality",Wo,Wo.High),tags:A("Model.Tags"),renderOrder:b("Model.RenderOrder",0),shadowSide:R("Model.ShadowSide",Yo,Yo.Back),activeTags:A("Model.ActiveTags"),autoLoad:C("Model.AutoLoad",!0),position:w("Model.Position"),rotation:w("Model.Rotation"),center:D("Model.Center"),shader:R("Material.Shader",na,na.Default),overlayMap:L("Material.OverlayMap",["None"],0),override:C("Material.Override",!1),color:T("Material.BaseColor"),opacity:_("Material.Opacity",1),hiddenOpacity:_("Material.HiddenOpacity",0),roughness:_("Material.Roughness",.8),metalness:_("Material.Metalness",.1),occlusion:_("Material.Occlusion",.25),doubleSided:C("Material.DoubleSided",!1),dumpDerivatives:D("Derivatives.Dump")},Zd.outs={unitScale:b("UnitScale",{preset:1,precision:5}),quality:R("LoadedQuality",Wo),updated:D("Updated")};const Qd=new Ve,ep=new Ve,tp=new Ze,np=new Ue;class ip extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(ip.camIns),this.object3D=new id}get camera(){return this.object3D}update(){const{autoActivate:e,activate:t}=this.ins;if(t.changed||e.changed&&e.value){const e=this.scene;e&&(e.activeCameraComponent=this)}const n=this.camera,{position:i,rotation:s,projection:r,fov:o,size:a,zoom:l,near:c,far:h}=this.ins;return(i.changed||s.changed)&&(n.position.fromArray(i.value),n.rotation.fromArray(s.value),n.updateMatrix()),r.changed&&n.setProjection(r.getValidatedValue()),n.fov=o.value,n.size=a.value,n.zoom=l.value,n.near=c.value,n.far=h.value,n.updateProjectionMatrix(),!0}dispose(){const e=this.scene;e&&e.activeCameraComponent===this&&(e.activeCameraComponent=null),super.dispose()}setPropertiesFromMatrix(e){const t=!e;e=e||this.object3D.matrix;const{position:n,rotation:i,order:s}=this.ins;e.decompose(Qd,np,ep),Qd.toArray(n.value);const r=s.getOptionText();tp.setFromQuaternion(np,r),tp.toVector3(Qd),Qd.multiplyScalar(vt.RAD2DEG).toArray(i.value),n.set(t),i.set(t)}}ip.typeName="CCamera",ip.camIns={autoActivate:C("Camera.AutoActivate",!0),activate:D("Camera.Activate"),position:w("Transform.Position"),rotation:w("Transform.Rotation"),order:R("Transform.Order",Pt,Pt.ZYX),projection:R("Projection.Type",ed,ed.Perspective),fov:b("Projection.FovY",52),size:b("Projection.Size",20),zoom:b("Projection.Zoom",1),near:b("Frustum.ZNear",.01),far:b("Frustum.ZFar",1e4)};class sp extends ip{constructor(e,t){super(e,t),this.object3D.layers.enable(1)}get settingProperties(){return[this.ins.projection,this.ins.fov,this.ins.size,this.ins.near,this.ins.far]}fromDocument(e,t){if(!isFinite(t.camera))throw new Error("camera property missing in node");const n=e.cameras[t.camera];return"perspective"===n.type?this.ins.copyValues({projection:ed.Perspective,fov:n.perspective.yfov,near:n.perspective.znear,far:n.perspective.zfar}):this.ins.copyValues({projection:ed.Orthographic,size:n.orthographic.ymag,near:n.orthographic.znear,far:n.orthographic.zfar}),t.camera}toDocument(e,t){const n=this.ins,i={};n.projection.getValidatedValue()===ed.Perspective?(i.type="perspective",i.perspective={yfov:n.fov.value,znear:n.near.value,zfar:n.far.value}):(i.type="orthographic",i.orthographic={ymag:n.size.value,znear:n.near.value,zfar:n.far.value}),e.cameras=e.cameras||[];const s=e.cameras.length;return e.cameras.push(i),s}}sp.typeName="CVCamera",sp.text="Camera",sp.icon="video";const rp=new Ve;class op extends Ms{constructor(){super(...arguments),this.ins=this.addInputs(op.ins),this.outs=this.addOutputs(op.outs),this.updateCameraHelper=()=>{const e=this.setup.navigation.ins.offset.value,t=rp.set(e[0],e[1],e[2]).length();if(!this.system.getComponent("CVStoryApplication",!0)){const n=2*Math.max(t,this.outs.boundingRadius.value),i=this.setup.navigation.ins.maxOffset.value,s=e[2]{const n=4*Math.max(t,this.outs.boundingRadius.value),i=n/1e3;(n{e.ins.globalUnits.linkFrom(this.ins.units),this.ins.modelUpdated.linkFrom(e.outs.updated)}))}update(e){const t=this.ins,n=this.outs;return t.units.changed&&(this.updateTransformHierarchy(),this.updateModelBoundingBox(),this.updateLights(),this.updateCameras(),n.units.setValue(t.units.value)),t.modelUpdated.changed&&(this.updateModelBoundingBox(),this.updateLights(),this.updateCameras()),t.sceneTransformed.changed&&this.updateModelBoundingBox(),!0}dispose(){this.graph.components.off(Zd,this.onModelComponent,this),super.dispose()}fromDocument(e,t){this.ins.units.setValue(gs[t.units]||0),this.outs.units.setValue(gs[t.units]||0)}toDocument(e,t){t.units=gs[this.ins.units.getValidatedValue()]}onModelComponent(e){const t=e.object;e.add&&(t.ins.globalUnits.linkFrom(this.ins.units),this.ins.modelUpdated.linkFrom(t.outs.updated)),this.updateModelBoundingBox()}updateModelBoundingBox(){const e=this.outs.boundingBox.value;e.makeEmpty(),this.models.forEach((t=>e.expandByObject(t.object3D))),e.getSize(rp),this.outs.boundingBox.set(),this.outs.boundingRadius.setValue(.5*rp.length())}updateTransformHierarchy(){if(0===this.models.length)return;const{ins:e,outs:t}=this,n=Jo(t.units.value,e.units.value),i=this.models[0].object3D.parent.parent;i.position.multiplyScalar(n),i.updateMatrix(),i.updateMatrixWorld(!0),this.models.forEach((e=>{const t=e.object3D.parent;t.position.multiplyScalar(n),t.updateMatrix(),t.updateMatrixWorld(!0)}))}updateLights(){const{ins:e,outs:t}=this,n=this.graph.findNodeByName("Lights").getComponent(Rt,!0),i=Jo(t.units.value,e.units.value);rp.setScalar(this.outs.boundingRadius.value*i*.05),n.ins.scale.setValue(rp.toArray()),n.object3D.updateMatrixWorld(!0)}updateCameras(){this.setup.navigation.ins.autoZoom.value?this.setup.navigation.ins.offset.once("value",this.updateCameraHelper):this.updateCameraHelper()}}op.typeName="CVScene",op.text="Scene",op.icon="hierarchy",op.ins={units:R("Scene.Units",gs,gs.cm),modelUpdated:D("Scene.ModelUpdated"),sceneTransformed:D("Scene.Transformed")},op.outs={units:R("Scene.Units",gs,gs.cm),boundingBox:N("Models.BoundingBox",Lt),boundingRadius:b("Models.BoundingRadius")};class ap extends wn{constructor(e){super(),this.type="ShadowMaterial",this.color=new Pn(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}ap.prototype.isShadowMaterial=!0;class lp extends sl{constructor(e,t,n){super(),this.shadowMaterial=new ap,this.boundingBox=new Lt,this.size=new Ve,this.isAnimated=!1,this.needsUpdate=!1,this.intensity=0,this.castShadow=!0,this.frustumCulled=!1,this.floor=new ui(new pi,this.shadowMaterial),this.floor.rotateX(-Math.PI/2),this.floor.receiveShadow=!0,this.floor.castShadow=!1,this.floor.frustumCulled=!1,this.add(this.floor),this.shadow.camera.up.set(0,0,1),t.add(this),this.target=t,this.setModel(e,n)}setModel(e,t){this.boundingBox.copy(e.outs.boundingBox.value),e.outs.boundingBox.value.getSize(this.size);const{boundingBox:n,size:i}=this;if(this.isAnimated){const e=2*Math.max(i.x,i.y,i.z);i.y=e,n.expandByVector(i.subScalar(e).multiplyScalar(-.5)),n.max.y=n.min.y+e,i.set(e,e,e)}const s=.001*i.y;this.position.y=n.max.y+s,n.getCenter(this.floor.position),this.setSoftness(t)}setSoftness(e){const t=Math.pow(2,9-3*e);this.setMapSize(t)}setMapSize(e){const{camera:t,mapSize:n,map:i}=this.shadow,{size:s,boundingBox:r}=this;null!=i&&(i.dispose(),this.shadow.map=null),this.isAnimated&&(e*=2);const o=Math.floor(s.x>s.z?e:e*s.x/s.z),a=Math.floor(s.x>s.z?e*s.z/s.x:e);n.set(o,a);const l=2.5*s.x/o,c=2.5*s.z/a;t.left=-r.max.x-l,t.right=-r.min.x+l,t.bottom=r.min.z-c,t.top=r.max.z+c,this.setScaleAndOffset(t.zoom,0),this.shadow.updateMatrices(this),this.floor.scale.set(s.x+2*l,s.z+2*c,1),this.needsUpdate=!0}setIntensity(e){this.shadowMaterial.opacity=e,e>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.shadowMaterial.opacity}setRotation(e){this.shadow.camera.up.set(Math.sin(e),0,Math.cos(e)),this.shadow.updateMatrices(this)}setScaleAndOffset(e,t){const n=this.size.y,i=1/e,s=.001*n;this.floor.position.y=2*s-n+t*i;const{camera:r}=this.shadow;r.zoom=e,r.near=0,r.far=n*e-t,r.projectionMatrix.makeOrthographic(r.left*e,r.right*e,r.top*e,r.bottom*e,r.near,r.far),r.projectionMatrixInverse.copy(r.projectionMatrix).invert(),this.shadow.updateMatrices(this)}updateMatrices(){this.shadow.updateMatrices(this)}dispose(){const{floor:e,shadowMaterial:t}=this;e.geometry.dispose(),t.dispose(),this.floor=null,this.shadowMaterial=null}}class cp extends $d{constructor(e,t){super(e,t),this.ins=this.addInputs(cp.dirLightIns),this.object3D=new sl,this.light.target.matrixAutoUpdate=!1}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;if((n.position.changed||n.target.changed)&&(t.position.fromArray(n.position.value),t.target.position.fromArray(n.target.value),t.updateMatrix(),t.target.updateMatrix()),n.shadowSize.changed){const e=t.shadow.camera,i=.5*n.shadowSize.value;e.left=e.bottom=-i,e.right=e.top=i,e.updateProjectionMatrix()}return!0}onAddToParent(e){super.onAddToParent(e),e.add(this.light.target)}onRemoveFromParent(e){super.onRemoveFromParent(e),e.remove(this.light.target)}}cp.typeName="CDirectionalLight",cp.dirLightIns={position:w("Light.Position"),target:w("Light.Target",[0,-1,0]),shadowSize:b("Shadow.Size",100)};class hp extends cp{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.shadowEnabled,this.ins.shadowSize,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if("directional"!==n.type)throw new Error("light type mismatch: not a directional light");return i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,target:i.target.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowSize:void 0!==n.shadowSize?n.shadowSize:i.shadowSize.schema.preset,shadowResolution:void 0!==n.shadowResolution?Bd[n.shadowResolution]||0:i.shadowResolution.schema.preset,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,type:"directional"};n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowSize.isDefault()||(i.shadowSize=n.shadowSize.value),n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=Bd[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}hp.typeName="CVDirectionalLight",hp.text="Directional Light",hp.icon="bulb";const up=new je,dp=new Ve,pp=new Ve,mp=new Lt,fp=new Ue;class gp extends j{constructor(){super(...arguments),this._shadowRoot=null,this.ins=this.addInputs(gp.ins),this.outs=this.addOutputs(gp.outs),this.arLink=document.createElement("a"),this.raycaster=new en,this.initialHitTestSource=null,this.inputSource=null,this.transientHitTestSource=null,this.refSpace=null,this.frame=null,this.vScene=null,this.camera=null,this.cameraParent=null,this.cachedView=null,this.cachedQuality=null,this.cachedNearPlane=0,this.cachedFarPlane=0,this.xrCamera=null,this.hitPlane=null,this.selectionRing=null,this.session=null,this.setup=null,this.originalUnits=null,this.isTranslating=!1,this.isRotating=!1,this.isScaling=!1,this.lastDragValueX=0,this.lastDragValueY=0,this.totalDrag=0,this.lastScale=0,this.lastHitPosition=new Ve,this.lastFrameTime=0,this.targetOpacity=0,this.modelFloorOffset=0,this.optimalCameraDistance=0,this.shadow=null,this.lightTransform=null,this.lightsToReset=[],this.featuresToReset=[],this.onSessionEnded=()=>{this.outs.isPresenting.setValue(!1);const e=this.renderer.views[0].renderer;this.resetScene(),e.shadowMap.autoUpdate=!0;const t=this.initialHitTestSource;null!=t&&(t.cancel(),this.initialHitTestSource=null);const n=this.transientHitTestSource;null!=n&&(n.cancel(),this.transientHitTestSource=null),this.refSpace=null,this.frame=null,this.inputSource=null,this.xrCamera=null,this.cachedView=null,this.vScene=null,this.cachedView=null,this.camera=null;const i=this.session;i&&(i.removeEventListener("end",this.onSessionEnded),i.removeEventListener("selectstart",this.onSelectStart),i.removeEventListener("selectend",this.onSelectEnd),this.session=null),this.setup.reader.ins.enabled.off("value",this.endSession,this),e.setAnimationLoop(null),e.xr.enabled=!1,this.outs.isPlaced.setValue(!1),this.setup.navigation.ins.enabled.setValue(!0),this.renderer.views[0].render()},this.render=(e,t)=>{this.frame=t;const n=this.renderer.views[0].renderer,{camera:i,xrCamera:s,refSpace:r,initialHitTestSource:o,vScene:a,sceneNode:l,shadow:c,lastFrameTime:h}=this;if(!t||!t.getViewerPose(r))return;if(!s&&this.session){const e=n.xr.getCamera(i);return void(this.xrCamera=e.cameras[0])}if(s&&(i.position.setFromMatrixPosition(s.matrixWorld),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),i.projectionMatrix.fromArray(s.projectionMatrix.elements),i.projectionMatrixInverse.copy(s.projectionMatrix).invert()),null!=o&&s){const e=a.scene,{position:t}=e,n=2*l.outs.boundingRadius.value+s.near,r=s.matrixWorld.elements;t.set(-r[8],-r[9],-r[10]).normalize(),t.multiplyScalar(n),t.add(i.position),mp.getCenter(dp),t.add(dp.negate()),e.updateMatrix(),e.updateMatrixWorld()}if(this.setInitialPosition(t),this.handleInput(t),this.outs.isPlaced.value){const t=e-h;this.updateOpacity(t,this.targetOpacity),this.lastFrameTime=e}const u=n.getContext();u.depthMask(!1),u.clear(u.DEPTH_BUFFER_BIT),u.depthMask(!0),c.needsUpdate&&(n.shadowMap.needsUpdate=!0,c.needsUpdate=!1),n.render(a.scene,i)},this.onSelectStart=e=>{const t=this.vScene.scene,n=this.transientHitTestSource;if(null==n)return;this.targetOpacity=.5;const i=this.frame.getHitTestResultsForTransientInput(n);if(1===i.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,n=this.raycaster;n.setFromCamera({x:t[0],y:-t[1]},this.xrCamera);const i=n.intersectObject(this.hitPlane);i.length>0?(this.isTranslating=!0,this.lastHitPosition.copy(i[0].point)):this.isRotating=!0,this.lastDragValueX=t[0],this.lastDragValueY=t[1]}else 2===i.length&&(this.isScaling=!0,this.lastScale=this.getFingerSeparation(i)/t.scale.x)},this.onSelectEnd=()=>{this.targetOpacity=0,this.totalDrag=0,this.isTranslating=!1,this.isRotating=!1,this.isScaling=!1,this.inputSource=null}}get renderer(){return this.getMainComponent(Ae)}get pulse(){return this.getMainComponent(Ee)}get sceneNode(){return this.getSystemComponent(op)}get analytics(){return this.system.getMainComponent(Dh)}get assetManager(){return this.getMainComponent(Ch)}get shadowRoot(){return this._shadowRoot}set shadowRoot(e){this._shadowRoot=e}update(){const{ins:e,outs:t}=this;if(e.enabled.changed){let n=e.enabled.value;n&&(us?(this.launchWebXR(),this.analytics.sendProperty("AR.Enabled","WebXR")):fs?(this.launchSceneViewer(),this.analytics.sendProperty("AR.Enabled","SceneViewer")):ps&&ms?(this.launchQuickLook(),this.analytics.sendProperty("AR.Enabled","QuickLook")):(n=!1,this.analytics.sendProperty("AR.Enabled","Unavailable"))),t.enabled.setValue(n)}return!0}launchWebXR(){var e,t,n;const i=null===(e=this.renderer)||void 0===e?void 0:e.views[0].renderer,s=this.vScene=null===(t=this.renderer)||void 0===t?void 0:t.activeSceneComponent,r=this.camera=null==s?void 0:s.activeCamera;this.cameraParent=r.parent;if(!(this.setup=this.getSystemComponent(qd)))return!1;const o=null===(n=this.sceneNode)||void 0===n?void 0:n.getGraphComponents(Zd);(o[0]?o[0].derivatives.get(Go.Web3D,Wo.AR):null)&&(this.setup.navigation.setChanged(!0),this.cachedQuality=o[0].ins.quality.value,o.forEach((e=>{e.ins.quality.setValue(Wo.AR)})),i.setAnimationLoop(((e,t)=>this.render(e,t))),navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay"],domOverlay:{root:this.shadowRoot.querySelector("ff-viewport-overlay")}}).then((e=>this.onSessionStarted(i,e))))}async onSessionStarted(e,t){const n=this.renderer.views[0].renderer.getContext();await n.makeXRCompatible(),t.updateRenderState({baseLayer:new XRWebGLLayer(t,n,{alpha:!0})}),this.setupScene(),e.shadowMap.autoUpdate=!1,e.xr.enabled=!0,e.xr.setReferenceSpaceType("local"),e.xr.setSession(t),t.addEventListener("end",this.onSessionEnded),this.refSpace=await t.requestReferenceSpace("local");const i=await t.requestReferenceSpace("viewer"),s=20*Math.PI/180,r=new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(s),z:-Math.cos(s)});t.requestHitTestSource({space:i,offsetRay:r}).then((e=>{this.initialHitTestSource=e})),this.outs.isPresenting.setValue(!0),this.session=t,this.lastFrameTime=performance.now(),this.setup.reader.ins.enabled.on("value",this.endSession,this)}endSession(){this.session&&this.session.end()}setupScene(){const{cameraParent:e,setup:t,featuresToReset:n}=this,i=this.sceneNode;e&&e.remove(this.camera),this.setup.background.hide(),this.setup.navigation.ins.enabled.setValue(!1);const s=i.graph.findNodeByName("Lights");(this.lightTransform=s.getComponent(Rt,!0)).ins.rotation.reset(),n.push(t.floor.ins.visible.value?1:0),n.push(t.grid.ins.visible.value?1:0),n.push(t.tape.ins.visible.value?1:0),n.push(t.slicer.ins.enabled.value?1:0),n.push(t.viewer.ins.shader.value),t.floor.ins.visible.setValue(!1),t.grid.ins.visible.setValue(!1),t.tape.ins.visible.setValue(!1),t.slicer.ins.enabled.setValue(!1),t.viewer.ins.shader.value!==na.Default&&t.viewer.ins.shader.setValue(na.Default);(this.originalUnits=i.ins.units.getValidatedValue())!=gs.m&&this.sceneNode.ins.units.setValue(gs.m);i.getGraphComponents(Tu).forEach((e=>{e.setXRScale(2)}));i.getGraphComponents(hp).forEach((e=>{e.ins.shadowEnabled.value&&(e.ins.shadowEnabled.setValue(!1),this.lightsToReset.push(e))})),this.pulse.pulse(Date.now()),i.update(null);(this.shadow=new lp(this.sceneNode,this.vScene.scene,.5)).setIntensity(.3),mp.copy(this.sceneNode.outs.boundingBox.value),mp.getSize(dp),this.cachedNearPlane=this.camera.near,this.cachedFarPlane=this.camera.far,this.vScene.activeCameraComponent.ins.near.setValue(.01),this.vScene.activeCameraComponent.ins.far.setValue(1e3)}resetScene(){const{camera:e,cameraParent:t,setup:n,featuresToReset:i}=this,s=this.vScene.scene;t&&t.add(e),e.position.set(0,0,0),e.rotation.set(0,0,0),this.vScene.activeCameraComponent.ins.near.setValue(this.cachedNearPlane),this.vScene.activeCameraComponent.ins.far.setValue(this.cachedFarPlane),e.updateMatrix(),this.lightTransform.object3D.rotation.set(0,0,0),this.lightTransform.object3D.updateMatrix(),this.sceneNode.ins.units.setValue(this.originalUnits),s.position.setScalar(0),s.rotation.y=0,s.scale.setScalar(1),s.updateMatrix(),s.updateMatrixWorld(!0),i.reverse(),n.floor.ins.visible.setValue(!!i.pop()),n.grid.ins.visible.setValue(!!i.pop()),n.tape.ins.visible.setValue(!!i.pop()),n.slicer.ins.enabled.setValue(!!i.pop());const r=i.pop();r!==na.Default&&n.viewer.ins.shader.setValue(r);this.sceneNode.getGraphComponents(Tu).forEach((e=>{e.setXRScale(1)})),this.lightsToReset.forEach((e=>{e.ins.shadowEnabled.setValue(!0)})),this.lightsToReset.length=0,n.background.show();this.sceneNode.getGraphComponents(Zd).forEach((e=>{e.ins.quality.setValue(this.cachedQuality)}));const o=this.hitPlane;null!=o&&(s.remove(o),o.geometry.dispose(),o.material.dispose(),this.hitPlane=null);const a=this.selectionRing;null!=a&&(s.remove(a),a.geometry.dispose(),a.material.dispose(),this.selectionRing=null);const l=this.shadow;null!=l&&(s.remove(l),l.dispose(),this.shadow=null),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix()}setInitialPosition(e){const t=this.initialHitTestSource;if(null==t)return;const n=e.getHitTestResults(t);if(0==n.length)return;const i=n[0],s=this.getHitPoint(i);if(null==s)return;this.placeModel(s),t.cancel(),this.initialHitTestSource=null;const{session:r}=e;r.addEventListener("selectstart",this.onSelectStart),r.addEventListener("selectend",this.onSelectEnd),r.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e})),this.shadow.updateMatrices()}getHitPoint(e){const t=e.getPose(this.refSpace);if(null==t)return null;const n=up.fromArray(t.transform.matrix);return n.elements[5]>.75?pp.setFromMatrixPosition(n):null}handleInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isScaling&&!this.isRotating)return;const n=e.getHitTestResultsForTransientInput(t),i=this.vScene.scene,s=i.scale.x;if(this.isScaling)if(n.length<2)this.isScaling=!1;else{const e=this.getFingerSeparation(n)/this.lastScale;i.scale.setScalar(e),i.position.y=this.lastHitPosition.y-this.modelFloorOffset*i.scale.y,i.updateMatrix(),i.updateMatrixWorld(),this.shadow.setScaleAndOffset(e,0),this.updateBoundingBox()}else{if(2===n.length)return this.isTranslating=!1,this.isRotating=!1,this.isScaling=!0,void(this.lastScale=this.getFingerSeparation(n)/s);if(this.isRotating){const e=this.inputSource.gamepad.axes[0];i.rotation.y+=1.5*(e-this.lastDragValueX),i.updateMatrix(),fp.copy(i.quaternion),fp.invert(),this.lightTransform.object3D.rotation.setFromQuaternion(fp),this.lightTransform.object3D.updateMatrix(),this.shadow.setRotation(i.rotation.y),this.lastDragValueX=e}else if(this.isTranslating){const e=this.inputSource.gamepad.axes,t=e[0]-this.lastDragValueX,s=e[1]-this.lastDragValueY;this.totalDrag+=Math.hypot(t,s),n.forEach((e=>{if(this.totalDrag<.01||e.inputSource!==this.inputSource||e.results.length<1)return;const t=this.getHitPoint(e.results[0]);null!=t&&(dp.copy(t),dp.sub(this.lastHitPosition),i.position.add(dp),i.updateMatrix(),i.updateMatrixWorld(),this.lastHitPosition.copy(t),this.updateBoundingBox())})),this.shadow.updateMatrices()}}}getFingerSeparation(e){const t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],s=n[1]-t[1];return Math.sqrt(i*i+s*s)}placeModel(e){const t=this.vScene.scene,{min:n,max:i}=mp,s=this.sceneNode.outs.boundingRadius.value,r=Math.max(1.25*(i.x-n.x),.15),o=Math.max(1.25*(i.z-n.z),.15),a=(n.x+i.x)/2,l=(n.z+i.z)/2;this.lastHitPosition.copy(e);const c=this.hitPlane=new ui(new pi(r,o),new Rn);c.position.set(a,n.y,l),c.rotation.set(-Math.PI/2,0,0),c.visible=!1,t.add(c);const h=new Ii,u=new Ii,d=r>o?.025*r:.025*o;this.roundedRect(h,-r/2,-o/2,r,o,.5*d),this.roundedRect(u,-r/2+d,-o/2+d,r-2*d,o-2*d,.4*d),h.holes.push(u);let p=new hs(h);const m=this.selectionRing=new ui(p,new Rn({side:2,opacity:0}));m.position.set(a,n.y,l),m.rotation.set(-Math.PI/2,0,0),m.material.transparent=!0,m.visible=!1,t.add(m),this.modelFloorOffset=n.y,t.position.set(e.x,e.y-n.y,e.z),t.updateMatrix(),t.updateMatrixWorld(!0),this.updateBoundingBox(),this.pulse.pulse(Date.now());const f=this.camera.position.clone(),g=e.clone().sub(f);if(g.length()null!==e.derivatives.get(Go.App3D,Wo.AR))),n=t>-1?e[t].derivatives.get(Go.App3D,Wo.AR):null;if(n){const e=this.arLink,t=n.findAsset(qo.Model),i=`intent://arvr.google.com/scene-viewer/1.0?file=${this.assetManager.getAssetUrl(t.data.uri)}&mode=ar_only#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end;`;e.setAttribute("href",i),e.click()}}launchQuickLook(){const e=this.sceneNode.getGraphComponents(Zd),t=e.findIndex((e=>null!==e.derivatives.get(Go.iOSApp3D,Wo.AR))),n=t>-1?e[t].derivatives.get(Go.iOSApp3D,Wo.AR):null;if(n){const e=this.arLink,t=n.findAsset(qo.Model),i=this.assetManager.getAssetUrl(t.data.uri);e.setAttribute("rel","ar");const s=document.createElement("img");e.appendChild(s),e.setAttribute("href",i.toString()),e.click(),e.removeChild(s)}}updateBoundingBox(){this.sceneNode.ins.sceneTransformed.set()}updateOpacity(e,t){const n=this.selectionRing.material,i=n.opacity;if(t===i)return;const s=t-i;n.opacity=s>0?Math.min(i+.002*e,t):Math.max(i-.002*e,t),this.selectionRing.visible=n.opacity>0}roundedRect(e,t,n,i,s,r){e.moveTo(t,n+r),e.lineTo(t,n+s-r),e.quadraticCurveTo(t,n+s,t+r,n+s),e.lineTo(t+i-r,n+s),e.quadraticCurveTo(t+i,n+s,t+i,n+s-r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t+i,n,t+i-r,n),e.lineTo(t+r,n),e.quadraticCurveTo(t,n,t,n+r)}}function vp(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");const n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);if(n)return n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):""}gp.typeName="CVARManager",gp.text="ARManager",gp.icon="",gp.isSystemSingleton=!0,gp.ins={enabled:C("State.Enabled")},gp.outs={enabled:C("State.Enabled"),available:C("State.Available",ds),isPlaced:C("AR.Placed",!1),isPresenting:C("AR.Presenting",!1)};class yp{constructor(e,t){this._args=e,this._props=t,this._args=e,this._state=null}get name(){return this._props.name||this._props.do.name.replace(/([A-Z])/g," $1").replace(/^./,(e=>e.toUpperCase()))}do(){if(this._state)throw new Error("undo should be called before execute can be applied again");this._state=this._props.do.apply(this._props.target,this._args)}undo(){if(!this._props.undo)throw new Error("can't undo this command");if(!this._state)throw new Error("execute should be called before undo can be applied");this._props.undo.call(this._props.target,this._state),this._state=null}canDo(){return!this._props.canDo||this._props.canDo()}canUndo(){return!!this._props.undo}}class bp extends o{constructor(e){super(),this.addEvent("update"),this.stack=[],this.pointer=-1,this.capacity=void 0!==e?e:bp.defaultCapacity}register(e){let t;t="function"==typeof e?e:t=>new yp(t,e);return(...e)=>{const n=t(e);this.do(n)}}setCapacity(e){for(this.capacity=e;this.stack.length>e;)this.stack.shift(),this.pointer--;this.pointer<0&&(this.stack=[],this.pointer=-1)}do(e){console.log(`Commander.do - '${e.name}'`),e.do(),e.canUndo()&&(this.stack.splice(this.pointer+1),this.stack.push(e),this.stack.length>this.capacity&&this.stack.shift(),this.pointer=this.stack.length-1,this.emit("update"))}undo(){if(this.pointer>=0){this.stack[this.pointer].undo(),this.pointer--,this.emit("update")}}redo(){if(this.pointer0&&(this.stack=[],this.pointer=-1,this.emit("update"))}canUndo(){return this.pointer>=0}canRedo(){return this.pointer=0?"Undo "+this.stack[this.pointer].name:"Can't Undo"}getRedoText(){return this.pointerthis.add(e)));const t=e.typeName;if(!t)throw new Error("type must have a 'typeName' member");if(this._dict[t])throw new Error(`type '${t}' already registered`);this._dict[t]=e,this.emit({type:"type",add:!0,remove:!1,classType:e})}remove(e){if(Array.isArray(e))return void e.forEach((e=>this.remove(e)));const t=e.typeName;if(!t)throw new Error("type must have a 'typeName' member");if(!this._dict[t])throw new Error(`type '${t}' not registered`);delete this._dict[t],this.emit({type:"type",add:!1,remove:!0,classType:e})}getType(e){let t=e;return"function"==typeof e?t=e.typeName:"object"==typeof e&&(t=e.constructor.typeName),this._dict[t]}createInstance(e,...t){const n=this.getType(e);if(!n)throw new Error(`type '${e}' not registered`);return new n(...t)}}class _p extends o{constructor(e){super({knownEvents:!1}),this.nodes=new F(B),this.components=new F(j),this.registry=e||new xp,this.graph=new bt(this,null),this.graph.activate()}getComponent(e,t=!1){return this.components.get(e,t)}getComponents(e){return this.components.getArray(e)}getComponentsByTag(e){return this.components.getByTag(e)}hasComponents(e){return this.components.has(e)}getMainComponent(e,t=!1){return this.graph.components.get(e,t)}getMainComponents(e){return this.graph.components.getArray(e)}getMainComponentsByTag(e){return this.graph.components.getByTag(e)}hasMainComponents(e){return this.graph.components.has(e)}getNode(e,t=!1){return this.nodes.get(e,t)}getNodes(e){return this.nodes.getArray(e)}getNodesByTag(e){return this.nodes.getByTag(e)}hasNodes(e){return this.nodes.has(e)}getMainNode(e,t=!1){return this.graph.nodes.get(e,t)}getMainNodes(e){return this.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.graph.nodes.getByTag(e)}hasMainNodes(e){return this.graph.nodes.has(e)}findNodeByName(e,t){const n=this.nodes.getArray(t);for(let t=0,i=n.length;te.toString(!0))).join("\n"):i}_addNode(e){this.nodes.add(e)}_removeNode(e){this.nodes.remove(e)}_addNodeTag(e,t){this.nodes.addByTag(e,t)}_removeNodeTag(e,t){this.nodes.removeByTag(e,t)}_addComponent(e){if(e.isSystemSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per system`);this.components.add(e)}_removeComponent(e){this.components.remove(e)}_addComponentTag(e,t){this.components.addByTag(e,t)}_removeComponentTag(e,t){this.components.removeByTag(e,t)}}class wp extends j{createActions(e){return{}}}wp.typeName="CController",wp.isSystemSingleton=!0;class Sp extends wp{constructor(e,t){super(e,t),this.outs=this.addOutputs(Sp.selOuts),this.multiSelect=!1,this.exclusiveSelect=!0,this.selectedNodes=new F(B),this.selectedComponents=new F(j),this._activeGraph=null,this.addEvents("select-node","select-component","active-graph","update"),this.selectedNodes.on(B,(e=>this.onSelectNode(e.object,e.add))),this.selectedComponents.on(j,(e=>this.onSelectComponent(e.object,e.add))),this._activeGraph=this.system.graph}getSelectedNode(e){return this.selectedNodes.get(e,!0)}getSelectedNodes(e){return this.selectedNodes.getArray(e)}getSelectedComponent(e){return this.selectedComponents.get(e,!0)}getSelectedComponents(e){return this.selectedComponents.getArray(e)}get activeGraph(){return this._activeGraph}set activeGraph(e){if(e!==this.activeGraph){this.clearSelection();const t=this._activeGraph;this._activeGraph=e,this.onActiveGraph(e),this.emit({type:"active-graph",previous:t,next:e})}}hasParentGraph(){return this._activeGraph&&this._activeGraph.parent}activateParentGraph(){this._activeGraph&&this._activeGraph.parent.graph&&(this.activeGraph=this._activeGraph.parent.graph)}hasChildGraph(){return this.selectedComponents.has(xt)}activateChildGraph(){const e=this.selectedComponents.get(xt,!0);e&&(this.activeGraph=e.innerGraph)}create(){super.create(),this.system.nodes.on(B,this.onSystemNode,this),this.system.components.on(j,this.onSystemComponent,this)}dispose(){this.system.nodes.off(B,this.onSystemNode,this),this.system.components.off(j,this.onSystemComponent,this),super.dispose()}createActions(e){return{selectNode:e.register({name:"Select Node",do:this.selectNode,target:this}),selectComponent:e.register({name:"Select Component",do:this.selectComponent,target:this}),clearSelection:e.register({name:"Clear Selection",do:this.clearSelection,target:this})}}nodeContainsSelectedComponent(e){const t=e.components.getArray();for(let e=0,n=t.length;e{e.updateMatrixWorld(!1),this.matrixWorld.copy(e.matrixWorld)}}dispose(){this.parent&&this.parent.remove(this),this.geometry.dispose()}static expandBoundingBox(e,t,n){const i=e.geometry;if(void 0!==i){let s=e;for(Pp.identity();s&&s!==t;)Pp.premultiply(s.matrix),s=s.parent;if(i.isGeometry){const e=i.vertices;for(let t=0,i=e.length;t{e.on("after-render",this.onSceneAfterRender,this)}),(e=>{e.off("after-render",this.onSceneAfterRender,this)}))}dispose(){this._sceneTracker.dispose(),this.system.off("pointer-up",this.onPointerUp,this),this._sceneTracker.dispose(),super.dispose()}update(){return!0}onSelectNode(e,t){super.onSelectNode(e,t);const n=e.getComponent(Rt,!0);n&&this.updateBracket(n,t)}onSelectComponent(e,t){super.onSelectComponent(e,t),(e instanceof zo||e instanceof Rt)&&this.updateBracket(e,t)}onPointerUp(e){this.ins.viewportPicking.value&&e.isPrimary&&!e.isDragging&&(e.component?this.selectComponent(e.component,e.ctrlKey):e.ctrlKey||this.clearSelection())}onSceneAfterRender(e){if(!this.ins.viewportBrackets.value)return;const t=e.context.renderer,n=e.context.camera;for(let e of this._brackets)e[1]instanceof Op&&e[1].update(),t.render(e[1],n)}updateBracket(e,t){if(e){if(t){const t=e.object3D;if(t)if(t.children[0]instanceof sl){const n=new Op(t.children[0],1,16766515);this._brackets.set(e,n)}else{const t=new Rp(e.object3D);this._brackets.set(e,t)}}else{const t=this._brackets.get(e);t&&(this._brackets.delete(e),t.dispose())}this.changed=!0}}}kp.typeName="CPickSelection";const zp=function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)},Up=function(e,t){"object"==typeof e&&(e=JSON.stringify(e));const n=window.URL.createObjectURL(new Blob([e],{type:"text/json"}));zp(n,t)};class Vp extends xt{constructor(e,t){super(e,t),this.ins=this.addInputs(Vp.rgIns),this._object3D=null,this._isAttached=!1,this._object3D=new ft,this._object3D.matrixAutoUpdate=!1}get transform(){return this.node.components.get(Rt,!0)}get scene(){const e=this.transform;return e?e.getParentComponent(Io,!0):void 0}get object3D(){return this._object3D}create(){super.create(),this.innerRoots.filter((e=>e.is(Rt))).forEach((e=>this._object3D.add(e.object3D))),this.trackComponent(Rt,(e=>this.ins.visible.value&&this.attachObject3D(e)),(e=>this.detachObject3D(e)))}dispose(){this.detachObject3D(this.transform),this.innerRoots.filter((e=>e.is(Rt))).forEach((e=>this._object3D.remove(e.object3D))),super.dispose()}update(e){super.update(e);const t=this.ins;if(t.visible.changed){const e=this.transform;t.visible.value?this.attachObject3D(e):this.detachObject3D(e)}return!0}onAddInnerRoot(e){e.is(Rt)&&this._object3D.add(e.object3D)}onRemoveInnerRoot(e){e.is(Rt)&&this._object3D.remove(e.object3D)}attachObject3D(e){this._isAttached||e&&(e.object3D.add(this._object3D),this._isAttached=!0)}detachObject3D(e){this._isAttached&&e&&(e.object3D.remove(this._object3D),this._isAttached=!1)}}Vp.typeName="CRenderGraph",Vp.rgIns={visible:C("Graph.Visible",!0)};var Fp=n(5310),Bp=n.n(Fp);const jp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/document.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Smithsonian 3D Document","description":"Describes a 3D document containing a scene with 3D models.","definitions":{"scene":{"$id":"#scene","type":"object","properties":{"nodes":{"type":"array","description":"The indices of the scene\'s root nodes.","items":{"type":"integer","minimum":0},"uniqueItems":true,"minItems":1},"setup":{"description":"The index of the scene\'s setup.","type":"integer","minimum":0}}},"node":{"$id":"#node","type":"object","properties":{"name":{"type":"string"},"children":{"type":"array","description":"The indices of this node\'s children.","items":{"type":"integer","minimum":0},"uniqueItems":true,"minItems":1},"matrix":{"description":"A floating-point 4x4 transformation matrix stored in column-major order.","type":"array","items":{"type":"number"},"minItems":16,"maxItems":16,"default":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},"translation":{"description":"The node\'s translation along the x, y, and z axes.","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[0,0,0]},"rotation":{"description":"The node\'s unit quaternion rotation in the order (x, y, z, w), where w is the scalar.","type":"array","items":{"type":"number","minimum":-1,"maximum":1},"minItems":4,"maxItems":4,"default":[0,0,0,1]},"scale":{"description":"The node\'s non-uniform scale, given as the scaling factors along the x, y, and z axes.","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[1,1,1]},"camera":{"description":"The index of the camera component of this node.","type":"integer","minimum":0},"light":{"description":"The index of the light component of this node.","type":"integer","minimum":0},"meta":{"description":"The index of the meta data component of this node.","type":"integer","minimum":0},"model":{"description":"The index of the model component of this node.","type":"integer","minimum":0}},"not":{"anyOf":[{"required":["matrix","translation"]},{"required":["matrix","rotation"]},{"required":["matrix","scale"]}]}},"camera":{"$id":"#camera","type":"object","properties":{"type":{"description":"Specifies if the camera uses a perspective or orthographic projection.","type":"string","enum":["perspective","orthographic"]},"perspective":{"description":"A perspective camera containing properties to create a perspective projection matrix.","type":"object","properties":{"yfov":{"type":"number","description":"The floating-point vertical field of view in radians.","exclusiveMinimum":0},"aspectRatio":{"type":"number","description":"The floating-point aspect ratio of the field of view.","exclusiveMinimum":0},"znear":{"type":"number","description":"The floating-point distance to the near clipping plane.","exclusiveMinimum":0},"zfar":{"type":"number","description":"The floating-point distance to the far clipping plane.","exclusiveMinimum":0}},"required":["yfov","znear"]},"orthographic":{"description":"An orthographic camera containing properties to create an orthographic projection matrix.","type":"object","properties":{"xmag":{"type":"number","description":"The floating-point horizontal magnification of the view. Must not be zero."},"ymag":{"type":"number","description":"The floating-point vertical magnification of the view. Must not be zero."},"znear":{"type":"number","description":"The floating-point distance to the near clipping plane.","exclusiveMinimum":0},"zfar":{"type":"number","description":"The floating-point distance to the far clipping plane. `zfar` must be greater than `znear`.","exclusiveMinimum":0}},"required":["ymag","znear","zfar"]}},"required":["type"],"not":{"required":["perspective","orthographic"]}},"light":{"$id":"#light","type":"object","properties":{"type":{"description":"Specifies the type of the light source.","type":"string","enum":["ambient","directional","point","spot","hemisphere"]},"color":{"$ref":"#/definitions/colorRGB"},"intensity":{"type":"number","minimum":0,"default":1},"castShadow":{"type":"boolean","default":false},"point":{"type":"object","properties":{"distance":{"type":"number","minimum":0},"decay":{"type":"number","minimum":0}}},"spot":{"type":"object","properties":{"distance":{"type":"number","minimum":0},"decay":{"type":"number","minimum":0},"angle":{"type":"number","minimum":0},"penumbra":{"type":"number","minimum":0}}},"hemisphere":{"type":"object","properties":{"groundColor":{"$ref":"#/definitions/colorRGB"}}}},"required":["type"],"not":{"required":["point","spot","hemisphere"]}},"colorRGB":{"$id":"#colorRGB","type":"array","items":{"type":"number","minimum":0,"maximum":1},"minItems":3,"maxItems":3,"default":[1,1,1]}},"type":"object","properties":{"asset":{"type":"object","properties":{"type":{"type":"string","const":"application/si-dpo-3d.document+json"},"version":{"description":"Version of this presentation description.","type":"string","minLength":1},"copyright":{"description":"A copyright message to credit the content creator.","type":"string","minLength":1},"generator":{"description":"Tool that generated this presentation description.","type":"string","minLength":1}},"required":["type","version"]},"scene":{"description":"Index of the root scene of the document.","type":"integer","minimum":0},"scenes":{"description":"An array of scenes.","type":"array","items":{"$ref":"#/definitions/scene"}},"nodes":{"description":"An array of nodes.","type":"array","items":{"$ref":"#/definitions/node"},"minItems":1},"metas":{"description":"An array of meta data components.","type":"array","items":{"$ref":"./meta.schema.json"}},"setups":{"description":"An array of setup components.","type":"array","items":{"$ref":"./setup.schema.json"},"minItems":1},"cameras":{"description":"An array of camera components.","type":"array","items":{"$ref":"#/definitions/camera"},"minItems":1},"lights":{"description":"An array of light components.","type":"array","items":{"$ref":"#/definitions/light"},"minItems":1},"models":{"description":"An array of model components.","type":"array","items":{"$ref":"./model.schema.json"},"minItems":1}},"required":["asset","scene","scenes"],"additionalProperties":false}'),$p=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/common.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Math","description":"Definitions for mathematical compound objects such as vectors and matrices.","definitions":{"units":{"$id":"#units","type":"string","enum":["inherit","mm","cm","m","km","in","ft","yd","mi"]},"vector2":{"description":"2-component vector.","$id":"#vector2","type":"array","items":{"type":"number"},"minItems":2,"maxItems":2,"default":[0,0]},"vector3":{"description":"3-component vector.","$id":"#vector3","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[0,0,0]},"vector4":{"description":"4-component vector.","$id":"#vector4","type":"array","items":{"type":"number"},"minItems":4,"maxItems":4,"default":[0,0,0,0]},"matrix3":{"description":"3 by 3, matrix, storage: column-major.","$id":"#matrix3","type":"array","items":{"type":"number"},"minItems":9,"maxItems":9,"default":[1,0,0,0,1,0,0,0,1]},"matrix4":{"description":"4 by 4 matrix, storage: column-major.","$id":"#matrix4","type":"array","items":{"type":"number"},"minItems":16,"maxItems":16,"default":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},"boundingBox":{"description":"Axis-aligned 3D bounding box.","$id":"#boundingBox","type":"object","properties":{"min":{"$ref":"#/definitions/vector3"},"max":{"$ref":"#/definitions/vector3"}},"required":["min","max"]}}}'),Hp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/meta.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Meta","description":"Meta data for a scene or model item.","definitions":{"image":{"$id":"image","description":"Reference to a preview image","type":"object","properties":{"uri":{"description":"Location of the image resource, absolute URL or path relative to this document","type":"string","minLength":1},"quality":{"type":"string","enum":["Thumb","Low","Medium","High"]},"byteSize":{"type":"integer","minimum":1},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1}},"required":["uri","quality"]},"article":{"$id":"#article","description":"Reference to an external document (HTML)","type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"description":"Short title.","type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"description":"Short lead text.","type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"tags":{"description":"Array of tags, categorizing the article.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"uri":{"description":"Location of the article resource, absolute URL or path relative to this document","type":"string","minLength":1},"uris":{"description":"Location of the article resource, absolute URL or path relative to this document with language key","type":"object"},"mimeType":{"description":"MIME type of the resource.","type":"string"},"thumbnailUri":{"description":"Location of a thumbnail/preview image of the resource.","type":"string"}},"required":["id"],"additionalProperties":false},"audioclip":{"$id":"audioclip","description":"Reference to an audio file","type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"description":"Short name.","type":"string"},"uris":{"description":"Location of the audio resource, absolute URL or path relative to this document with language key","type":"object"}},"required":["id","uris"]}},"type":"object","properties":{"collection":{"description":"Information retrieved from the collection record for the item.","type":"object"},"process":{"description":"Information about how the item was processed.","type":"object"},"images":{"type":"array","items":{"$ref":"#/definitions/image"},"minItems":1},"articles":{"type":"array","items":{"$ref":"#/definitions/article"},"minItems":1},"leadArticle":{"description":"Index of the main article. This is the default article displayed with the item.","type":"integer","minimum":0},"audio":{"type":"array","items":{"$ref":"#/definitions/audioclip"},"minItems":0}},"additionalProperties":false}'),Gp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/model.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Model","description":"Describes the visual representations (models, derivatives) of a 3D item.","definitions":{"annotation":{"description":"Spatial annotation (hot spot, hot zone) on a model. Annotations can reference articles.","type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"marker":{"type":"string"},"tags":{"description":"Array of tags, categorizing the annotation.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"articleId":{"description":"Id of an article related to this annotation.","type":"string","minLength":1},"imageUri":{"description":"URI of an image resource for this annotation.","type":"string","minLength":1},"style":{"type":"string"},"visible":{"description":"Flag indicating whether the annotation is visible.","type":"boolean","default":true},"expanded":{"description":"Flag indicating whether the annotation is displayed in expanded state.","type":"boolean","default":false},"scale":{"description":"Scales the annotation relative to its default size.","type":"number","default":1},"offset":{"description":"Offsets the annotation along its direction.","type":"number","default":0},"tilt":{"description":"Tilt angle of the annotation relative to the direction vector in degrees.","type":"number","default":0},"azimuth":{"description":"Azimuth angle of a tilted annotation.","type":"number","default":0},"color":{"description":"Color of the annotation","type":"array","minItems":3,"maxItems":3,"items":{"type":"number"}},"position":{"description":"Position where the annotation is anchored, in local item coordinates.","$ref":"./common.schema.json#/definitions/vector3"},"direction":{"description":"Direction of the stem of this annotation, usually corresponds to the surface normal.","$ref":"./common.schema.json#/definitions/vector3"},"zoneIndex":{"description":"Index of the zone on the zone texture.","type":"integer","minimum":0}},"required":["id"],"additionalProperties":false},"derivative":{"description":"Visual representation derived from the master model.","type":"object","properties":{"usage":{"description":"usage categories for a derivative.","type":"string","enum":["Image2D","Web3D","App3D","iOSApp3D","Print3D","Editorial3D"]},"quality":{"type":"string","enum":["Thumb","Low","Medium","High","Highest","AR"]},"assets":{"description":"List of individual resources this derivative is composed of.","type":"array","items":{"$ref":"#/definitions/asset"}}}},"asset":{"description":"an individual resource for a 3D model.","type":"object","properties":{"uri":{"type":"string","minLength":1},"type":{"type":"string","enum":["Model","Geometry","Image","Texture","Points","Volume"]},"part":{"type":"string","minLength":1},"mimeType":{"type":"string","minLength":1},"byteSize":{"type":"integer","minimum":1},"numFaces":{"type":"integer","minimum":1},"imageSize":{"type":"integer","minimum":1},"mapType":{"type":"string","enum":["Color","Normal","Occlusion","Emissive","MetallicRoughness","Zone"]}},"required":["uri","type"]},"material":{"description":"Surface properties for this model, shared by all derivatives.","type":"object","properties":{}}},"type":"object","properties":{"units":{"$ref":"./common.schema.json#/definitions/units"},"tags":{"type":"string"},"visible":{"type":"boolean"},"renderOrder":{"type":"number"},"shadowSide":{"type":"string","enum":["Front","Back","Double"]},"derivatives":{"type":"array","items":{"$ref":"#/definitions/derivative"}},"translation":{"description":"Translation vector. Must be applied to bring model into its \'neutral\' pose.","$ref":"./common.schema.json#/definitions/vector3"},"rotation":{"description":"Rotation quaternion. Must be applied to bring model into its \'neutral\' pose.","$ref":"./common.schema.json#/definitions/vector4"},"boundingBox":{"description":"Bounding box for this model, shared by all derivatives.","$ref":"./common.schema.json#/definitions/boundingBox"},"material":{"$ref":"#/definitions/material"},"annotations":{"description":"List of annotations to be displayed with the model","type":"array","items":{"$ref":"#/definitions/annotation"}}},"required":["units","derivatives"],"additionalProperties":false}'),Wp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/setup.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Setup","description":"Tours and settings for explorer documents (background, interface, etc.)","definitions":{"viewer":{"type":"object","properties":{"shader":{"type":"string"},"exposure":{"type":"number"},"gamma":{"type":"number"},"annotationsVisible":{"type":"boolean"},"activeTags":{"type":"string"},"sortedTags":{"type":"string"},"radioTags":{"type":"boolean"}},"required":["shader","exposure","gamma"]},"reader":{"type":"object","properties":{"enabled":{"type":"boolean"},"position":{"type":"string"},"articleId":{"description":"Id of the article currently displayed in the reader.","type":"string","minLength":1}}},"interface":{"type":"object","properties":{"visible":{"type":"boolean"},"logo":{"type":"boolean"},"menu":{"type":"boolean"},"tools":{"type":"boolean"}}},"navigation":{"type":"object","properties":{"type":{"type":"string","enum":["Orbit","Walk"]},"enabled":{"type":"boolean"},"autoZoom":{"type":"boolean"},"orbit":{"$comment":"TODO: Implement","type":"object","properties":{}},"walk":{"$comment":"TODO: Implement","type":"object","properties":{}}}},"background":{"type":"object","properties":{"style":{"type":"string","enum":["Solid","LinearGradient","RadialGradient"]},"color0":{"$ref":"./common.schema.json#/definitions/vector3"},"color1":{"$ref":"./common.schema.json#/definitions/vector3"}}},"floor":{"type":"object","properties":{"visible":{"type":"boolean"},"position":{"$ref":"./common.schema.json#/definitions/vector3"},"size":{"type":"number"},"color":{"$ref":"./common.schema.json#/definitions/vector3"},"opacity":{"type":"number"},"receiveShadow":{"type":"boolean"}}},"grid":{"type":"object","properties":{"visible":{"type":"boolean"},"color":{"$ref":"./common.schema.json#/definitions/vector3"}}},"tape":{"type":"object","properties":{"enabled":{"type":"boolean"},"startPosition":{"$ref":"./common.schema.json#/definitions/vector3"},"startDirection":{"$ref":"./common.schema.json#/definitions/vector3"},"endPosition":{"$ref":"./common.schema.json#/definitions/vector3"},"endDirection":{"$ref":"./common.schema.json#/definitions/vector3"}}},"slicer":{"type":"object","properties":{"enabled":{"type":"boolean"},"axis":{"type":"string","enum":["X","Y","Z"]},"inverted":{"type":"boolean"},"position":{"type":"number"}}},"tours":{"description":"Animated tours.","type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"tags":{"description":"Array of tags, categorizing the tour.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"steps":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"id":{"type":"string"}}}}}}},"snapshots":{"description":"Snapshots are animatable scene states.","type":"object","properties":{"features":{"type":"array","items":{"type":"string"}},"targets":{"type":"array","items":{"type":"string"}},"states":{"type":"array","items":{"type":"object"}}}}},"type":"object","properties":{"units":{"$ref":"./common.schema.json#/definitions/units"},"interface":{"$ref":"#/definitions/interface"},"viewer":{"$ref":"#/definitions/viewer"},"reader":{"$ref":"#/definitions/reader"},"navigation":{"$ref":"#/definitions/navigation"},"background":{"$ref":"#/definitions/background"},"floor":{"$ref":"#/definitions/floor"},"grid":{"$ref":"#/definitions/grid"},"tape":{"$ref":"#/definitions/tape"},"slicer":{"$ref":"#/definitions/slicer"},"tours":{"$ref":"#/definitions/tours"}}}');new Ve;class qp extends $d{constructor(e,t){super(e,t),this.ins=this.addInputs(qp.pointLightIns),this.object3D=new hl}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return n.position.changed&&(t.position.fromArray(n.position.value),t.updateMatrix()),(n.distance.changed||n.decay.changed)&&(t.distance=n.distance.value,t.decay=n.decay.value),t.updateMatrix(),!0}}qp.typeName="CPointLight",qp.pointLightIns={position:w("Light.Position"),distance:b("Light.Distance"),decay:b("Light.Decay",1)};class Xp extends qp{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.distance,this.ins.decay,this.ins.shadowEnabled,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if("point"!==n.type)throw new Error("light type mismatch: not a point light");return n.point=n.point||{},i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,distance:n.point.distance||i.distance.schema.preset,decay:void 0!==n.point.decay?n.point.decay:i.decay.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowResolution:void 0!==n.shadowResolution&&Bd[n.shadowResolution]||1,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,point:{distance:n.distance.value,decay:n.decay.value},type:"point"};n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=Bd[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}Xp.typeName="CVPointLight",Xp.text="Point Light",Xp.icon="bulb";class Yp extends $d{constructor(e,t){super(e,t),this.ins=this.addInputs(Yp.spotLightIns),this.object3D=new dl,this.light.target.matrixAutoUpdate=!1}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return(n.position.changed||n.target.changed)&&(t.position.fromArray(n.position.value),t.target.position.fromArray(n.target.value),t.updateMatrix(),t.target.updateMatrix()),(n.distance.changed||n.decay.changed||n.angle.changed||n.penumbra.changed)&&(t.distance=n.distance.value,t.decay=n.decay.value,t.angle=n.angle.value*Re,t.penumbra=n.penumbra.value),!0}onAddToParent(e){super.onAddToParent(e),e.add(this.light.target)}onRemoveFromParent(e){super.onRemoveFromParent(e),e.remove(this.light.target)}}Yp.typeName="CSpotLight",Yp.spotLightIns={position:w("Light.Position"),target:w("Light.Target",[0,-1,0]),distance:b("Light.Distance"),decay:b("Light.Decay",1),angle:b("Light.Angle",45),penumbra:_("Light.Penumbra",.5)};class Kp extends Yp{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.distance,this.ins.decay,this.ins.angle,this.ins.penumbra,this.ins.shadowEnabled,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if("spot"!==n.type)throw new Error("light type mismatch: not a spot light");return n.spot=n.spot||{},i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,target:i.target.schema.preset,distance:n.spot.distance||i.distance.schema.preset,decay:void 0!==n.spot.decay?n.spot.decay:i.decay.schema.preset,angle:void 0!==n.spot.angle?n.spot.angle:i.angle.schema.preset,penumbra:n.spot.penumbra||i.penumbra.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowResolution:void 0!==n.shadowResolution&&Bd[n.shadowResolution]||1,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,spot:{distance:n.distance.value,decay:n.decay.value,angle:n.angle.value,penumbra:n.penumbra.value},type:"spot"};n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=Bd[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}Kp.typeName="CVSpotLight",Kp.text="Spot Light",Kp.icon="bulb";class Jp extends B{get transform(){return this.components.get(Ms)}get meta(){return this.components.get(Nh,!0)}get model(){return this.components.get(Zd,!0)}get camera(){return this.components.get(sp,!0)}get light(){return this.components.get($d,!0)}get scene(){return this.components.get(op,!0)}createComponents(){this.name="Node",this.createComponent(Ms)}createModel(){this.name="Model",this.createComponent(Nh),this.createComponent(Zd)}fromDocument(e,t,n){const i=e.nodes[t];this.transform.fromData(i),n.set(`node/${t}`,this.transform);let s="Node";if(isFinite(i.meta)&&(this.createComponent(Nh).fromDocument(e,i),n.set(`meta/${i.meta}`,this.meta),s="Meta"),isFinite(i.model)&&(this.createComponent(Zd).fromDocument(e,i),n.set(`model/${i.model}`,this.model),s="Model"),isFinite(i.camera)&&(this.createComponent(sp).fromDocument(e,i),n.set(`camera/${i.camera}`,this.camera),s="Camera"),isFinite(i.light)){const t=e.lights[i.light].type;switch(t){case"directional":this.createComponent(hp).fromDocument(e,i),s="Directional Light";break;case"point":this.createComponent(Xp).fromDocument(e,i),s="Point Light";break;case"spot":this.createComponent(Kp).fromDocument(e,i),s="Spot Light";break;default:throw new Error(`unknown light type: '${t}'`)}n.set(`light/${i.light}`,this.light)}this.name=i.name||s;const r=i.children;r&&r.forEach((t=>{const i=this.graph.createCustomNode(Jp);this.transform.addChild(i.transform),i.fromDocument(e,t,n)}))}toDocument(e,t,n){n=n||{meta:!0,setup:!0,model:!0,camera:!0,light:!0},e.nodes=e.nodes||[];const i=e.nodes.length,s=this.transform.toData();e.nodes.push(s),t.set(this.transform,`node/${i}`),this.name&&(s.name=this.name),this.model&&n.model&&(s.model=this.model.toDocument(e,s),t.set(this.model,`model/${s.model}`)),this.camera&&n.camera&&(s.camera=this.camera.toDocument(e,s),t.set(this.camera,`camera/${s.camera}`)),this.light&&n.light&&(s.light=this.light.toDocument(e,s),t.set(this.light,`light/${s.light}`)),this.meta&&n.meta&&(s.meta=this.meta.toDocument(e,s),t.set(this.meta,`info/${s.meta}`));const r=this.transform.children.map((e=>e.node)).filter((e=>e.is(Jp)));return r.forEach((i=>{if(i.hasNodeComponents(n)){const r=i.toDocument(e,t,n);s.children=s.children||[],s.children.push(r)}})),i}hasNodeComponents(e){if(!e)return!0;const t=this.transform,n=this.components;return!(!e.model||!n.has(Zd)&&!t.hasChildComponents(Zd,!0))||(!(!e.camera||!n.has(sp)&&!t.hasChildComponents(sp,!0))||!(!e.light||!n.has($d)&&!t.hasChildComponents($d,!0)))}}Jp.typeName="NVNode";class Zp extends Jp{get setup(){return this.components.get(qd,!0)}createComponents(){this.createComponent(op),this.createComponent(qd),this.createComponent(Nh)}fromDocument(e,t,n){const i=e.scenes[t];i.name&&(this.name=i.name),this.scene.fromDocument(e,i),isFinite(i.meta)&&(this.meta.fromDocument(e,i),n.set(`meta/${i.meta}`,this.meta)),isFinite(i.setup)&&this.setup.fromDocument(e,t,n);const s=i.nodes;s&&s.forEach((t=>{const i=this.graph.createCustomNode(Jp);this.transform.addChild(i.transform),i.fromDocument(e,t,n)}))}toDocument(e,t,n){e.scenes=e.scenes||[];const i=e.scenes.length,s={units:"cm"};e.scenes.push(s),this.name&&(s.name=this.name),this.scene.toDocument(e,s);return this.transform.children.map((e=>e.node)).filter((e=>e.is(Jp))).forEach((i=>{if(i.hasNodeComponents(n)){const r=i.toDocument(e,t,n);s.nodes=s.nodes||[],s.nodes.push(r)}})),n&&!n.setup||(this.meta&&(s.meta=this.meta.toDocument(e,s),t.set(this.meta,`meta/${s.meta}`)),this.setup&&this.setup.toDocument(e,i,t)),i}}Zp.typeName="NVScene";class Qp extends Vp{constructor(e,t){super(e,t),this.titles={},this.meta=null,this.ins=this.addInputs(Qp.ins),this.outs=this.addOutputs(Qp.outs),this.innerGraph.createCustomNode(Zp),this.ins.active.setValue(!1),this.ins.visible.setValue(!1)}get root(){return this.innerNodes.get(Zp)}get setup(){return this.innerComponents.get(qd)}get assetPath(){return this.outs.assetPath.value}get assetBaseName(){let e=this.assetPath;const t=e.indexOf(".svx.json");return t>=0&&(e=e.substr(0,t)),e}get analytics(){return this.getMainComponent(Dh)}create(){super.create(),this.innerGraph.components.on(Nh,this.onMetaComponent,this),this.setup.language.outs.language.on("value",this.updateTitle,this)}dispose(){this.setup.language.outs.language.off("value",this.updateTitle,this),this.innerGraph.components.off(Nh,this.onMetaComponent,this),super.dispose()}update(e){super.update(e);const{ins:t,outs:n}=this;if(t.dumpJson.changed){const e=this.deflateDocument();console.log("-------------------- VOYAGER DOCUMENT --------------------"),console.log(JSON.stringify(e,((e,t)=>"number"==typeof t?parseFloat(t.toFixed(5)):t),2))}if(t.dumpTree.changed&&(console.log("-------------------- VOYAGER DOCUMENT --------------------"),this.dump()),t.download.changed){const e=n.assetPath.value.split("/").pop()||"voyager-document.json";Up(this.deflateDocument(),e)}if(t.title.changed&&this.titles){const e=this.setup.language;t.title.setValue(t.title.value,!0),n.title.setValue(t.title.value),t.title.value&&(this.titles[vs[e.outs.language.value]]=t.title.value,this.updateTitlesMeta())}return!0}clearNodeTree(){this.root.transform.children.slice().forEach((e=>e.node.dispose()))}openDocument(e,t,n){if(!Qp.validator.validate(e))throw new Error("document schema validation failed");n||(this.clearNodeTree(),this.ins.title.setValue(null)),this.onMetaComponent({type:"CVMeta",object:this.root.meta,add:!0,remove:!1});let i="object"==typeof n?n:this.root;if(i.graph!==this.innerGraph)throw new Error("invalid parent node");const s=new Map;if(i instanceof Zp)i.fromDocument(e,e.scene,s);else{e.scenes[e.scene].nodes.forEach((t=>{const n=this.innerGraph.createCustomNode(Jp);i.transform.addChild(n.transform),n.fromDocument(e,t,s)}))}t&&(this.outs.assetPath.setValue(t),this.name=this.getMainComponent(Ch).getAssetName(t))}appendModel(e,t,n){if(n&&n.graph!==this.innerGraph)throw new Error("invalid parent node");if(this.isEmpty())throw new Error("empty document, can't append model");n=n||this.root;const i=this.innerGraph.createCustomNode(Jp);n.transform.addChild(i.transform),i.createModel();const s=i.model;return s.derivatives.createModelAsset(e,t),s}appendGeometry(e,t,n,i,s,r){if(r&&r.graph!==this.innerGraph)throw new Error("invalid parent node");if(this.isEmpty())throw new Error("empty document, can't append geometry");r=r||this.root;const o=this.innerGraph.createCustomNode(Jp);r.transform.addChild(o.transform),o.createModel();o.model.derivatives.createMeshAsset(e,t,n,i,s)}deflateDocument(e){if(this.isEmpty())throw new Error("empty document, can't serialize");const t={asset:{type:Qp.mimeType,version:Qp.version,generator:"Voyager",copyright:"(c) Smithsonian Institution. All rights reserved."},scene:0,scenes:[]},n=new Map;return t.scene=this.root.toDocument(t,n,e),t}onMetaComponent(e){const t=e.object,n=this.ins.title,i=this.setup.language;null===this.meta&&(this.meta=t),e.add&&!n.value&&t.once("load",(()=>{this.titles=t.collection.get("titles")||{},0===Object.keys(this.titles).length&&(this.titles[vs[i.outs.language.value]]=t.collection.get("title")||"",t.collection.dictionary.titles=this.titles);const e=this.titles[vs[i.outs.language.value]];n.setValue(e),this.analytics.setTitle(e),this.meta=t}))}updateTitle(){const e=this.setup.language,t=this.titles[vs[e.outs.language.value]];this.ins.title.setValue(t)}updateTitlesMeta(){const e=this.meta;e&&(e.collection.dictionary.titles=this.titles)}}Qp.typeName="CVDocument",Qp.mimeType="application/si-dpo-3d.document+json",Qp.version="1.0",Qp.validator=new class{constructor(){this._schemaValidator=new(Bp())({schemas:[jp,$p,Hp,Gp,Wp],allErrors:!0}),this._validateDocument=this._schemaValidator.getSchema("https://schemas.3d.si.edu/voyager/document.schema.json")}validate(e){return!!this._validateDocument(e)||(console.warn(this._schemaValidator.errorsText(this._validateDocument.errors,{separator:", ",dataVar:"document"})),!1)}},Qp.ins={dumpJson:D("Document.DumpJSON"),dumpTree:D("Document.DumpTree"),download:D("Document.Download"),title:A("Document.Title")},Qp.outs={assetPath:P("Asset.Path",{preset:"scene.svx.json"}),title:A("Document.Title")};class em extends Tp{constructor(e,t){super(e,t),this.outs=this.addOutputs(em.outs),this.scope=Mp.Node}createDocument(e,t){const n=this.node.createComponent(Qp);return this.activeComponent=n,e&&n.openDocument(e,t),n}amendDocument(e,t,n){const i=this.activeComponent;if(!i)throw new Error("no active document, can't amend");return i.openDocument(e,t,n),i}refreshDocument(){this.emit({type:"active-component",previous:null,next:this.activeComponent})}appendModel(e,t){const n=this.activeComponent;if(!n)throw new Error("no active document, can't append model");return n.appendModel(e,t),n}appendGeometry(e,t,n,i,s){const r=this.activeComponent;if(!r)throw new Error("no active document, can't append geometry");return r.appendGeometry(e,t,n,i,s),r}removeActiveDocument(){const e=this.activeComponent;e&&e.dispose()}activateComponent(e){e.ins.visible.setValue(!0),e.ins.active.setValue(!0)}deactivateComponent(e){e.ins.visible.setValue(!1),e.ins.active.setValue(!1)}onActiveComponent(e,t){this.outs.activeDocument.setValue(t)}onScopedComponents(){this.outs.changedDocuments.set()}}em.typeName="CVDocumentProvider",em.componentType=Qp,em.outs={activeDocument:N("Documents.Active",Qp),changedDocuments:D("Documents.Changed")};class tm extends j{constructor(){super(...arguments),this.ins=this.addInputs(tm.ins)}get model(){return this.getComponent(Zd)}update(e){return!0}}tm.typeName="CVAnnotations",tm.ins={};class nm extends B{get pulse(){return this.components.get(Ee)}get renderer(){return this.components.get(Ae)}get fullscreen(){return this.components.get($)}get selection(){return this.components.get(kp)}get assetManager(){return this.components.get(Ch)}get assetReader(){return this.components.get(Rh)}get analytics(){return this.components.get(Dh)}get arManager(){return this.components.get(gp)}createComponents(){this.createComponent(Ee),this.createComponent(Ae),this.createComponent($),this.createComponent(Ch),this.createComponent(Rh),this.createComponent(Dh),this.createComponent(gp);this.createComponent(kp).ins.viewportBrackets.setValue(!1)}}nm.typeName="NVEngine";class im extends Cp{constructor(e,t){super(e,t),this.outs=this.addOutputs(im.outs),this.scope=Ep.Graph}get documentProvider(){return this.getComponent(em)}create(){super.create(),this.documentProvider.on("active-component",this.onActiveDocument,this)}dispose(){this.documentProvider.off("active-component",this.onActiveDocument,this),super.dispose()}onActiveDocument(e){this.scopedGraph=e.next}onActiveNode(e,t){this.outs.activeNode.setValue(t);const n=this.selection;t?n.nodeContainsSelectedComponent(t)||n.selectNode(t):e&&n.clearSelection()}onScopedNodes(){this.outs.changedNodes.set()}}im.typeName="CVNodeProvider",im.nodeType=Jp,im.followComponentSelection=!0,im.outs={activeNode:N("Nodes.Active",Jp),changedNodes:D("Nodes.Changed")};class sm extends B{get scene(){return this.components.get(Io)}get documentProvider(){return this.components.get(em)}get nodeProvider(){return this.components.get(im)}createComponents(){this.createComponent(Io,"Master Scene"),this.createComponent(em),this.createComponent(im)}}sm.typeName="NVDocuments";const rm=[xt,Ee,Tp,Cp,Fd,Ae,$,kp,Io,B,Dh,gp,Ch,Rh,Qp,em,op,qd,Ms,Nh,Zd,tm,Tu,sp,hp,Xp,Kp,Ru,Lu,Oh,od,dd,bd,Ed,Dd,Id,Gd,Hd,Au,Lh,Wd,nm,sm,Zp,Jp];class om extends j{constructor(){super(...arguments),this.activeDocument=null}get documentProvider(){return this.getGraphComponent(em)}startObserving(){const e=this.documentProvider;e.on("active-component",this.onActiveDocumentEvent,this),e.activeComponent&&(this.activeDocument=e.activeComponent,this.onActiveDocument(null,e.activeComponent))}stopObserving(){const e=this.documentProvider;e.off("active-component",this.onActiveDocumentEvent,this),e.activeComponent&&(this.activeDocument=null,this.onActiveDocument(e.activeComponent,null))}onActiveDocument(e,t){}onActiveDocumentEvent(e){this.activeDocument=e.next,this.onActiveDocument(e.previous,e.next)}}om.typeName="CVDocumentObserver";class am extends om{constructor(){super(...arguments),this.activeNode=null}get nodeProvider(){return this.getGraphComponent(im)}startObserving(){super.startObserving();const e=this.nodeProvider;e.on("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=e.activeNode,this.onActiveNode(null,e.activeNode))}stopObserving(){const e=this.nodeProvider;e.off("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=null,this.onActiveNode(e.activeNode,null)),super.stopObserving()}onActiveNode(e,t){}onActiveNodeEvent(e){this.activeNode=e.next,this.onActiveNode(e.previous,e.next)}}am.typeName="CVNodeObserver";var lm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class cm extends Zr{constructor(e){super(),this.system=e}}lm([Or({attribute:!1})],cm.prototype,"system",void 0);class hm extends cm{constructor(){super(...arguments),this.activeDocument=null}get documentProvider(){return this.system.getMainComponent(em)}connected(){const e=this.documentProvider;e.on("active-component",this.onActiveDocumentEvent,this);const t=e.activeComponent;t&&(this.activeDocument=t,this.onActiveDocument(null,t))}disconnected(){this.documentProvider.off("active-component",this.onActiveDocumentEvent,this);const e=this.activeDocument;e&&(this.activeDocument=null,this.onActiveDocument(e,null))}onActiveDocument(e,t){}onActiveDocumentEvent(e){this.activeDocument=e.next,this.onActiveDocument(e.previous,e.next)}}class um extends hm{constructor(){super(...arguments),this.activeNode=null}get nodeProvider(){return this.system.getMainComponent(im)}connected(){super.connected();const e=this.nodeProvider;e.on("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=e.activeNode,this.onActiveNode(null,e.activeNode))}disconnected(){const e=this.nodeProvider;e.off("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=null,this.onActiveNode(e.activeNode,null)),super.disconnected()}onActiveNode(e,t){this.requestUpdate()}onActiveNodeEvent(e){this.activeNode=e.next,this.onActiveNode(e.previous,e.next)}}var dm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class pm extends am{constructor(){super(...arguments),this.ins=this.addInputs(pm.toolIns),this.outs=this.addOutputs(pm.toolOuts),this._isActiveTool=!1}get isActiveTool(){return this._isActiveTool}dispose(){this._isActiveTool&&this.deactivateTool(),super.dispose()}createView(){throw new Error("must override")}activateTool(){this._isActiveTool=!0,this.startObserving()}deactivateTool(){this.stopObserving(),this._isActiveTool=!1}}pm.typeName="CVTool",pm.toolIns={},pm.toolOuts={};class mm extends um{constructor(e){super(e.system),this.tool=null,this.needsFocus=!1,this.tool=e}get analytics(){return this.system.getMainComponent(Dh)}firstConnected(){this.classList.add("sv-group","sv-tool-view"),this.needsFocus=!0}connected(){super.connected(),this.tool.on("update",this.onUpdate,this)}disconnected(){this.tool.off("update",this.onUpdate,this),super.disconnected()}updated(e){super.updated(e),this.needsFocus&&(this.setFocus(),this.needsFocus=!1)}setFocus(){}}dm([Or({attribute:!1})],mm.prototype,"tool",void 0);class fm extends Tp{constructor(e,t){super(e,t),this.ins=this.addInputs(fm.ins),this.scope=Mp.Node}get analytics(){return this.getMainComponent(Dh)}update(e){return this.ins.visible.changed,!0}activateComponent(e){e.activateTool(),this.analytics.sendProperty("Tools.ActiveTool",e.text)}deactivateComponent(e){e.deactivateTool()}onActiveComponent(e,t){}}fm.typeName="CVToolProvider",fm.isSystemSingleton=!0,fm.componentType=pm,fm.ins={visible:C("Tools.Visible"),closed:D("Tools.Closed")};var gm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let vm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.options=null,this.indexMap=null,this.language=null}firstConnected(){this.classList.add("sv-property-view","sv-property-options")}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type||!this.property.schema.options)throw new Error("not an options property");if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.indexMap,n=this.name||e.name,i=this.options||e.schema.options,s=e.value,r=this.language;let o;return o=t?t.map((e=>_r` + `)):i.map(((e,t)=>_r` + `)),_r`
this.onKeyDown(e)} title=${n} class="sv-options">${o}
`}onButtonClick(e){const t=e.target.index;this.property.setValue(t)}onKeyDown(e){if("ArrowUp"===e.code||"ArrowLeft"===e.code){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).findIndex((t=>e.target===t));n>0&&(t[n].setAttribute("tabIndex","-1"),t[n-1].setAttribute("tabIndex","0"),t[n-1].focus())}else if("ArrowDown"===e.code||"ArrowRight"===e.code){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).findIndex((t=>e.target===t));n0===e.tabIndex)),0)].focus()}tabReset(e){const t=this.getElementsByTagName("ff-button"),n=Array.from(t),i=n.findIndex((e=>0===e.tabIndex)),s=n.findIndex((e=>"true"===e.getAttribute("aria-checked")));if(i!=s){t[i].setAttribute("tabIndex","-1");t[s>-1?s:0].setAttribute("tabIndex","0")}}};gm([Or({attribute:!1})],vm.prototype,"property",void 0),gm([Or({type:String})],vm.prototype,"name",void 0),gm([Or({attribute:!1})],vm.prototype,"options",void 0),gm([Or({attribute:!1})],vm.prototype,"indexMap",void 0),gm([Or({attribute:!1})],vm.prototype,"language",void 0),vm=gm([Qr("sv-property-options")],vm);var ym=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let bm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.text="",this.icon=""}firstConnected(){this.classList.add("sv-property-view","sv-property-event")}update(e){if(!this.property)throw new Error("missing property attribute");if(!this.property.schema.event)throw new Error(`not an event property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=this.text,i=this.icon;return _r` +
+ +
`}onButtonClick(e){this.property.set()}};ym([Or({attribute:!1})],bm.prototype,"property",void 0),ym([Or({type:String})],bm.prototype,"name",void 0),ym([Or({type:String})],bm.prototype,"text",void 0),ym([Or({type:String})],bm.prototype,"icon",void 0),bm=ym([Qr("sv-property-event")],bm);var xm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class _m extends pm{createView(){return new wm(this)}}_m.typeName="CVViewTool",_m.text="View",_m.icon="eye";let wm=class extends mm{firstConnected(){super.firstConnected(),this.classList.add("sv-view-tool-view")}render(){const e=this.activeDocument;if(!e)return _r``;this.tool;const t=e.setup.navigation,n=e.setup.language,i=t.ins.projection,s=t.ins.preset,r=t.ins.zoomExtents,o=[nd.Front,nd.Back,nd.Left,nd.Right,nd.Top,nd.Bottom];return _r``}onActiveDocument(e,t){this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};wm=xm([Qr("sv-view-tool-view")],wm);var Sm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class Mm extends pm{createView(){return new Em(this)}}Mm.typeName="CVRenderTool",Mm.text="Material",Mm.icon="palette";let Em=class extends mm{constructor(){super(...arguments),this.viewer=null}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-render-tool-view")}render(){this.tool;const e=this.activeDocument,t=this.viewer;if(!t)return _r``;const n=t.ins.shader,i=e.setup.language;return _r`
+
+ +
+
`}onActiveDocument(e,t){this.viewer&&(this.viewer.ins.shader.off("value",this.onUpdate,this),this.viewer=null),t&&(this.viewer=t.setup.viewer,this.viewer.ins.shader.on("value",this.onUpdate,this))}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};Em=Sm([Qr("sv-render-tool-view")],Em);var Tm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class Cm extends pm{createView(){return new Am(this)}}Cm.typeName="CVEnvironmentTool",Cm.text="Environment",Cm.icon="environment";let Am=class extends mm{firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-environment-tool-view")}render(){this.tool;if(!this.activeDocument)return _r`No active document`;const e=this.activeDocument.setup,t=e.grid,n=e.floor,i=e.background,s=i.ins.style.getValidatedValue()===ad.Solid,r=e.environment,o=e.language;return _r`
+
+ + + ${s?null:_r``} + + + + + +
+
`}onActiveDocument(e,t){if(e){e.setup.background.ins.style.off("value",this.onUpdate,this)}if(t){t.setup.background.ins.style.on("value",this.onUpdate,this)}this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};Am=Tm([Qr("sv-environment-tool-view")],Am);var Pm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Rm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.text=null,this.language=null,this.disabled=!1,this.customLabelStyle=""}firstConnected(){this.classList.add("sv-property-view","sv-property-boolean")}update(e){if(!this.property)throw new Error("missing property attribute");if("boolean"!==this.property.type)throw new Error("not a boolean property");if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=t.replace(/\s/g,""),i=this.text,s=this.language,r=this.customLabelStyle;let o=e.value?Array.isArray(i)?i[1]:i||"On":Array.isArray(i)?i[0]:i||"Off";return _r` + `}onButtonClick(e){this.property.setValue(!this.property.value)}};Pm([Or({attribute:!1})],Rm.prototype,"property",void 0),Pm([Or({type:String})],Rm.prototype,"name",void 0),Pm([Or({attribute:!1})],Rm.prototype,"text",void 0),Pm([Or({attribute:!1})],Rm.prototype,"language",void 0),Pm([Or({type:Boolean})],Rm.prototype,"disabled",void 0),Pm([Or({type:String})],Rm.prototype,"customLabelStyle",void 0),Rm=Pm([Qr("sv-property-boolean")],Rm);class Lm{constructor(e){this.isEnabled=!0,this._isDragging=!1,this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this.target=e,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),e.addEventListener("pointercancel",this.onPointerUp)}get isDragging(){return this._isDragging}get startX(){return this._startX}get startY(){return this._startY}onPointerDown(e){e.isPrimary&&this.isEnabled&&(this._isDragging=!0,this._startX=this._lastX=e.clientX,this._startY=this._lastY=e.clientY,this.target.setPointerCapture(e.pointerId),this.target.dragStart(e)),e.stopPropagation(),e.preventDefault()}onPointerMove(e){if(e.isPrimary&&this._isDragging){const t=e.clientX-this._lastX;this._lastX=e.clientX;const n=e.clientY-this._lastY;this._lastY=e.clientY,this.target.dragMove(e,t,n)}e.stopPropagation(),e.preventDefault()}onPointerUp(e){this._isDragging&&e.isPrimary&&(this.target.dragEnd(e),this.target.releasePointerCapture(e.pointerId),this._isDragging=!1),e.stopPropagation(),e.preventDefault()}}var Nm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Dm=class extends Zr{constructor(){super(),this.direction="horizontal",this.value=0,this._isVertical=!1,this._offsetX=0,this._offsetY=0,this._knob=(new Zr).addClass("ff-knob").setStyle({display:"block",position:"relative "}),new Lm(this)}dragStart(e){const t=this._knob,n=this.getBoundingClientRect();e.target===this._knob?(this._offsetX=e.clientX-t.offsetLeft+.5*(t.clientWidth-t.offsetWidth),this._offsetY=e.clientY-t.offsetTop+.5*(t.clientHeight-t.offsetHeight)):(this._offsetX=n.left+.8*t.clientWidth,this._offsetY=n.top+.8*t.clientHeight),this.dragMove(e)}dragMove(e){const t=this._knob,n=e.clientX-this._offsetX,i=e.clientY-this._offsetY;let s=this._isVertical?1-i/(this.clientHeight-t.clientHeight):n/(this.clientWidth-t.clientWidth);s=vt.limit(s,0,1),s!==this.value&&(this.value=s,this.emitChangeEvent(!0))}dragEnd(){this.emitChangeEvent(!1)}firstConnected(){this.setStyle({position:"relative",touchAction:"none"}),this.setAttribute("touch-action","none"),this.setAttribute("tabindex","0"),this.classList.add("ff-control","ff-linear-slider"),this.appendChild(this._knob)}update(e){if(e.has("direction")&&(this._isVertical="vertical"===this.direction,this.setClass("ff-horizontal",!this._isVertical),this.setClass("ff-vertical",this._isVertical)),e.has("value")){const e=vt.limit(this.value,0,1),t=this._isVertical?0:100*e,n=this._isVertical?100*(1-e):0;this._knob.style.left=`${t.toFixed(3)}%`,this._knob.style.top=`${n.toFixed(3)}%`}super.update(e)}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,isDragging:e},bubbles:!0}))}};Nm([Or({type:String})],Dm.prototype,"direction",void 0),Nm([Or({type:Number})],Dm.prototype,"value",void 0),Dm=Nm([Qr("ff-linear-slider")],Dm);const Om=Dm;var Im=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let km=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.min=void 0,this.max=void 0}firstConnected(){super.firstConnected(),this.classList.add("sv-property-view","sv-property-slider")}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type)throw new Error(`not a number property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=e.getValidatedValue(),i=isFinite(this.min)?this.min:e.schema.min,s=isFinite(this.max)?this.max:e.schema.max,r=(n-i)/(s-i);return _r` + `}onSliderChange(e){const t=this.property,n=isFinite(this.min)?this.min:t.schema.min,i=isFinite(this.max)?this.max:t.schema.max,s=n+e.detail.value*(i-n);t.setValue(s)}onKeyDown(e){const t=this.property;"ArrowRight"===e.code||"ArrowUp"===e.code||"PageUp"===e.code?t.setValue(this.clamp("PageUp"===e.code?t.value+.1:t.value+.01)):"ArrowLeft"!==e.code&&"ArrowDown"!==e.code&&"PageDown"!==e.code||t.setValue(this.clamp("PageDown"===e.code?t.value-.1:t.value-.01))}clamp(e){const t=this.property,n=isFinite(this.min)?this.min:t.schema.min,i=isFinite(this.max)?this.max:t.schema.max;return Math.min(Math.max(e,n),i)}};Im([Or({attribute:!1})],km.prototype,"property",void 0),Im([Or({type:String})],km.prototype,"name",void 0),Im([Or({type:Number})],km.prototype,"min",void 0),Im([Or({type:Number})],km.prototype,"max",void 0),km=Im([Qr("sv-property-slider")],km);var zm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Um=class extends Zr{constructor(){super(...arguments),this.name="",this.index=0,this.text="",this.placeholder="",this.align="left",this.initialValue="",this.requestFocus=!1}get inputElement(){return this.getElementsByTagName("input").item(0)}focus(){this.requestFocus=!0,this.performUpdate()}hasFocus(){const e=document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement;return this.inputElement===e}firstConnected(){this.classList.add("ff-control","ff-line-edit")}shouldUpdate(e){return!this.hasFocus()&&super.shouldUpdate(e)}render(){return _r``}updated(){this.requestFocus&&(this.requestFocus=!1,this.inputElement.focus())}onKeyDown(e){const t=e.target;"Enter"===e.key?(this.commit(t),t.blur()):"Escape"===e.key&&(this.revert(t),t.blur())}onChange(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!1)}onInput(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!0)}onFocus(e){this.initialValue=e.target.value,e.target.select()}onBlur(e){this.commit(e.target),this.requestUpdate()}revert(e){e.value=this.initialValue,this.dispatchChangeEvent(e.value,!1)}commit(e){this.initialValue=e.value,this.dispatchChangeEvent(e.value,!1)}dispatchChangeEvent(e,t){this.dispatchEvent(new CustomEvent("change",{detail:{text:e,isEditing:t}}))}};zm([Or({type:String})],Um.prototype,"name",void 0),zm([Or({type:Number})],Um.prototype,"index",void 0),zm([Or({type:String})],Um.prototype,"text",void 0),zm([Or({type:String})],Um.prototype,"placeholder",void 0),zm([Or({type:String})],Um.prototype,"align",void 0),Um=zm([Qr("ff-line-edit")],Um);var Vm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Fm=class extends Zr{constructor(){super(),this.value=new zh,this._offsetX=0,this._offsetY=0,this._knob=(new Zr).addClass("ff-knob").setStyle({display:"block",position:"relative "}),new Lm(this)}setXY(e,t){this.value.set(e,t),this.requestUpdate()}dragStart(e){const t=this._knob,n=this.getBoundingClientRect();e.target===this._knob?(this._offsetX=e.clientX-t.offsetLeft+.5*(t.clientWidth-t.offsetWidth),this._offsetY=e.clientY-t.offsetTop+.5*(t.clientHeight-t.offsetHeight)):(this._offsetX=n.left+.8*t.clientWidth,this._offsetY=n.top+.8*t.clientHeight),this.dragMove(e)}dragMove(e){const t=this._knob,n=e.clientX-this._offsetX,i=e.clientY-this._offsetY;let s=n/(this.clientWidth-t.clientWidth);s=vt.limit(s,0,1);let r=1-i/(this.clientHeight-t.clientHeight);r=vt.limit(r,0,1),s===this.value.x&&r===this.value.y||(this.value=this.value.set(s,r),this.emitChangeEvent(!0))}dragEnd(){this.emitChangeEvent(!1)}firstConnected(){this.setStyle({position:"relative",touchAction:"none"}),this.setAttribute("touch-action","none"),this.setAttribute("tabindex","0"),this.classList.add("ff-control","ff-vector-slider"),this.appendChild(this._knob)}update(e){const t=100*this.value.x,n=100*(1-this.value.y);this._knob.style.left=`${t.toFixed(3)}%`,this._knob.style.top=`${n.toFixed(3)}%`,super.update(e)}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,isDragging:e},bubbles:!0}))}};Vm([Or({attribute:!1})],Fm.prototype,"value",void 0),Fm=Vm([Qr("ff-vector-slider")],Fm);const Bm=Fm;var jm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const $m=new Fh;let Hm=class extends Zr{constructor(){super(),this.color=new Fh,this.alpha=!1,this.numeric=!1,this.onLumSatChange=this.onLumSatChange.bind(this),this.onHueChange=this.onHueChange.bind(this),this.onAlphaChange=this.onAlphaChange.bind(this),this.addEventListener("click",(e=>e.stopPropagation())),this._hsv=new Uh,this._lumSatSlider=(new Bm).on("change",this.onLumSatChange),this._hueSlider=(new Om).addClass("ff-hue-slider").on("change",this.onHueChange),this._hueSlider.direction="vertical"}firstConnected(){this.classList.add("ff-flex-column","ff-control","ff-color-edit")}update(e){e.has("color")&&this.color.toHSV(this._hsv),e.has("alpha")&&(this.alpha&&!this._alphaSlider?(this._alphaSlider=(new Om).addClass("ff-alpha-slider").on("change",this.onAlphaChange),this._alphaSlider.direction="vertical"):!this.alpha&&this._alphaSlider&&this._alphaSlider.remove()),super.update(e)}render(){let e=null;if(this.numeric){const t=this.color,n=t.toString(!1).substr(1),i=this.alpha?_r` +
A
+ `:null;e=_r`
+
R
+
G
+
B
+ ${i} +
#
+
`}return _r`
+ ${this._lumSatSlider}${this._hueSlider}${this._alphaSlider} +
${e}`}updated(){this._hueSlider.value=1-this._hsv.x/360;const e=`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, ${$m.setHSV(this._hsv.x).toString(!1)})`;if(this._lumSatSlider.style.backgroundImage=e,this._lumSatSlider.setXY(this._hsv.y,this._hsv.z),this.alpha){const e=this.color.toString(!1),t=getComputedStyle(this._alphaSlider).color,n=`linear-gradient(to top, transparent, ${e}), repeating-linear-gradient(-45deg, transparent, transparent 8px, ${t} 8px, ${t} 16px)`;this._alphaSlider.style.backgroundImage=n,this._alphaSlider.value=this.color.alpha}}onLumSatChange(e){e.stopPropagation();const t=e.detail.value;this._hsv.y=t.x,this._hsv.z=t.y,this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onHueChange(e){e.stopPropagation(),this._hsv.x=360*(1-e.target.value),this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onAlphaChange(e){e.stopPropagation(),this.color.alpha=e.target.value,this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onNumericEdit(e){e.stopPropagation();const t=e.target.name;if("string"===t)this.color.setString(e.detail.text,1,!1);else{let n=parseInt(e.detail.text);if(!isFinite(n))return;this.color[t]=vt.limit(n,0,255)}this.color.toHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isEditing)}onKeyDown(e){const t="ArrowRight"===e.code||"ArrowUp"===e.code,n="PageUp"===e.code,i="ArrowLeft"===e.code||"ArrowDown"===e.code,s="PageDown"===e.code;if(t||n||i||s)if(e.target===this._hueSlider||e.target===this._alphaSlider){const s=t||n?-1:1,r=t||i?.01:.1;e.target===this._hueSlider?(this._hsv.x=vt.limit(this._hsv.x+360*r*s,0,360),this.color.setHSV(this._hsv)):this.color.alpha=vt.limit(this.color.alpha+r*s,0,1),this.requestUpdate(),this.emitChangeEvent(!1)}else if(e.target===this._lumSatSlider&&(t||i)){const n=t?1:-1,i=e.shiftKey?.1:.01;"ArrowRight"===e.code||"ArrowLeft"===e.code?this._hsv.y=vt.limit(this._hsv.y+i*n,0,1):this._hsv.z=vt.limit(this._hsv.z+i*n,0,1),this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(!1)}}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{color:this.color,isDragging:e},bubbles:!0}))}};jm([Or({attribute:!1})],Hm.prototype,"color",void 0),jm([Or({type:Boolean})],Hm.prototype,"alpha",void 0),jm([Or({type:Boolean})],Hm.prototype,"numeric",void 0),Hm=jm([Qr("ff-color-edit")],Hm);function Gm(e){return[...e.querySelectorAll('a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden")&&"-1"!==e.getAttribute("tabindex")))}function Wm(e,t){const n=e[0],i=e[e.length-1];t.shiftKey?t.target===n&&(t.preventDefault(),i.focus()):t.target===i&&(t.preventDefault(),n.focus())}var qm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Xm=class extends Zr{constructor(){super(),this.property=null,this.name="",this.color=new Fh,this.pickerActive=!1,this.onPointerDown=this.onPointerDown.bind(this)}firstConnected(){super.firstConnected(),this.classList.add("sv-property-view","sv-property-color")}connected(){document.addEventListener("pointerdown",this.onPointerDown,{capture:!0,passive:!0})}disconnected(){document.removeEventListener("pointerdown",this.onPointerDown)}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type||3!==this.property.elementCount)throw new Error(`not an color property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onPropertyChange,this),this.property&&(this.property.on("value",this.onPropertyChange,this),this.color.fromArray(this.property.value))}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=this.color.toString();return _r` + + ${this.pickerActive?_r`this.onKeyDown(e)} @change=${this.onColorEditChange}>`:null}`}async setPickerFocus(){await this.updateComplete;Gm(this.getElementsByTagName("ff-color-edit").item(0))[0].focus()}onButtonClick(e){this.pickerActive=!this.pickerActive,this.requestUpdate(),this.pickerActive&&this.setPickerFocus()}onColorEditChange(e){this.property.setValue(e.detail.color.toRGBArray())}onPropertyChange(e){this.color.fromArray(e),this.requestUpdate()}onPointerDown(e){this.pickerActive&&(e.composedPath()[0]instanceof Node&&this.contains(e.composedPath()[0])||(this.pickerActive=!1,this.requestUpdate()))}onKeyDown(e){if("Escape"===e.code)e.preventDefault(),e.stopPropagation(),this.pickerActive=!1,this.requestUpdate(),this.getElementsByTagName("ff-button")[0].focus();else if("Tab"===e.code){Wm(Gm(this.getElementsByTagName("ff-color-edit")[0]),e)}}};qm([Or({attribute:!1})],Xm.prototype,"property",void 0),qm([Or({type:String})],Xm.prototype,"name",void 0),Xm=qm([Qr("sv-property-color")],Xm);var Ym=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class Km extends pm{constructor(){super(...arguments),this.lights=[],this.ins=this.addInputs(Km.ins),this.outs=this.addOutputs(Km.outs)}update(e){return this.outs.light.setValue(this.lights[this.ins.light.getValidatedValue()]),!0}createView(){return new Jm(this)}onActiveDocument(e,t){this.lights=t?t.getInnerComponents($d):[],this.ins.light.setOptions(this.lights.map((e=>e.node.name))),this.outs.light.setValue(this.lights[0]),super.onActiveDocument(e,t)}}Km.typeName="CVLightTool",Km.text="Lights",Km.icon="bulb",Km.ins={light:L("Tool.Light",[])},Km.outs={light:N("Tool.SelectedLight",$d)};let Jm=class extends mm{constructor(){super(...arguments),this.lights=null}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-light-tool-view")}connected(){super.connected(),this.tool.outs.light.on("value",this.onUpdate,this)}disconnected(){this.tool.outs.light.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.tool,t=e.lights,n=this.activeDocument;if(!t||!n)return _r`No editable lights in this scene.`;const i=e.outs.light.value,s=n.setup.navigation,r=n.setup.language,o=i?_r`
+ +
+ + + +
+
`:null;return _r`${o}
+
+ + +
+
`}onActiveDocument(e,t){e&&e.setup.navigation.ins.lightsFollowCamera.off("value",this.onUpdate,this),t&&t.setup.navigation.ins.lightsFollowCamera.on("value",this.onUpdate,this),this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};Jm=Ym([Qr("sv-light-tool-view")],Jm);var Zm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Qm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name=""}firstConnected(){this.classList.add("sv-property-view","sv-property-string")}update(e){if(!this.property)throw new Error("missing property attribute");if("string"!==this.property.type)throw new Error(`not a string property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=e.value;return _r` +
${n}
`}};Zm([Or({attribute:!1})],Qm.prototype,"property",void 0),Zm([Or({type:String})],Qm.prototype,"name",void 0),Qm=Zm([Qr("sv-property-string")],Qm);var ef=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class tf extends pm{createView(){return new nf(this)}}tf.typeName="CVTapeTool",tf.text="Measure",tf.icon="tape";let nf=class extends mm{constructor(){super(...arguments),this.firstRender=!0,this.statusMsg=""}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-tape-tool-view")}render(){const e=this.activeDocument;if(!e)return _r``;this.tool;const t=e.setup.tape,n=t.ins.enabled,i=t.outs.state.value,s=t.outs.distance.value,r=e.setup.language;let o;if(n.value)if(0===s)o=r.getLocalizedString("Tap on model to set start of tape")+".";else if(i===Nd.SetStart){const t=e.root.scene.ins.units.getOptionText();o=`${s.toFixed(2)} ${t}`}else o=r.getLocalizedString("Tap on model to set end of tape")+".";else o=r.getLocalizedString("Switch on to take measurements")+".";return this.statusMsg=o,_r`
+
+ +
+
+
`}updated(e){super.updated(e);const t=this.getElementsByClassName("ff-string").item(0);t&&(t.innerHTML=this.statusMsg,this.firstRender&&(setTimeout((()=>{t.innerHTML=`
${this.statusMsg}
`}),200),this.firstRender=!1))}onActiveDocument(e,t){e&&e.setup.tape.off("update",this.onUpdate,this),t&&t.setup.tape.on("update",this.onUpdate,this),this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("ff-button")[1].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};nf=ef([Qr("sv-tape-tool-view")],nf);var sf=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class rf extends pm{createView(){return new of(this)}}rf.typeName="CVSliceTool",rf.text="Slice",rf.icon="knife";let of=class extends mm{firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-slice-tool-view")}render(){const e=this.activeDocument;if(!e)return _r``;this.tool;const t=e.setup.slicer,n=t.ins.enabled,i=t.ins.axis,s=t.ins.position,r=e.setup.language;return _r`
+
+ + + +
+
`}onActiveDocument(e,t){this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("ff-button")[1].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};of=sf([Qr("sv-slice-tool-view")],of);class af extends B{get toolProvider(){return this.getComponent(fm)}createComponents(){this.createComponent(fm),this.createComponent(_m),this.createComponent(Mm),this.createComponent(Cm),this.createComponent(Km),this.createComponent(tf),this.createComponent(rf)}}af.typeName="NVTools";const lf=[im,fm,_m,Mm,Cm,Km,tf,rf,af],cf=JSON.parse('{"asset":{"type":"application/si-dpo-3d.document+json","version":"1.0","copyright":"(c) Smithsonian Institution, all rights reserved","generator":"Voyager"},"scene":0,"scenes":[{"nodes":[0,1],"setup":0}],"nodes":[{"translation":[0,0,15],"camera":0},{"name":"Lights","children":[2,3,4,5]},{"translation":[0,0,2],"rotation":[0.4829741,-0.1070728,0.1880998,0.8484633],"scale":[1,1,1],"name":"Key","light":0},{"rotation":[0.3546969,0.163893,-0.3861077,0.8356136],"scale":[1,1,1],"name":"Fill #1","light":1},{"translation":[0,0,1],"rotation":[0.9374013,-0.3018693,0.0532277,0.1652891],"name":"Fill #2","light":2},{"translation":[1,0,-1],"rotation":[0.373256,0.6426073,-0.5786063,0.3360813],"scale":[1,1,1],"name":"Rim","light":3}],"setups":[{"units":"cm","interface":{"visible":true,"logo":true,"menu":true,"tools":true},"viewer":{"shader":"Default","exposure":1,"gamma":2,"annotationsVisible":false},"reader":{"enabled":false,"position":"Overlay"},"navigation":{"type":"Orbit","enabled":true,"autoZoom":true,"lightsFollowCamera":true,"autoRotation":false,"orbit":{"orbit":[-24,-26,0],"offset":[0,0,150],"minOrbit":[-90,null,null],"maxOrbit":[90,null,null],"minOffset":[null,null,0.1],"maxOffset":[null,null,10000]}},"background":{"style":"RadialGradient","color0":[0.2,0.25,0.3],"color1":[0.01,0.03,0.05]},"floor":{"visible":false,"position":[0,-25,0],"size":50,"color":[0.6,0.75,0.8],"opacity":0.5,"receiveShadow":false},"grid":{"visible":false,"color":[0.5,0.7,0.8]},"tape":{"enabled":false,"startPosition":[0,0,0],"startDirection":[0,0,0],"endPosition":[0,0,0],"endDirection":[0,0,0]},"slicer":{"enabled":false,"axis":"X","inverted":false,"position":0.5}}],"cameras":[{"type":"perspective","perspective":{"yfov":52,"znear":0.1,"zfar":100000}}],"lights":[{"color":[1,0.95,0.9],"intensity":1,"type":"directional","shadowEnabled":true},{"color":[0.9,0.95,1],"intensity":0.7,"type":"directional","shadowEnabled":true},{"color":[0.8,0.85,1],"intensity":0.5,"type":"directional"},{"color":[0.85,0.9078313,1],"intensity":0.6,"type":"directional"}]}');function hf(e,t,n){return Math.min(Math.max(e,t),n)}class uf{constructor(e,t,n){this.props=t||{},console.log(uf.splashMessage);const i=new xp;i.add(rm),i.add(lf),this.commander=new bp;const s=this.system=new _p(i),r=s.graph.createCustomNode(nm);s.graph.createCustomNode(af),s.graph.createCustomNode(sm),this.analytics.startTimer(),e&&new db(this).appendTo(e),n||(this.documentProvider.createDocument(cf),this.evaluateProps());(/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1)&&(window.createImageBitmap=void 0),r.pulse.start()}get assetManager(){return this.system.getMainComponent(Ch)}get assetReader(){return this.system.getMainComponent(Rh)}get documentProvider(){return this.system.getMainComponent(em)}get analytics(){return this.system.getMainComponent(Dh)}dispose(){this.assetReader.dispose(),this.documentProvider.activeComponent.clearNodeTree(),this.system.getMainComponent(Ae).views.forEach((e=>e.dispose())),this.documentProvider.activeComponent.setup.tape.dispose(),this.documentProvider.activeComponent.setup.floor.dispose(),this.documentProvider.activeComponent.setup.grid.dispose()}setBaseUrl(e){this.assetManager.baseUrl=e}loadDocument(e,t,n){const i=Wo[n];return this.assetReader.getJSON(e).then((n=>(t=void 0===t?!n.lights&&!n.cameras:t,this.documentProvider.amendDocument(n,e,t)))).then((e=>(isFinite(i)&&e.setup.viewer.ins.quality.setValue(i),e)))}loadModel(e,t){return this.documentProvider.appendModel(e,t)}loadGeometry(e,t,n,i,s){return this.documentProvider.appendGeometry(e,t,n,i,s)}evaluateProps(){const e=this.props,t=this.assetManager;e.root=e.root||vp("root")||vp("r"),e.dracoRoot=e.dracoRoot||vp("dracoRoot")||vp("dr"),e.resourceRoot=e.resourceRoot||vp("resourceRoot")||vp("rr"),e.document=e.document||vp("document")||vp("d"),e.model=e.model||vp("model")||vp("m"),e.geometry=e.geometry||vp("geometry")||vp("g"),e.texture=e.texture||vp("texture")||vp("t"),e.occlusion=e.occlusion||vp("occlusion")||vp("o"),e.normals=e.normals||vp("normals")||vp("n"),e.quality=e.quality||vp("quality")||vp("q"),e.uiMode=e.uiMode||vp("uiMode")||vp("u"),e.bgColor=e.bgColor||vp("bgColor")||vp("bc"),e.bgStyle=e.bgStyle||vp("bgStyle")||vp("bs"),e.controls=e.controls||vp("controls")||vp("ct"),e.lang=e.lang||vp("lang")||vp("l");const n=e.root||e.document||e.model||e.geometry;if(this.setBaseUrl(new URL(n||".",window.location).href),e.uiMode){let t=0,n=!1;const i=Object.values(Pu).filter((e=>"string"==typeof e));e.uiMode.split("|").forEach((e=>{const s=e.toLowerCase();i.includes(s)&&(t+=Pu[s],n=!0)})),n&&this.documentProvider.activeComponent.setup.interface.ins.visibleElements.setValue(t)}e.dracoRoot&&this.assetReader.setDracoPath(e.dracoRoot),e.resourceRoot&&this.assetReader.setSystemAssetPath(e.resourceRoot),e.lang&&this.setLanguage(e.lang),e.document?(e.document=e.root?e.document:t.getAssetName(e.document),this.loadDocument(e.document,void 0,e.quality).then((()=>this.postLoadHandler(e))).catch((e=>ho.show(`Failed to load document: ${e.message}`,"error")))):e.model?(e.model=e.root?e.model:t.getAssetName(e.model),this.assetReader.getText(e.model).then((()=>{this.loadModel(e.model,e.quality),this.postLoadHandler(e)})).catch((e=>ho.show(`Bad Model Path: ${e.message}`,"error")))):e.geometry?(e.geometry=e.root?e.geometry:t.getAssetName(e.geometry),e.texture=e.root?e.texture:t.getAssetName(e.texture),e.occlusion=e.root?e.occlusion:t.getAssetName(e.occlusion),e.normals=e.root?e.normals:t.getAssetName(e.normals),this.assetReader.getText(e.geometry).then((()=>{this.loadGeometry(e.geometry,e.texture,e.occlusion,e.normals,e.quality),this.postLoadHandler(e)})).catch((e=>ho.show(`Bad Geometry Path: ${e.message}`,"error")))):e.root&&this.loadDocument("scene.svx.json",void 0).then((()=>this.postLoadHandler(e))).catch((()=>{}))}postLoadHandler(e){if(this.assetManager.ins.baseUrlValid.setValue(!0),e.bgColor){const t=e.bgColor.split(" ");this.setBackgroundColor(t[0],t[1]||null)}e.bgStyle&&this.setBackgroundStyle(e.bgStyle),e.controls&&this.enableNavigation(e.controls)}toggleAnnotations(){const e=this.system.getMainComponent(em).activeComponent.setup.viewer.ins,t=this.system.getMainComponent(fm).ins;t.visible.value&&t.visible.setValue(!1),e.annotationsVisible.setValue(!e.annotationsVisible.value),this.analytics.sendProperty("Annotations.Visible",e.annotationsVisible.value)}toggleReader(){const e=this.system.getMainComponent(em).activeComponent.setup.reader.ins;e.enabled.setValue(!e.enabled.value),this.analytics.sendProperty("Reader.Enabled",e.enabled.value)}toggleTours(){const e=this.system.getMainComponent(em).activeComponent.setup.tours.ins,t=this.system.getMainComponent(em).activeComponent.setup.reader.ins;e.enabled.value?e.enabled.setValue(!1):(t.enabled.value&&t.enabled.setValue(!1),e.enabled.setValue(!0),e.tourIndex.setValue(-1)),this.analytics.sendProperty("Tours.Enabled",e.enabled.value)}toggleTools(){const e=this.system.getMainComponent(fm).ins,t=this.system.getMainComponent(em).activeComponent.setup.viewer.ins;t.annotationsVisible.value&&t.annotationsVisible.setValue(!1),e.visible.setValue(!e.visible.value),this.analytics.sendProperty("Tools.Visible",e.visible.value)}toggleMeasurement(){const e=this.system.getMainComponent(em).activeComponent.setup.tape.ins;e.visible.setValue(!e.visible.value)}enableAR(){this.system.getMainComponent(gp).ins.enabled.setValue(!0),this.analytics.sendProperty("AR.enabled",!0)}getArticles(){return this.system.getMainComponent(em).activeComponent.setup.reader.articles.map((e=>e.article.data))}getAnnotations(){const e=this.system.getComponent(op).getGraphComponents(Tu);let t=[];return e.forEach((e=>{t=t.concat(e.getAnnotations())})),t}getCameraOrbit(){return this.system.getMainComponent(em).activeComponent.setup.navigation.ins.orbit.value.slice(0,2)}setCameraOrbit(e,t){const n=this.system.getMainComponent(em).activeComponent.setup.navigation.ins,i=parseFloat(e),s=parseFloat(t);isNaN(i)||isNaN(s)?console.log("Error: setCameraOrbit param is not a number."):n.orbit.setValue([i,s,0])}getCameraOffset(){return this.system.getMainComponent(em).activeComponent.setup.navigation.ins.offset.value.slice(0,3)}setCameraOffset(e,t,n){const i=this.system.getMainComponent(em).activeComponent.setup.navigation.ins;let s=parseFloat(e),r=parseFloat(t),o=parseFloat(n);if(isNaN(s)||isNaN(r)||isNaN(o))console.log("Error: setCameraOffset param is not a number.");else{const e=i.minOffset.value,t=i.maxOffset.value;s=hf(s,e[0],t[0]),r=hf(r,e[1],t[1]),o=hf(o,e[2],t[2]),i.offset.setValue([s,r,o])}}setBackgroundColor(e,t){const n=this.system.getMainComponent(em).activeComponent.setup.background.ins,i=document.createElement("div");if(i.id="temp-color",document.getElementsByTagName("voyager-explorer")[0].appendChild(i),i.style.color=e,""!==i.style.color){const e=getComputedStyle(i).color.split("(")[1].split(")")[0].split(",").map((e=>parseInt(e)/255));n.color0.setValue(e)}else console.log("Error: Color0 param is invalid.");if(t)if(i.style.color=t,""!==i.style.color){const e=getComputedStyle(i).color.split("(")[1].split(")")[0].split(",").map((e=>parseInt(e)/255));n.color1.setValue(e)}else console.log("Error: Color1 param is invalid.");document.getElementsByTagName("voyager-explorer")[0].removeChild(i)}setBackgroundStyle(e){const t=this.system.getMainComponent(em).activeComponent.setup.background.ins,n=Object.values(ia).filter((e=>"string"==typeof e)).find((t=>t.toLowerCase()===e.toLowerCase()));void 0!==n?t.style.setValue(ia[n]):console.log("Error: Style param is invalid.")}setTourStep(e,t,n){const i=this.system.getMainComponent(em).activeComponent.setup.tours.ins,s=this.system.getMainComponent(em).activeComponent.setup.tours.outs;let r=parseInt(e),o=parseInt(t);!isNaN(r)&&!isNaN(o)&&r>=0&&o>=0?(i.tourIndex.setValue(r),n?(s.stepIndex.setValue(o-1),i.next.set()):i.stepIndex.setValue(o)):console.log("Error: setTourStep param ["+r+" "+o+"] is not a valid number.")}enableNavigation(e){let t;const n=e.toLowerCase();if("true"===n?t=!0:"false"===n&&(t=!1),null!=t){this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.setValue(t)}else console.log("Error: enableNavigation param is not valid.")}setLanguage(e){const t=this.system.getMainComponent(em).activeComponent.setup.language.ins,n=e.toUpperCase();n in vs?t.language.setValue(vs[n]):console.log("Error: setLanguage param is not a valid language id.")}}uf.splashMessage="\n _________ .__ __ .__ .__ ________ ________ \n / _____/ _____ |__|/ |_| |__ __________ ____ |__|____ ____ \\_____ \\\\______ \\ \n \\_____ \\ / \\| \\ __\\ | \\ / ___/ _ \\ / \\| \\__ \\ / \\ _(__ < | | \\ \n / \\ Y Y \\ || | | Y \\\\___ ( <_> ) | \\ |/ __ \\| | \\ / \\| ` \\\n/_______ /__|_| /__||__| |___| /____ >____/|___| /__(____ /___| / /______ /_______ /\n \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \n \nVoyager - 3D Explorer and Tool Suite\n3D Foundation Project\n(c) 2022 Smithsonian Institution\n\nhttps://3d.si.edu\nhttps://github.com/smithsonian/dpo-voyager\n\n-----------------------------------------------------\nVersion: Voyager Explorer v0.17.0 PROD\n-----------------------------------------------------\n ",window.VoyagerExplorer=uf;class df{constructor(e,t,n){this._type=e,this._callback=t,this._context=n,this._publishers=[]}on(...e){return e.forEach((e=>{this._publishers.push(e),e.on(this._type,this._callback,this._context)})),this}off(){return this._publishers.forEach((e=>e.off(this._type,this._callback,this._context))),this._publishers.length=0,this}}class pf{constructor(e){this.next=null,this.activePositions=[],this.activeType="",this.centerX=0,this.centerY=0,this.startX=0,this.startY=0,this.isDragging=!1,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUpOrCancel=this.onPointerUpOrCancel.bind(this),this.onDoubleClick=this.onDoubleClick.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onWheel=this.onWheel.bind(this),e&&(e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUpOrCancel),e.addEventListener("pointercancel",this.onPointerUpOrCancel),e.addEventListener("contextmenu",this.onContextMenu),e.addEventListener("wheel",this.onWheel))}onPointerDown(e){if(this.activeType&&e.pointerType!==this.activeType)return;0===this.activePositions.length&&(this.startX=e.clientX,this.startY=e.clientY,this.isDragging=!1),this.activeType=e.pointerType,this.activePositions.push({id:e.pointerId,clientX:e.clientX,clientY:e.clientY}),e.currentTarget.setPointerCapture(e.pointerId);const t=this.createManipPointerEvent(e,"pointer-down");this.sendPointerEvent(t)&&e.stopPropagation()}onPointerMove(e){const t=this.activePositions;for(let n=0,i=t.length;n0&&!this.isDragging){Math.abs(e.clientX-this.startX)+Math.abs(e.clientY-this.startY)>4&&(this.isDragging=!0)}const n=t.length?"pointer-move":"pointer-hover",i=this.createManipPointerEvent(e,n);this.sendPointerEvent(i)&&e.stopPropagation()}onPointerUpOrCancel(e){const t=this.activePositions;let n=!1;for(let i=0,s=t.length;i0){for(let e=0;e0?1:-1,c.push(C.x,C.y,C.z),h.push(a/f),h.push(1-r/g),E+=1}}for(let e=0;e=0){let r=l[t];if(void 0===r&&("instanceMatrix"===t&&s.instanceMatrix&&(r=s.instanceMatrix),"instanceColor"===t&&s.instanceColor&&(r=s.instanceColor)),void 0!==r){const t=r.normalized,o=r.itemSize,l=n.get(r);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(r.isInterleavedBufferAttribute){const n=r.data,l=n.stride,d=r.offset;if(n&&n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const r="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=r||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),m=e.getParameter(e.MAX_VERTEX_ATTRIBS),f=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=u>0,b=r||t.has("OES_texture_float");return{isWebGL2:r,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:s,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:r?e.getParameter(e.MAX_SAMPLES):0}}function _f(e){const t=this;let n=null,i=0,s=!1,r=!1;const o=new qa,a=new tt,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function h(e,n,i,s){const r=null!==e?e.length:0;let c=null;if(0!==r){if(c=l.value,!0!==s||null===c){const t=i+4*r,s=n.matrixWorldInverse;a.getNormalMatrix(s),(null===c||c.length\n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new gf(5,5,5),s=new _o({name:"CubemapFromEquirect",uniforms:yo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});s.uniforms.tEquirect.value=t;const r=new ui(i,s),o=t.minFilter;t.minFilter===ne&&(t.minFilter=te);return new Sf(1,10,this).update(e,r),t.minFilter=o,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(s)}}function Tf(e){let t=new WeakMap;function n(e,t){return t===q?e.mapping=G:304===t&&(e.mapping=W),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const s=t.get(n);void 0!==s&&(t.delete(n),s.dispose())}return{get:function(s){if(s&&s.isTexture&&!1===s.isRenderTargetTexture){const r=s.mapping;if(r===q||304===r){if(t.has(s)){return n(t.get(s).texture,s.mapping)}{const r=s.image;if(r&&r.height>0){const o=new Ef(r.height/2);return o.fromEquirectangularTexture(e,s),t.set(s,o),s.addEventListener("dispose",i),n(o.texture,s.mapping)}return null}}}return s},dispose:function(){t=new WeakMap}}}Ef.prototype.isWebGLCubeRenderTarget=!0;const Cf=Math.pow(2,8),Af=[.125,.215,.35,.446,.526,.582],Pf=5+Af.length,Rf=20,Lf=new nl,{_lodPlanes:Nf,_sizeLods:Df,_sigmas:Of}=Bf(),If=new Pn;let kf=null;const zf=(1+Math.sqrt(5))/2,Uf=1/zf,Vf=[new Ve(1,1,1),new Ve(-1,1,1),new Ve(1,1,-1),new Ve(-1,1,-1),new Ve(0,zf,Uf),new Ve(0,zf,-Uf),new Ve(Uf,0,zf),new Ve(-Uf,0,zf),new Ve(zf,Uf,0),new Ve(-zf,Uf,0)];class Ff{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(e),n=new Ve(0,1,0);return new uu({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:Wf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(Rf),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){kf=this._renderer.getRenderTarget();const s=this._allocateTargets();return this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Gf(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Hf(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let e=0;e2?Cf:0,Cf,Cf),a.setRenderTarget(i),d&&a.render(u,s),a.render(e,s)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===G||e.mapping===W;i?(null===this._cubemapShader&&(this._cubemapShader=Gf()),this._cubemapShader.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectShader&&(this._equirectShader=Hf());const s=i?this._cubemapShader:this._equirectShader,r=new ui(Nf[0],s),o=s.uniforms;o.envMap.value=e,i||o.texelSize.value.set(1/e.image.width,1/e.image.height),$f(t,0,0,3*Cf,2*Cf),n.setRenderTarget(t),n.render(r,Lf)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;tRf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e4?i-8+4:0),3*v,2*v),a.setRenderTarget(t),a.render(c,Lf)}}function Bf(){const e=[],t=[],n=[];let i=8;for(let s=0;s4?o=Af[s-8+4-1]:0===s&&(o=0),n.push(o);const a=1/(r-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,m=2,f=1,g=new Float32Array(p*d*u),v=new Float32Array(m*d*u),y=new Float32Array(f*d*u);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(i,p*d*e),v.set(h,m*d*e);const s=[e,e,e,e,e,e];y.set(s,f*d*e)}const b=new qn;b.setAttribute("position",new On(g,p)),b.setAttribute("uv",new On(v,m)),b.setAttribute("faceIndex",new On(y,f)),e.push(b),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function jf(e){const t=new vo(3*Cf,3*Cf,e);return t.texture.mapping=X,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function $f(e,t,n,i,s){e.viewport.set(t,n,i,s),e.scissor.set(t,n,i,s)}function Hf(){const e=new sn(1,1);return new uu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e}},vertexShader:Wf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = texture2D ( envMap, uv ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Gf(){return new uu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Wf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Wf(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function qf(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const s=t.get(n);void 0!==s&&(t.delete(n),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping,o=r===q||304===r,a=r===G||r===W;if(o||a){if(s.isRenderTargetTexture&&!0===s.needsPMREMUpdate){s.needsPMREMUpdate=!1;let i=t.get(s);return null===n&&(n=new Ff(e)),i=o?n.fromEquirectangular(s,i):n.fromCubemap(s,i),t.set(s,i),i.texture}if(t.has(s))return t.get(s).texture;{const r=s.image;if(o&&r&&r.height>0||a&&r&&function(e){let t=0;const n=6;for(let i=0;it.maxTextureSize&&(u=Math.ceil(h/t.maxTextureSize),h=t.maxTextureSize);const d=new Float32Array(h*u*4*i),p=new Zf(d,h,u,i);p.format=ce,p.type=oe,p.needsUpdate=!0;const m=4*l;for(let t=0;t0)return e;const s=t*n;let r=hg[s];if(void 0===r&&(r=new Float32Array(s),hg[s]=r),0!==t){i.toArray(r,0);for(let i=1,s=0;i!==t;++i)s+=n,e[i].toArray(r,s)}return r}function gg(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function bv(e){return e.replace(yv,xv)}function xv(e,t){const n=Qo[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return bv(n)}const _v=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,wv=/#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 Sv(e){return e.replace(wv,Ev).replace(_v,Mv)}function Mv(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ev(e,t,n,i)}function Ev(e,t,n,i){let s="";for(let e=parseInt(t);e0&&(f+="\n"),g=[d,p].filter(fv).join("\n"),g.length>0&&(g+="\n")):(f=[Tv(n),"#define SHADER_NAME "+n.shaderName,p,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(fv).join("\n"),g=[d,Tv(n),"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Qo.tonemapping_pars_fragment:"",0!==n.toneMapping?mv("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.transparent?"":"#define OPAQUE",Qo.encodings_pars_fragment,pv("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(fv).join("\n")),o=bv(o),o=gv(o,n),o=vv(o,n),a=bv(a),a=gv(a,n),a=vv(a,n),o=Sv(o),a=Sv(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",f=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+f,g=["#define varying in",n.glslVersion===Se?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Se?"":"#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("\n")+"\n"+g);const y=v+f+o,b=v+g+a,x=hv(s,s.VERTEX_SHADER,y),_=hv(s,s.FRAGMENT_SHADER,b);if(s.attachShader(m,x),s.attachShader(m,_),void 0!==n.index0AttributeName?s.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&s.bindAttribLocation(m,0,"position"),s.linkProgram(m),e.debug.checkShaderErrors){const e=s.getProgramInfoLog(m).trim(),t=s.getShaderInfoLog(x).trim(),n=s.getShaderInfoLog(_).trim();let i=!0,r=!0;if(!1===s.getProgramParameter(m,s.LINK_STATUS)){i=!1;const t=dv(s,x,"vertex"),n=dv(s,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(m,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(r=!1);r&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:f},fragmentShader:{log:n,prefix:g}})}let w,S;return s.deleteShader(x),s.deleteShader(_),this.getUniforms=function(){return void 0===w&&(w=new cv(s,m)),w},this.getAttributes=function(){return void 0===S&&(S=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s0,R=r.clearcoat>0;return{isWebGL2:h,shaderID:w,shaderName:r.type,vertexShader:M,fragmentShader:E,defines:r.defines,customVertexShaderID:T,customFragmentShaderID:C,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:f,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:m,outputEncoding:null===A?e.outputEncoding:!0===A.isXRRenderTarget?A.texture.encoding:be,map:!!r.map,matcap:!!r.matcap,envMap:!!_,envMapMode:_&&_.mapping,envMapCubeUV:!!_&&(_.mapping===X||307===_.mapping),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,decodeVideoTexture:!!r.map&&!0===r.map.isVideoTexture&&r.map.encoding===xe,clearcoat:R,clearcoatMap:R&&!!r.clearcoatMap,clearcoatRoughnessMap:R&&!!r.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,specularIntensityMap:!!r.specularIntensityMap,specularColorMap:!!r.specularColorMap,transparent:r.transparent,alphaMap:!!r.alphaMap,alphaTest:P,gradientMap:!!r.gradientMap,sheen:r.sheen>0,sheenColorMap:!!r.sheenColorMap,sheenRoughnessMap:!!r.sheenRoughnessMap,transmission:r.transmission>0,transmissionMap:!!r.transmissionMap,thicknessMap:!!r.thicknessMap,combine:r.combine,vertexTangents:!!r.normalMap&&!!y.geometry&&!!y.geometry.attributes.tangent,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!y.geometry&&!!y.geometry.attributes.color&&4===y.geometry.attributes.color.itemSize,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap||r.thicknessMap||r.specularIntensityMap||r.specularColorMap||r.sheenColorMap||r.sheenRoughnessMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmission>0||r.transmissionMap||r.thicknessMap||r.specularIntensityMap||r.specularColorMap||r.sheen>0||r.sheenColorMap||r.sheenRoughnessMap||!r.displacementMap),fog:!!b,useFog:r.fog,fogExp2:b&&b.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===y.isSkinnedMesh&&S>0,maxBones:S,useVertexTexture:d,morphTargets:!!y.geometry&&!!y.geometry.morphAttributes.position,morphNormals:!!y.geometry&&!!y.geometry.morphAttributes.normal,morphTargetsCount:y.geometry&&y.geometry.morphAttributes.position?y.geometry.morphAttributes.position.length:0,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.maxBones),e.push(t.morphTargetsCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection)}(n,t),function(e,t){a.disableAll(),t.isWebGL2&&a.enable(0);t.supportsVertexTextures&&a.enable(1);t.instancing&&a.enable(2);t.instancingColor&&a.enable(3);t.map&&a.enable(4);t.matcap&&a.enable(5);t.envMap&&a.enable(6);t.envMapCubeUV&&a.enable(7);t.lightMap&&a.enable(8);t.aoMap&&a.enable(9);t.emissiveMap&&a.enable(10);t.bumpMap&&a.enable(11);t.normalMap&&a.enable(12);t.objectSpaceNormalMap&&a.enable(13);t.tangentSpaceNormalMap&&a.enable(14);t.clearcoat&&a.enable(15);t.clearcoatMap&&a.enable(16);t.clearcoatRoughnessMap&&a.enable(17);t.clearcoatNormalMap&&a.enable(18);t.displacementMap&&a.enable(19);t.specularMap&&a.enable(20);t.roughnessMap&&a.enable(21);t.metalnessMap&&a.enable(22);t.gradientMap&&a.enable(23);t.alphaMap&&a.enable(24);t.alphaTest&&a.enable(25);t.vertexColors&&a.enable(26);t.vertexAlphas&&a.enable(27);t.vertexUvs&&a.enable(28);t.vertexTangents&&a.enable(29);t.uvsVertexOnly&&a.enable(30);t.fog&&a.enable(31);e.push(a.mask),a.disableAll(),t.useFog&&a.enable(0);t.flatShading&&a.enable(1);t.logarithmicDepthBuffer&&a.enable(2);t.skinning&&a.enable(3);t.useVertexTexture&&a.enable(4);t.morphTargets&&a.enable(5);t.morphNormals&&a.enable(6);t.premultipliedAlpha&&a.enable(7);t.shadowMapEnabled&&a.enable(8);t.physicallyCorrectLights&&a.enable(9);t.doubleSided&&a.enable(10);t.flipSided&&a.enable(11);t.depthPacking&&a.enable(12);t.dithering&&a.enable(13);t.specularIntensityMap&&a.enable(14);t.specularColorMap&&a.enable(15);t.transmission&&a.enable(16);t.transmissionMap&&a.enable(17);t.thicknessMap&&a.enable(18);t.sheen&&a.enable(19);t.sheenColorMap&&a.enable(20);t.sheenRoughnessMap&&a.enable(21);t.decodeVideoTexture&&a.enable(22);t.transparent&&a.enable(23);e.push(a.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=g[e.type];let n;if(t){const e=ta[t];n=xo.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=c.length;e0?i.push(h):!0===o.transparent?s.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=r(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?s.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||Dv),i.length>1&&i.sort(t||Ov),s.length>1&&s.sort(t||Ov)}}}function kv(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Iv,e.set(t,[i])):n>=e.get(t).length?(i=new Iv,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function zv(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Ve,color:new Pn};break;case"SpotLight":n={position:new Ve,direction:new Ve,color:new Pn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ve,color:new Pn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ve,skyColor:new Pn,groundColor:new Pn};break;case"RectAreaLight":n={color:new Pn,position:new Ve,halfWidth:new Ve,halfHeight:new Ve}}return e[t.id]=n,n}}}let Uv=0;function Vv(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Fv(e,t){const n=new zv,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new sn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new sn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)s.probe.push(new Ve);const r=new Ve,o=new je,a=new je;return{setup:function(r,o){let a=0,l=0,c=0;for(let e=0;e<9;e++)s.probe[e].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,v=0;r.sort(Vv);const y=!0!==o?Math.PI:1;for(let e=0,t=r.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(s.rectAreaLTC1=ea.LTC_FLOAT_1,s.rectAreaLTC2=ea.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(s.rectAreaLTC1=ea.LTC_HALF_1,s.rectAreaLTC2=ea.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=a,s.ambient[1]=l,s.ambient[2]=c;const b=s.hash;b.directionalLength===h&&b.pointLength===u&&b.spotLength===d&&b.rectAreaLength===p&&b.hemiLength===m&&b.numDirectionalShadows===f&&b.numPointShadows===g&&b.numSpotShadows===v||(s.directional.length=h,s.spot.length=d,s.rectArea.length=p,s.point.length=u,s.hemi.length=m,s.directionalShadow.length=f,s.directionalShadowMap.length=f,s.pointShadow.length=g,s.pointShadowMap.length=g,s.spotShadow.length=v,s.spotShadowMap.length=v,s.directionalShadowMatrix.length=f,s.pointShadowMatrix.length=g,s.spotShadowMatrix.length=v,b.directionalLength=h,b.pointLength=u,b.spotLength=d,b.rectAreaLength=p,b.hemiLength=m,b.numDirectionalShadows=f,b.numPointShadows=g,b.numSpotShadows=v,s.version=Uv++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t=n.get(i).length?(r=new Bv(e,t),n.get(i).push(r)):r=n.get(i)[s],r},dispose:function(){n=new WeakMap}}}class $v extends wn{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}$v.prototype.isMeshDepthMaterial=!0;class Hv extends wn{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Ve,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}Hv.prototype.isMeshDistanceMaterial=!0;function Gv(e,t,n){let i=new Ka;const s=new sn,r=new sn,o=new Ln,a=new $v({depthPacking:3201}),l=new Hv,c={},h=n.maxTextureSize,u={0:1,1:0,2:2},d=new _o({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new sn},radius:{value:4}},vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n",fragmentShader:"\nuniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n\n#include \n\nvoid main() {\n\n\tconst float samples = float( VSM_SAMPLES );\n\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\n\t// This seems totally useless but it's a crazy work around for a Adreno compiler bug\n\t// float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\n\t\t#ifdef HORIZONTAL_PASS\n\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\n\t\t#else\n\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\n\t\t#endif\n\n\t}\n\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n\n}\n"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const m=new qn;m.setAttribute("position",new On(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new ui(m,d),g=this;function v(n,i){const s=t.update(f);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,s,d,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,s,p,f,null)}function y(t,n,i,s,r,o,h){let d=null;const p=!0===s.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(d=void 0!==p?p:!0===s.isPointLight?l:a,e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const e=d.uuid,t=i.uuid;let n=c[e];void 0===n&&(n={},c[e]=n);let s=n[t];void 0===s&&(s=d.clone(),n[t]=s),d=s}return d.visible=i.visible,d.wireframe=i.wireframe,d.side=3===h?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],d.alphaMap=i.alphaMap,d.alphaTest=i.alphaTest,d.clipShadows=i.clipShadows,d.clippingPlanes=i.clippingPlanes,d.clipIntersection=i.clipIntersection,d.displacementMap=i.displacementMap,d.displacementScale=i.displacementScale,d.displacementBias=i.displacementBias,d.wireframeLinewidth=i.wireframeLinewidth,d.linewidth=i.linewidth,!0===s.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(s.matrixWorld),d.nearDistance=r,d.farDistance=o),d}function b(n,s,r,o,a){if(!1===n.visible)return;if(n.layers.test(s.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld);const i=t.update(n),s=n.material;if(Array.isArray(s)){const t=i.groups;for(let l=0,c=t.length;lh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/p.x),s.x=r.x*p.x,u.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/p.y),s.y=r.y*p.y,u.mapSize.y=r.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const e={minFilter:te,magFilter:te,format:ce};u.map=new vo(s.x,s.y,e),u.map.texture.name=c.name+".shadowMap",u.mapPass=new vo(s.x,s.y,e),u.camera.updateProjectionMatrix()}if(null===u.map){const e={minFilter:Z,magFilter:Z,format:ce};u.map=new vo(s.x,s.y,e),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e=1):-1!==P.indexOf("OpenGL ES")&&(A=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),C=A>=2);let R=null,L={};const N=e.getParameter(e.SCISSOR_BOX),D=e.getParameter(e.VIEWPORT),O=(new Ln).fromArray(N),I=(new Ln).fromArray(D);function k(t,n,i){const s=new Uint8Array(4),r=e.createTexture();e.bindTexture(t,r),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let t=0;ti||e.height>i)&&(s=i/Math.max(e.width,e.height)),s<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?ze:Math.floor,r=i(s*e.width),o=i(s*e.height);void 0===m&&(m=g(r,o));const a=n?g(r,o):m;a.width=r,a.height=o;return a.getContext("2d").drawImage(e,0,0,r,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+r+"x"+o+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function y(e){return ke(e.width)&&ke(e.height)}function b(e,t){return e.generateMipmaps&&t&&e.minFilter!==Z&&e.minFilter!==te}function x(t){e.generateMipmap(t)}function _(n,i,s,r,o=!1){if(!1===a)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return i===e.RED&&(s===e.FLOAT&&(l=e.R32F),s===e.HALF_FLOAT&&(l=e.R16F),s===e.UNSIGNED_BYTE&&(l=e.R8)),i===e.RG&&(s===e.FLOAT&&(l=e.RG32F),s===e.HALF_FLOAT&&(l=e.RG16F),s===e.UNSIGNED_BYTE&&(l=e.RG8)),i===e.RGBA&&(s===e.FLOAT&&(l=e.RGBA32F),s===e.HALF_FLOAT&&(l=e.RGBA16F),s===e.UNSIGNED_BYTE&&(l=r===xe&&!1===o?e.SRGB8_ALPHA8:e.RGBA8),s===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),s===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)),l!==e.R16F&&l!==e.R32F&&l!==e.RG16F&&l!==e.RG32F&&l!==e.RGBA16F&&l!==e.RGBA32F||t.get("EXT_color_buffer_float"),l}function w(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&e.minFilter!==Z&&e.minFilter!==te?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(t){return t===Z||t===Q||t===ee?e.NEAREST:e.LINEAR}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function E(t){const n=t.target;n.removeEventListener("dispose",E),function(t){const n=t.texture,s=i.get(t),r=i.get(n);if(!t)return;void 0!==r.__webglTexture&&(e.deleteTexture(r.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(s.__webglFramebuffer[t]),s.__webglDepthbuffer&&e.deleteRenderbuffer(s.__webglDepthbuffer[t]);else e.deleteFramebuffer(s.__webglFramebuffer),s.__webglDepthbuffer&&e.deleteRenderbuffer(s.__webglDepthbuffer),s.__webglMultisampledFramebuffer&&e.deleteFramebuffer(s.__webglMultisampledFramebuffer),s.__webglColorRenderbuffer&&e.deleteRenderbuffer(s.__webglColorRenderbuffer),s.__webglDepthRenderbuffer&&e.deleteRenderbuffer(s.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,s=n.length;t0&&r.__version!==t.version){const e=t.image;if(void 0===e)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==e.complete)return void D(r,t,s);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_2D,r.__webglTexture)}function A(t,s){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,s){if(6!==i.image.length)return;N(t,i),n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const o=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=o||l?l?i.image[e].image:i.image[e]:v(i.image[e],!1,!0,c),h[e]=U(i,h[e]);const u=h[0],d=y(u)||a,p=r.convert(i.format,i.encoding),m=r.convert(i.type),f=_(i.internalFormat,p,m,i.encoding),g=a&&!0!==i.isVideoTexture,S=void 0===t.__version;let M,E=w(i,u,d);if(L(e.TEXTURE_CUBE_MAP,i,d),o){g&&S&&n.texStorage2D(e.TEXTURE_CUBE_MAP,E,f,u.width,u.height);for(let t=0;t<6;t++){M=h[t].mipmaps;for(let s=0;s0&&E++,n.texStorage2D(e.TEXTURE_CUBE_MAP,E,f,h[0].width,h[0].height));for(let t=0;t<6;t++)if(l){g?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,h[t].width,h[t].height,p,m,h[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,f,h[t].width,h[t].height,0,p,m,h[t].data);for(let i=0;i1||i.get(r).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,s.getMaxAnisotropy())),i.get(r).__currentAnisotropy=r.anisotropy)}}function N(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",M),t.__webglTexture=e.createTexture(),o.memory.textures++)}function D(t,i,s){let o=e.TEXTURE_2D;i.isDataTexture2DArray&&(o=e.TEXTURE_2D_ARRAY),i.isDataTexture3D&&(o=e.TEXTURE_3D),N(t,i),n.activeTexture(e.TEXTURE0+s),n.bindTexture(o,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const l=function(e){return!a&&(e.wrapS!==K||e.wrapT!==K||e.minFilter!==Z&&e.minFilter!==te)}(i)&&!1===y(i.image);let c=v(i.image,l,!1,h);c=U(i,c);const u=y(c)||a,d=r.convert(i.format,i.encoding);let p,m=r.convert(i.type),f=_(i.internalFormat,d,m,i.encoding,i.isVideoTexture);L(o,i,u);const g=i.mipmaps,S=a&&!0!==i.isVideoTexture,M=void 0===t.__version,E=w(i,c,u);if(i.isDepthTexture)f=e.DEPTH_COMPONENT,a?f=i.type===oe?e.DEPTH_COMPONENT32F:i.type===re?e.DEPTH_COMPONENT24:i.type===le?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:i.type===oe&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===he&&f===e.DEPTH_COMPONENT&&i.type!==se&&i.type!==re&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=se,m=r.convert(i.type)),i.format===ue&&f===e.DEPTH_COMPONENT&&(f=e.DEPTH_STENCIL,i.type!==le&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=le,m=r.convert(i.type))),S&&M?n.texStorage2D(e.TEXTURE_2D,1,f,c.width,c.height):n.texImage2D(e.TEXTURE_2D,0,f,c.width,c.height,0,d,m,null);else if(i.isDataTexture)if(g.length>0&&u){S&&M&&n.texStorage2D(e.TEXTURE_2D,E,f,g[0].width,g[0].height);for(let t=0,i=g.length;t0&&u){S&&M&&n.texStorage2D(e.TEXTURE_2D,E,f,g[0].width,g[0].height);for(let t=0,i=g.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=C,this.setTexture2DArray=function(t,s){const r=i.get(t);t.version>0&&r.__version!==t.version?D(r,t,s):(n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_2D_ARRAY,r.__webglTexture))},this.setTexture3D=function(t,s){const r=i.get(t);t.version>0&&r.__version!==t.version?D(r,t,s):(n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_3D,r.__webglTexture))},this.setTextureCube=A,this.rebindTextures=function(t,n,s){const r=i.get(t);void 0!==n&&O(r.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),void 0!==s&&k(t)},this.setupRenderTarget=function(t){const l=t.texture,c=i.get(t),h=i.get(l);t.addEventListener("dispose",E),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=l.version,o.memory.textures++);const u=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=l.isDataTexture3D||l.isDataTexture2DArray,m=y(t)||a;if(u){c.__webglFramebuffer=[];for(let t=0;t<6;t++)c.__webglFramebuffer[t]=e.createFramebuffer()}else if(c.__webglFramebuffer=e.createFramebuffer(),d)if(s.drawBuffers){const n=t.texture;for(let t=0,s=n.length;ta+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==s),null!==l&&(l.visible=null!==r),this}}class Jv extends fo{constructor(e,t,n,i,s,r,o,a,l,c){if((c=void 0!==c?c:he)!==he&&c!==ue)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===he&&(n=se),void 0===n&&c===ue&&(n=le),super(null,i,s,r,o,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:Z,this.minFilter=void 0!==a?a:Z,this.flipY=!1,this.generateMipmaps=!1}}Jv.prototype.isDepthTexture=!0;class Zv extends Qe{constructor(e,t){super();const n=this;let i=null,s=1,r=null,o="local-floor";const a=e.extensions.has("WEBGL_multisampled_render_to_texture");let l=null,c=null,h=null,u=null,d=!1,p=null;const m=t.getContextAttributes();let f=null,g=null;const v=[],y=new Map,b=new rl;b.layers.enable(1),b.viewport=new Ln;const x=new rl;x.layers.enable(2),x.viewport=new Ln;const _=[b,x],w=new Hh;w.layers.enable(1),w.layers.enable(2);let S=null,M=null;function E(e){const t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function T(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),S=null,M=null,e.setRenderTarget(f),u=null,h=null,c=null,i=null,g=null,N.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function C(e){const t=i.inputSources;for(let e=0;e0&&(t.alphaTest.value=n.alphaTest);const i=e.get(n).envMap;let s,r;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?s=n.map:n.specularMap?s=n.specularMap:n.displacementMap?s=n.displacementMap:n.normalMap?s=n.normalMap:n.bumpMap?s=n.bumpMap:n.roughnessMap?s=n.roughnessMap:n.metalnessMap?s=n.metalnessMap:n.alphaMap?s=n.alphaMap:n.emissiveMap?s=n.emissiveMap:n.clearcoatMap?s=n.clearcoatMap:n.clearcoatNormalMap?s=n.clearcoatNormalMap:n.clearcoatRoughnessMap?s=n.clearcoatRoughnessMap:n.specularIntensityMap?s=n.specularIntensityMap:n.specularColorMap?s=n.specularColorMap:n.transmissionMap?s=n.transmissionMap:n.thicknessMap?s=n.thicknessMap:n.sheenColorMap?s=n.sheenColorMap:n.sheenRoughnessMap&&(s=n.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),t.uvTransform.value.copy(s.matrix)),n.aoMap?r=n.aoMap:n.lightMap&&(r=n.lightMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uv2Transform.value.copy(r.matrix))}function n(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,s,r,o){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i),i.isMeshPhysicalMaterial?function(e,t,i){n(e,t),e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate()));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap);t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,o):n(e,i)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);let s;t.map?s=t.map:t.alphaMap&&(s=t.alphaMap);void 0!==s&&(!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uvTransform.value.copy(s.matrix))}(e,i,s,r):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);let n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function ey(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=Vn("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,s=void 0===e.depth||e.depth,r=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,a=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u=null,d=null;const p=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=be,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const f=this;let g=!1,v=0,y=0,b=null,x=-1,_=null;const w=new Ln,S=new Ln;let M=null,E=t.width,T=t.height,C=1,A=null,P=null;const R=new Ln(0,0,E,T),L=new Ln(0,0,E,T);let N=!1;const D=new Ka;let O=!1,I=!1,k=null;const z=new je,U=new Ve,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function F(){return null===b?C:1}let B,j,$,H,G,W,q,X,Y,J,Q,ee,te,se,re,le,he,ue,de,pe,me,fe,ge,ve=n;function ye(e,n){for(let i=0;i0&&function(e,t,n){if(null===k){const e=!0===o&&!0===j.isWebGL2;k=new(e?ig:vo)(1024,1024,{generateMipmaps:!0,type:null!==fe.convert(ae)?ae:ie,minFilter:ne,magFilter:Z,wrapS:K,wrapT:K,useRenderToTexture:B.has("WEBGL_multisampled_render_to_texture")})}const i=f.getRenderTarget();f.setRenderTarget(k),f.clear();const s=f.toneMapping;f.toneMapping=0,Le(e,t,n),f.toneMapping=s,W.updateMultisampleRenderTarget(k),W.updateRenderTargetMipmap(k),f.setRenderTarget(i)}(s,t,n),i&&$.viewport(w.copy(i)),s.length>0&&Le(s,t,n),r.length>0&&Le(r,t,n),a.length>0&&Le(a,t,n)}function Le(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let s=0,r=e.length;s0?m[m.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(e,t,n){G.get(e.texture).__webglTexture=t,G.get(e.depthTexture).__webglTexture=n;const i=G.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||e.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),e.useRenderToTexture=!1,e.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(e,t){const n=G.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){b=e,v=t,y=n;let i=!0;if(e){const t=G.get(e);void 0!==t.__useDefaultFramebuffer?($.bindFramebuffer(ve.FRAMEBUFFER,null),i=!1):void 0===t.__webglFramebuffer?W.setupRenderTarget(e):t.__hasExternalTextures&&W.rebindTextures(e,G.get(e.texture).__webglTexture,G.get(e.depthTexture).__webglTexture)}let s=null,r=!1,o=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const i=G.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(s=i[t],r=!0):s=e.useRenderbuffer?G.get(e).__webglMultisampledFramebuffer:i,w.copy(e.viewport),S.copy(e.scissor),M=e.scissorTest}else w.copy(R).multiplyScalar(C).floor(),S.copy(L).multiplyScalar(C).floor(),M=N;if($.bindFramebuffer(ve.FRAMEBUFFER,s)&&j.drawBuffers&&i&&$.drawBuffers(e,s),$.viewport(w),$.scissor(S),$.setScissorTest(M),r){const i=G.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=G.get(e.texture),s=t||0;ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,i.__webglTexture,n||0,s)}x=-1},this.readRenderTargetPixels=function(e,t,n,i,s,r,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=G.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){$.bindFramebuffer(ve.FRAMEBUFFER,a);try{const o=e.texture,a=o.format,l=o.type;if(a!==ce&&fe.convert(a)!==ve.getParameter(ve.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===ae&&(B.has("EXT_color_buffer_half_float")||j.isWebGL2&&B.has("EXT_color_buffer_float"));if(!(l===ie||fe.convert(l)===ve.getParameter(ve.IMPLEMENTATION_COLOR_READ_TYPE)||l===oe&&(j.isWebGL2||B.has("OES_texture_float")||B.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");ve.checkFramebufferStatus(ve.FRAMEBUFFER)===ve.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-s&&ve.readPixels(t,n,i,s,fe.convert(a),fe.convert(l),r):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const e=null!==b?G.get(b).__webglFramebuffer:null;$.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),s=Math.floor(t.image.width*i),r=Math.floor(t.image.height*i);W.setTexture2D(t,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,n,0,0,e.x,e.y,s,r),$.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const s=t.image.width,r=t.image.height,o=fe.convert(n.format),a=fe.convert(n.type);W.setTexture2D(n,0),ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,n.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,i,e.x,e.y,s,r,o,a,t.image.data):t.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ve.texSubImage2D(ve.TEXTURE_2D,i,e.x,e.y,o,a,t.image),0===i&&n.generateMipmaps&&ve.generateMipmap(ve.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,s=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const r=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=fe.convert(i.format),c=fe.convert(i.type);let h;if(i.isDataTexture3D)W.setTexture3D(i,0),h=ve.TEXTURE_3D;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");W.setTexture2DArray(i,0),h=ve.TEXTURE_2D_ARRAY}ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,i.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,i.unpackAlignment);const u=ve.getParameter(ve.UNPACK_ROW_LENGTH),d=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),p=ve.getParameter(ve.UNPACK_SKIP_PIXELS),m=ve.getParameter(ve.UNPACK_SKIP_ROWS),g=ve.getParameter(ve.UNPACK_SKIP_IMAGES),v=n.isCompressedTexture?n.mipmaps[0]:n.image;ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,v.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,e.min.x),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,e.min.y),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isDataTexture3D?ve.texSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,c,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ve.compressedTexSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,v.data)):ve.texSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,c,v),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,u),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,d),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,p),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,m),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,g),0===s&&i.generateMipmaps&&ve.generateMipmap(h),$.unbindTexture()},this.initTexture=function(e){W.setTexture2D(e,0),$.unbindTexture()},this.resetState=function(){v=0,y=0,b=null,$.reset(),ge.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ey.prototype.isWebGLRenderer=!0;var ty,ny=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};!function(e){e[e.TopLeft=0]="TopLeft",e[e.TopCenter=1]="TopCenter",e[e.TopRight=2]="TopRight",e[e.BottomLeft=3]="BottomLeft",e[e.BottomCenter=4]="BottomCenter",e[e.BottomRight=5]="BottomRight"}(ty||(ty={}));let iy=class extends Zr{constructor(){super(),this.labels=[],this.labels.push({},{},{},{},{},{})}setLabel(e,t,n,i){this.labels[e][t]={text:n,className:i},this.requestUpdate()}unsetLabel(e,t){delete this.labels[e][t],this.requestUpdate()}firstConnected(){this.classList.add("ff-container","ff-viewport-overlay")}render(){const e=this.labels;return _r`
+
${Object.keys(e[ty.TopLeft]).map((t=>{const n=e[ty.TopLeft][t];return _r`
${n.text}
`}))}
+
${Object.keys(e[ty.TopCenter]).map((t=>{const n=e[ty.TopCenter][t];return _r`
${n.text}
`}))}
+
${Object.keys(e[ty.TopRight]).map((t=>{const n=e[ty.TopRight][t];return _r`
${n.text}
`}))}
+
+
${Object.keys(e[ty.BottomLeft]).map((t=>{const n=e[ty.BottomLeft][t];return _r`
${n.text}
`}))}
+
${Object.keys(e[ty.BottomCenter]).map((t=>{const n=e[ty.BottomCenter][t];return _r`
${n.text}
`}))}
+
${Object.keys(e[ty.BottomRight]).map((t=>{const n=e[ty.BottomRight][t];return _r`
${n.text}
`}))}
+
`}};iy=ny([Qr("ff-viewport-overlay")],iy);const sy=iy;class ry extends o{constructor(e){super(),this.next=null,this._canvasWidth=1,this._canvasHeight=1,this._overlay=null,this._camera=null,this._controller=null,this.addEvent("dispose"),this.next=null,e=e||{},this._relRect={x:e.x||0,y:e.y||0,width:e.width||1,height:e.height||1},this._absRect={x:0,y:0,width:1,height:1},e.overlay&&(this._overlay=e.overlay)}get x(){return this._absRect.x}get y(){return this._absRect.y}get width(){return this._absRect.width}get height(){return this._absRect.height}get canvasWidth(){return this._canvasWidth}get canvasHeight(){return this._canvasHeight}get camera(){return this._camera}get controller(){return this._controller}get overlay(){return this._overlay}set overlay(e){this._overlay=e,this.updateGeometry()}dispose(){this.emit({type:"dispose",viewport:this}),this._overlay&&(this._overlay.remove(),this._overlay=null)}setSize(e,t,n,i){const s=this._relRect;s.x=e,s.y=t,s.width=n,s.height=i,this.updateGeometry()}setCanvasSize(e,t){this._canvasWidth=e,this._canvasHeight=t,this.updateGeometry(),this._controller&&this._controller.setViewportSize(e,t)}setBuiltInCamera(e,t){this._camera?this._camera.setProjection(e):(this._camera=new id(e),this._camera.matrixAutoUpdate=!1),void 0!==t&&(this._camera.setPreset(t),this.overlay.setLabel(ty.TopRight,"view",td[t],"ff-label-box"))}unsetBuiltInCamera(){this._camera=null,this._controller=null,this.overlay.unsetLabel(ty.TopRight,"view")}enableCameraControl(e){return!e&&this._controller?this._controller=null:e&&this._camera&&(this._controller||(this._controller=new Wu(this._camera),this._controller.setViewportSize(this.width,this.height),this._controller.updateController())),this._controller}zoomExtents(e){const t=this._camera,n=this._controller;t&&n&&(n.zoomExtents(e),n.updateCamera(null,!0))}isInside(e){return this.isPointInside(e.localX,e.localY)}isPointInside(e,t){const n=this._absRect;return t=this.canvasHeight-t,e>=n.x&&e=n.y&&te.dispose()))}get canvasWidth(){return this.canvas.width}get canvasHeight(){return this.canvas.height}attach(){const e=this.canvasWidth,t=this.canvasHeight;this.viewports.forEach((n=>n.setCanvasSize(e,t))),this.renderer.setSize(e,t,!1),this.rendererComponent=this.system.getComponent(Ae,!0),this.rendererComponent.attachView(this)}detach(){this.rendererComponent=this.system.getComponent(Ae,!0),this.rendererComponent.detachView(this),this.rendererComponent=null}renderImage(e,t,n,i){const s=this.canvas.width,r=this.canvas.height;this.setRenderSize(e,t),this.render();const o=this.canvas.toDataURL(n,i);return this.setRenderSize(s,r),o}render(){const e=this.rendererComponent.activeSceneComponent;if(!e)return;let t=e.scene,n=e.activeCamera;t&&n||(t=this.defaultScene,n=this.defaultCamera);const i=this.renderer;i.clear(),i.__view=this;const s=this.viewports;for(let e=0,r=s.length;en.setCanvasSize(e,t))),this.renderer.xr.isPresenting||this.renderer.setSize(e,t,!1)}resize(){this.setRenderSize(this.canvas.clientWidth,this.canvas.clientHeight),this.renderer.xr.isPresenting||this.render()}setViewportCount(e){const t=this.viewports;for(let n=e;n=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let uy=cy=class extends Zr{constructor(){super(),this.direction="horizontal",this.width=5,this.margin=20,this.detached=!1,this._isActive=!1,this._offset=0,this._position=0,this.addEventListener("pointerdown",(e=>this.onPointerDown(e))),this.addEventListener("pointermove",(e=>this.onPointerMove(e))),this.addEventListener("pointerup",(e=>this.onPointerUpOrCancel(e))),this.addEventListener("pointercancel",(e=>this.onPointerUpOrCancel(e)))}get position(){return this._position}isHorizontal(){return"horizontal"===this.direction}update(e){super.update(e);const t=this.isHorizontal(),n=this.width;this.setStyle({padding:t?`0 ${n}px`:`${n}px 0`,margin:t?`0 ${-n}px`:-n+"px 0",cursor:t?"col-resize":"row-resize"})}firstUpdated(){this.classList.add("ff-splitter"),this.setAttribute("touch-action","none"),this.setStyle({position:"relative",display:"block",zIndex:"1",touchAction:"none"})}onPointerDown(e){if(e.isPrimary){e.stopPropagation(),e.preventDefault(),this._isActive=!0,this.setPointerCapture(e.pointerId);const t=this.getBoundingClientRect();this._offset=this.isHorizontal()?t.left+.5*t.width-e.clientX:t.top+.5*t.height-e.clientY}}onPointerMove(e){if(e.isPrimary&&this._isActive){e.stopPropagation(),e.preventDefault();const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect(),i=this.isHorizontal(),s=i?n.width:n.height;let r=this._offset+(i?e.clientX-n.left:e.clientY-n.top),o=r/s;if(!this.detached){const e=this.previousElementSibling,n=this.nextElementSibling;if(e instanceof HTMLElement&&n instanceof HTMLElement){const a=Array.from(t.children);let l=0,c=s,h=!1;a.forEach((t=>{if(t instanceof cy)return;if(t===e||t===n)return void(h=!0);const s=t.getBoundingClientRect(),r=i?s.width:s.height;c-=r,h||(l+=r)}));const u=this.margin,d=c-u;r-=l,r=rd?d:r;const p=(c-r)/s;o=r/s,e.style.flexBasis=(100*o).toFixed(3)+"%",n.style.flexBasis=(100*p).toFixed(3)+"%",setTimeout((()=>window.dispatchEvent(new CustomEvent("resize"))),0)}}this._position=o,this.dispatchEvent(new CustomEvent(cy.changeEvent,{detail:{direction:this.direction,position:this._position,isDragging:!0}}))}}onPointerUpOrCancel(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),this._isActive=!1,this.dispatchEvent(new CustomEvent(cy.changeEvent,{detail:{direction:this.direction,position:this._position,isDragging:!1}})))}};uy.changeEvent="ff-splitter-change",hy([Or({type:String})],uy.prototype,"direction",void 0),hy([Or({type:Number})],uy.prototype,"width",void 0),hy([Or({type:Number})],uy.prototype,"margin",void 0),hy([Or({type:Boolean})],uy.prototype,"detached",void 0),uy=cy=hy([Qr("ff-splitter")],uy);var dy,py=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};!function(e){e[e.Single=0]="Single",e[e.HorizontalSplit=1]="HorizontalSplit",e[e.VerticalSplit=2]="VerticalSplit",e[e.Quad=3]="Quad"}(dy||(dy={}));let my=class extends Zr{constructor(){super(...arguments),this.layout=dy.Single,this.horizontalPosition=.5,this.verticalPosition=.5}firstConnected(){this.classList.add("ff-quad-splitter")}render(){const e=this.layout;if(e===dy.Single)return _r``;const t=[];return e!==dy.HorizontalSplit&&e!==dy.Quad||t.push(_r` +
+
+ +
+
+ `),e!==dy.VerticalSplit&&e!==dy.Quad||t.push(_r` +
+
+ +
+
+ `),_r`${t}`}onSplitterChange(e){"horizontal"===e.detail.direction?this.horizontalPosition=e.detail.position:this.verticalPosition=e.detail.position,this.onChange&&this.onChange({layout:this.layout,horizontalSplit:this.horizontalPosition,verticalSplit:this.verticalPosition,isDragging:e.detail.isDragging})}};py([Or({attribute:!1})],my.prototype,"layout",void 0),py([Or({attribute:!1})],my.prototype,"horizontalPosition",void 0),py([Or({attribute:!1})],my.prototype,"verticalPosition",void 0),my=py([Qr("ff-quad-splitter")],my);const fy=my;var gy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let vy=class extends cm{constructor(e){super(e),this.view=null,this.canvas=null,this.overlay=null,this.splitter=null,this.resizeObserver=null,this.pointerEventsEnabled=!1,this.manipTarget=new pf,this.addEventListener("pointerdown",this.manipTarget.onPointerDown),this.addEventListener("pointermove",this.manipTarget.onPointerMove),this.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.addEventListener("wheel",this.manipTarget.onWheel),this.addEventListener("contextmenu",this.manipTarget.onContextMenu),this.pointerEventsEnabled=!0}firstConnected(){this.classList.add("sv-scene-view"),this.style.touchAction="none",this.setAttribute("touch-action","none"),this.canvas=this.appendElement("canvas",{display:"block",width:"100%",height:"100%"}),this.overlay=this.appendElement("div",{position:"absolute",top:"0",bottom:"0",left:"0",right:"0",overflow:"hidden"}),this.overlay.classList.add("sv-content-overlay"),this.splitter=this.appendElement(fy,{position:"absolute",top:"0",bottom:"0",left:"0",right:"0",overflow:"hidden"}),this.splitter.onChange=e=>{this.view.horizontalSplit=e.horizontalSplit,this.view.verticalSplit=e.verticalSplit},this.view=new ly(this.system,this.canvas,this.overlay),this.view.on("layout",(e=>this.splitter.layout=e.layout)),this.view.layout=dy.Single,this.splitter.layout=dy.Single,this.manipTarget.next=this.view}connected(){this.view.attach(),this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>this.view.resize()))),this.resizeObserver.observe(this.view.renderer.domElement),this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.on("value",this.enablePointerEvents,this)}disconnected(){this.resizeObserver.disconnect(),this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.off("value",this.enablePointerEvents,this),this.view.detach()}enablePointerEvents(){const e=this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.value;e&&!this.pointerEventsEnabled?(this.addEventListener("pointerdown",this.manipTarget.onPointerDown),this.addEventListener("pointermove",this.manipTarget.onPointerMove),this.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.addEventListener("wheel",this.manipTarget.onWheel),this.addEventListener("contextmenu",this.manipTarget.onContextMenu),this.style.touchAction="none",this.setAttribute("touch-action","none"),this.pointerEventsEnabled=!0):!e&&this.pointerEventsEnabled&&(this.removeEventListener("pointerdown",this.manipTarget.onPointerDown),this.removeEventListener("pointermove",this.manipTarget.onPointerMove),this.removeEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.removeEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.removeEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.removeEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.removeEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.removeEventListener("wheel",this.manipTarget.onWheel),this.removeEventListener("contextmenu",this.manipTarget.onContextMenu),this.style.touchAction="auto",this.setAttribute("touch-action","auto"),this.pointerEventsEnabled=!1)}};vy=gy([Qr("sv-scene-view")],vy);const yy=vy;var by,xy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let _y=by=class extends Zr{constructor(){super(...arguments),this.visible=!1}firstConnected(){super.firstConnected(),this.classList.add("sv-spinner")}render(){return this.style.visibility=this.visible?"visible":"hidden",by.template}};_y.template=_r`
`,xy([Or({type:Boolean})],_y.prototype,"visible",void 0),_y=by=xy([Qr("sv-spinner")],_y);var wy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Sy=class extends hm{constructor(){super(...arguments),this.reader=null,this.language=null,this.firstRender=!0}firstConnected(){super.firstConnected(),this.classList.add("sv-reader-view")}renderMenuEntry(e,t){const n=e.article;return _r`
this.onKeyDown(e,n.id)} class="sv-entry" @click=${e=>this.onClickArticle(e,n.id)}> +

${n.title}

+

${n.lead}

+
`}render(){const e=this.reader,t=this.language;if(!e)return _r`
Please select a document to display its articles.
`;if(!e.activeArticle){const n=e.articles;return _r`
+ + ${n.map(((e,t)=>this.renderMenuEntry(e,t)))} +
`}return _r`
this.onKeyDown(t,e.activeArticle.id)} > + + +
+
`}onClickMenu(e){e.stopPropagation(),this.reader.ins.articleId.setValue(""),this.reader.ins.focus.setValue(!0)}onClickClose(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("close"))}onClickArticle(e,t){this.reader.ins.articleId.setValue(t)}updated(e){super.updated(e);const t=this.reader;if(t){if(t.activeArticle){const e=this.getElementsByClassName("sv-container").item(0);e.innerHTML=t.outs.content.value,this.firstRender&&(setTimeout((()=>{e.insertAdjacentHTML("beforeend","
-end of article-
")}),200),this.firstRender=!1)}t.ins.focus.value&&(this.setFocus(),t.ins.focus.setValue(!1,!0))}}onActiveDocument(e,t){e&&(e.setup.language.outs.language.off("value",this.onUpdate,this),this.reader.outs.content.off("value",this.onUpdate,this),this.reader.outs.article.off("value",this.onUpdate,this),this.language=null,this.reader=null),t&&(this.reader=t.setup.reader,this.language=t.setup.language,this.reader.outs.content.on("value",this.onUpdate,this),this.reader.outs.article.on("value",this.onUpdate,this),t.setup.language.outs.language.on("value",this.onUpdate,this))}onKeyDown(e,t){const n=this.reader;if("Space"!==e.code&&"Enter"!==e.code||!n||n.activeArticle){if("Escape"===e.code)e.preventDefault(),n.activeArticle?(n.ins.articleId.setValue(""),n.ins.focus.setValue(!0)):this.dispatchEvent(new CustomEvent("close"));else if("Tab"===e.code)Wm(Gm(this),e);else if(("ArrowUp"===e.code||"ArrowDown"===e.code)&&n&&!n.activeArticle){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}}else e.preventDefault(),this.reader.ins.articleId.setValue(t),this.reader.ins.focus.setValue(!0)}setFocus(){(this.reader.activeArticle?this.getElementsByClassName("sv-nav-button").item(1):this.getElementsByClassName("sv-entry").item(0)).focus()}};Sy=wy([Qr("sv-reader-view")],Sy);var My=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ey=class extends hm{get arManager(){return this.system.getMainComponent(gp)}firstConnected(){super.firstConnected()}render(){const e=this.arManager.outs;return!e.isPlaced.value&&e.isPresenting.value?_r`
+
+
+ Move the device to place your Smithsonian object!

**BETA** +
+
`:null}onActiveDocument(e,t){e&&(this.arManager.outs.isPlaced.off("value",this.onUpdate,this),this.arManager.outs.isPresenting.off("value",this.onUpdate,this)),t&&(this.arManager.outs.isPlaced.on("value",this.onUpdate,this),this.arManager.outs.isPresenting.on("value",this.onUpdate,this)),this.requestUpdate()}};Ey=My([Qr("sv-ar-prompt-container")],Ey);const Ty=Ey;var Cy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ay=class extends hm{constructor(){super(...arguments),this.documentProps=new df("value",this.onUpdate,this),this.shareButtonSelected=!1}get analytics(){return this.system.getMainComponent(Dh)}get arManager(){return this.system.getMainComponent(gp)}firstConnected(){super.firstConnected(),this.classList.add("sv-ar-menu-container")}connected(){super.connected()}disconnected(){super.disconnected()}render(){const e=this.activeDocument;if(!e)return _r``;const t=this.arManager.outs,n=e.setup,i=n.viewer.ins.annotationsVisible.value,s=n.audio.outs.narrationEnabled.value,r=n.audio.outs.narrationPlaying.value;return t.isPlaced.value&&t.isPresenting.value?_r`
+ ${_r``} + ${s?_r``:null} +
`:null}onToggleReader(){const e=this.activeDocument.setup.reader.ins;e.enabled.setValue(!e.enabled.value),this.analytics.sendProperty("Reader.Enabled",e.enabled.value)}onToggleNarration(){const e=this.activeDocument.setup.audio;e.setupAudio(),e.ins.playNarration.set()}onToggleAnnotations(){const e=this.activeDocument.setup.viewer.ins;e.annotationsVisible.setValue(!e.annotationsVisible.value),this.analytics.sendProperty("Annotations.Visible",e.annotationsVisible.value)}onActiveDocument(e,t){if(e&&(this.documentProps.off(),this.arManager.outs.isPlaced.off("value",this.onUpdate,this),this.arManager.outs.isPresenting.off("value",this.onUpdate,this)),t){const e=t.setup;this.documentProps.on(e.viewer.ins.annotationsVisible,e.audio.outs.narrationPlaying),this.arManager.outs.isPlaced.on("value",this.onUpdate,this),this.arManager.outs.isPresenting.on("value",this.onUpdate,this)}this.requestUpdate()}};Ay=Cy([Qr("sv-ar-menu")],Ay);const Py=Ay;var Ry=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ly=class extends hm{constructor(){super(...arguments),this.sceneView=null,this.documentProps=new df("value",this.onUpdate,this),this.isMobile=null}get analytics(){return this.system.getMainComponent(Dh)}get assetManager(){return this.system.getMainComponent(Ch)}get reader(){return this.activeDocument?this.activeDocument.setup.reader:null}get tours(){return this.activeDocument?this.activeDocument.setup.tours:null}get renderer(){return this.system.getMainComponent(Ae)}get arManager(){return this.system.getMainComponent(gp)}firstConnected(){this.classList.add("sv-content-view"),this.sceneView=new yy(this.system),this.isMobile=this.mobileCheck()}connected(){super.connected(),this.assetManager.outs.busy.on("value",this.onUpdate,this)}disconnected(){this.assetManager.outs.busy.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.system,t=this.assetManager.outs.busy.value,n=this.assetManager.initialLoad;let i=!1,s=ra.Overlay,r=!1;const o=this.reader,a=this.tours,l=this.arManager.shadowRoot.querySelector("ff-viewport-overlay");l&&(null===this.arManager.shadowRoot.querySelector("sv-ar-prompt-container")&&l.append(new Ty(this.system)),null===this.arManager.shadowRoot.querySelector("sv-ar-menu")&&l.append(new Py(this.system))),a&&(r=a.ins.enabled.value&&-1===a.outs.tourIndex.value),o&&(i=!r&&o.ins.enabled.value,s=o.ins.position.value,!0===this.isMobile&&(s=ra.Overlay));const c=this.sceneView;if(i&&s===ra.Overlay||r?c.classList.contains("sv-blur")||setTimeout((()=>{c.classList.add("sv-blur"),this.renderer.views[0].render()}),1):c.classList.remove("sv-blur"),!t&&n&&(this.analytics.sendProperty("Loading.Time",this.analytics.getTimerTime()/1e3),this.analytics.resetTimer(),this.assetManager.initialLoad=!1),i){if(s===ra.Right)return _r`
+
+ ${c} +
+ +
+
+ +
+
+
+ `;if(s===ra.Overlay)return _r`
${c} +
+ +
+
`}return _r`
${c}
+ `}onReaderClose(){this.reader.ins.enabled.setValue(!1),this.reader.ins.closed.set()}onActiveDocument(e,t){e&&this.documentProps.off(),t&&this.documentProps.on(t.setup.reader.ins.position,t.setup.reader.ins.enabled,t.setup.tours.outs.tourIndex),this.requestUpdate()}mobileCheck(){var e,t=!1;return e=navigator.userAgent||navigator.vendor,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t}};Ly=Ry([Qr("sv-content-view")],Ly);const Ny=Ly;var Dy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Oy=class extends Zr{constructor(){super(),this.mode="radio",this.selectionIndex=-1,this.observer=new MutationObserver(this.onObserver),this.selectedButton=null,this.addEventListener("click",(e=>this.onClick(e)))}firstConnected(){this.classList.add("ff-button-group"),this.parseChildren()}connected(){this.observer.observe(this,{childList:!0})}disconnected(){this.observer.disconnect()}onObserver(e){e.forEach((e=>{"childList"===e.type&&this.parseChildren()}))}onClick(e){let t=e.target;for(;t&&t!==this&&!(t instanceof $h);)t=t.parentElement;t instanceof $h&&(t.selected?"exclusive"===this.mode&&(t.selected=!1,this.selectedButton=null,this.selectionIndex=-1):(this.selectedButton&&(this.selectedButton.selected=!1),this.selectedButton=t,this.selectedButton.selected=!0,this.selectionIndex=this.getButtons().indexOf(t)))}parseChildren(){const e=this.getButtons();this.selectedButton&&(this.selectionIndex=e.indexOf(this.selectedButton),this.selectionIndex<0&&(this.selectedButton.selected=!1,this.selectedButton=null)),(this.selectionIndex<0||this.selectionIndex>=e.length)&&(this.selectionIndex="radio"===this.mode?0:-1),this.selectionIndex>=0&&(this.selectedButton=e[this.selectionIndex],this.selectedButton.selected=!0)}getButtons(){return this.getChildrenArray().filter((e=>e instanceof $h))}};Dy([Or({type:String})],Oy.prototype,"mode",void 0),Dy([Or({type:Number})],Oy.prototype,"selectionIndex",void 0),Oy=Dy([Qr("ff-button-group")],Oy);var Iy,ky=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let zy=Iy=class extends Zr{firstConnected(){super.firstConnected(),this.classList.add("sv-logo")}render(){return _r`
${Iy.sunburst}
${Iy.sunburst}${Iy.smithsonian}
`}};zy.sunburst=_r`
si-sunburst
`,zy.smithsonian=_r`
si-text-neg
`,zy=Iy=ky([Qr("sv-logo")],zy);var Uy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Vy=class extends Zr{constructor(){super(),this.anchor=null,this.portal=null,this.position=void 0,this.align=void 0,this.justify=void 0,this.positionX=0,this.positionY=0,this.offsetX=0,this.offsetY=0,this.keepVisible=!1,this.modal=!1,this._modalPlane=null,this.onResize=this.onResize.bind(this),this.onCaptureEvent=this.onCaptureEvent.bind(this),this.onEatEvent=this.onEatEvent.bind(this)}close(){this.dispatchEvent(new CustomEvent("close"))}connected(){if(this.calculatePosition(),window.addEventListener("resize",this.onResize),this.modal){const e=this._modalPlane=this.createElement("div");e.classList.add("ff-modal-plane"),e.addEventListener("mousedown",this.onEatEvent),e.addEventListener("contextmenu",this.onEatEvent),e.addEventListener("pointerdown",this.onEatEvent),this.parentElement.appendChild(e),setTimeout((()=>e.classList.add("ff-transition")))}else document.addEventListener("mousedown",this.onCaptureEvent,{capture:!0,passive:!0})}disconnected(){window.removeEventListener("resize",this.onResize),this._modalPlane?(this._modalPlane.remove(),this._modalPlane=null):document.removeEventListener("mousedown",this.onCaptureEvent)}firstConnected(){super.firstConnected(),this.setStyle({position:"fixed",zIndex:"1000"}),this.classList.add("ff-popup")}updated(){this.isConnected&&this.calculatePosition()}calculatePosition(){let e,t;const n=this.getBoundingClientRect();let i;if(t=this.portal?this.portal.getBoundingClientRect():{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight,width:window.innerWidth,height:window.innerHeight},"center"===this.position)i=this.center(n,t);else if("anchor"===this.position){const s=this.anchor||this.parentElement;s&&(e=s.getBoundingClientRect(),i=this.positionToAnchor(n,e,t))}else i={x:this.positionX,y:this.positionY};this.keepVisible&&"center"!==this.position&&(i=this.keepElementVisible(i,n,t)),this.style.left=Math.round(i.x)+"px",this.style.top=Math.round(i.y)+"px"}center(e,t){return{x:Math.round(.5*(t.width-e.width)),y:Math.round(.5*(t.height-e.height))}}positionToAnchor(e,t,n){const i=this.align,s=this.justify,r=this.offsetX,o=this.offsetY,a={x:0,y:0};switch(i){case"start":a.x="start"!==s&&"end"!==s?t.left-e.width-r:t.left;break;case"end":a.x="start"!==s&&"end"!==s?t.right+r:t.right-e.width;break;case"fixed":a.x=this.positionX;break;default:a.x=t.left+.5*(t.width-e.width)}switch(s){case"start":a.y=t.top-e.height-o;break;case"end":a.y=t.bottom+o;break;case"fixed":a.y=this.positionY;break;default:a.y=t.top+.5*(t.height-e.height)}return a.x+=this.offsetX,a.y+=this.offsetY,a}keepElementVisible(e,t,n){const i=this.offsetX,s=this.offsetY;return t.width>n.width?e.x=.5*(n.width-t.width):e.xn.right&&(e.x=n.right-t.width-i),t.height>n.height?e.y=.5*(n.height-t.height):e.yn.bottom&&(e.y=n.bottom-t.height-s),e}onResize(){this.calculatePosition()}onCaptureEvent(e){e.target instanceof Node&&this.contains(e.target)||this.close()}onEatEvent(e){console.log("Popup.onEatEvent"),e.stopPropagation(),e.preventDefault()}};Uy([Or({attribute:!1})],Vy.prototype,"anchor",void 0),Uy([Or({attribute:!1})],Vy.prototype,"portal",void 0),Uy([Or({type:String})],Vy.prototype,"position",void 0),Uy([Or({type:String})],Vy.prototype,"align",void 0),Uy([Or({type:String})],Vy.prototype,"justify",void 0),Uy([Or({type:Number})],Vy.prototype,"positionX",void 0),Uy([Or({type:Number})],Vy.prototype,"positionY",void 0),Uy([Or({type:Number})],Vy.prototype,"offsetX",void 0),Uy([Or({type:Number})],Vy.prototype,"offsetY",void 0),Uy([Or({type:Boolean})],Vy.prototype,"keepVisible",void 0),Uy([Or({type:Boolean})],Vy.prototype,"modal",void 0),Vy=Uy([Qr("ff-popup")],Vy);const Fy=Vy;var By=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let jy=class extends Zr{constructor(){super(...arguments),this.name="",this.index=0,this.text="",this.placeholder="",this.readonly=!1,this.align="left",this.initialValue=""}get textArea(){return this.getElementsByTagName("textarea").item(0)}select(){const e=this.textArea;e&&e.select()}focus(){const e=this.textArea;e&&e.focus()}blur(){const e=this.textArea;e&&e.blur()}hasFocus(){const e=document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement;return this.textArea===e}firstConnected(){this.classList.add("ff-control","ff-text-edit")}shouldUpdate(e){return!this.hasFocus()&&super.shouldUpdate(e)}render(){var e;return _r``}onKeyDown(e){const t=e.target;"Escape"===e.key&&(this.revert(t),t.blur())}onChange(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!1)}onInput(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!0)}onFocus(e){this.initialValue=e.target.value}onBlur(e){this.commit(e.target),this.requestUpdate()}revert(e){e.value=this.initialValue,this.dispatchChangeEvent(e.value,!1)}commit(e){this.initialValue=e.value,this.dispatchChangeEvent(e.value,!1)}dispatchChangeEvent(e,t){this.dispatchEvent(new CustomEvent("change",{detail:{text:e,isEditing:t}}))}};By([Or({type:String})],jy.prototype,"name",void 0),By([Or({type:Number})],jy.prototype,"index",void 0),By([Or({type:String})],jy.prototype,"text",void 0),By([Or({type:String})],jy.prototype,"placeholder",void 0),By([Or({type:Boolean})],jy.prototype,"readonly",void 0),By([Or({type:String})],jy.prototype,"align",void 0),jy=By([Qr("ff-text-edit")],jy);var $y,Hy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Gy=$y=class extends Fy{constructor(e){super(),this.language=null,this.needsFocus=!1,this.language=e,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t){const n=new $y(t);return e.appendChild(n),new Promise(((e,t)=>{n.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-share-menu"),this.needsFocus=!0}render(){const e=encodeURIComponent(this.url),t=encodeURI("Smithsonian Voyager"),n=this.language,i=`http://twitter.com/share?text=${t}&url=${e}`,s=`https://www.facebook.com/sharer/sharer.php?u=${e}`,r=`https://www.linkedin.com/shareArticle?url=${e}&mini=true&title=${t}`,o=``,a=`mailto:?subject=${t}&body=${e}`,l=n.getLocalizedString("Share Experience");return _r` +
this.onKeyDown(e)}> +
+
${l}
+ +
+
+ + + + +
+
${n.getLocalizedString("Embed Link")}
+ +
+ `}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-share-button-twitter").item(0).focus(),this.needsFocus=!1}}onClickCopy(){this.getElementsByTagName("ff-text-edit").item(0).select(),document.execCommand("copy")}onKeyDown(e){"Escape"===e.code?(e.preventDefault(),this.close()):"Tab"===e.code&&Wm(Gm(this),e)}};Gy=$y=Hy([Qr("sv-share-menu")],Gy);const Wy=Gy;var qy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Xy=class extends hm{constructor(){super(...arguments),this.documentProps=new df("value",this.onUpdate,this),this.shareButtonSelected=!1,this.resizeObserver=null,this.isClipped=!1}get fullscreen(){return this.system.getMainComponent($)}get toolProvider(){return this.system.getMainComponent(fm)}get analytics(){return this.system.getMainComponent(Dh)}get arManager(){return this.system.getMainComponent(gp)}get sceneNode(){return this.system.getComponent(op)}firstConnected(){super.firstConnected(),this.classList.add("sv-main-menu")}connected(){super.connected(),this.fullscreen.outs.fullscreenActive.on("value",this.onUpdate,this),this.toolProvider.ins.visible.on("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.on("value",this.onUpdate,this),this.activeDocument.setup.tours.ins.closed.on("value",this.setTourFocus,this),this.activeDocument.setup.reader.ins.closed.on("value",this.setReaderFocus,this),this.toolProvider.ins.closed.on("value",this.setToolsFocus,this),this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>this.onResize()))),this.resizeObserver.observe(this)}disconnected(){this.resizeObserver.disconnect(),this.toolProvider.ins.closed.off("value",this.setToolsFocus,this),this.activeDocument.setup.reader.ins.closed.off("value",this.setReaderFocus,this),this.activeDocument.setup.tours.ins.closed.off("value",this.setTourFocus,this),this.activeDocument.setup.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.ins.visible.off("value",this.onUpdate,this),this.fullscreen.outs.fullscreenActive.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.activeDocument;if(!e)return _r``;const t=!!this.system.getComponent("CVStoryApplication",!0),n=e.setup,i=this.sceneNode,s=n.tours.outs.count.value>0,r=n.tours.ins.enabled.value,o=r&&!t,a=n.reader.articles.length>0,l=n.reader.ins.enabled.value,c=i.getGraphComponents(Tu).some((e=>e.hasAnnotations)),h=n.viewer.ins.annotationsVisible.value,u=this.fullscreen,d=u.outs.fullscreenAvailable.value,p=u.outs.fullscreenActive.value,m=n.interface.ins.tools.value,f=this.toolProvider.ins.visible.value,g=n.audio.outs.narrationEnabled.value,v=n.audio.outs.narrationPlaying.value,y=n.language,b=i.getGraphComponents(Zd),x=b[0]?b[0].derivatives.getByQuality(Wo.AR):[],_=this.arManager.outs.available.value&&x.length>0&&b.length>=1;return _r` + ${_?_r``:null} + ${g?_r``:null} + ${s?_r``:null} + ${a?_r``:null} + ${c?_r``:null} + + ${d?_r``:null} + ${m?_r``:null}`}onToggleReader(){const e=this.activeDocument.setup.reader.ins;e.enabled.setValue(!e.enabled.value),e.focus.setValue(e.enabled.value),this.analytics.sendProperty("Reader.Enabled",e.enabled.value)}onToggleTours(){const e=this.activeDocument.setup.tours.ins,t=this.activeDocument.setup.reader.ins;e.enabled.value?e.enabled.setValue(!1):(t.enabled.value&&t.enabled.setValue(!1),e.enabled.setValue(!0),e.tourIndex.setValue(-1)),this.analytics.sendProperty("Tours.Enabled",e.enabled.value)}onToggleAnnotations(){const e=this.toolProvider.ins,t=this.activeDocument.setup.viewer.ins;e.visible.value&&e.visible.setValue(!1),t.annotationsVisible.setValue(!t.annotationsVisible.value),this.analytics.sendProperty("Annotations.Visible",t.annotationsVisible.value)}onToggleShare(){this.shareButtonSelected||(this.shareButtonSelected=!0,this.requestUpdate(),Wy.show(this,this.activeDocument.setup.language).then((()=>{this.shareButtonSelected=!1,this.requestUpdate(),this.setElementFocus("share-btn")})),this.analytics.sendProperty("Menu.Share"))}onToggleFullscreen(){this.fullscreen.toggle(),this.analytics.sendProperty("Menu.Fullscreen")}onToggleTools(){const e=this.toolProvider.ins,t=this.activeDocument.setup.viewer.ins;t.annotationsVisible.value&&t.annotationsVisible.setValue(!1),e.visible.setValue(!e.visible.value),this.analytics.sendProperty("Tools.Visible",e.visible.value)}onEnterAR(){this.arManager.ins.enabled.setValue(!0)}onToggleNarration(){const e=this.activeDocument.setup.audio;e.setupAudio(),e.ins.playNarration.set()}setTourFocus(){this.setElementFocus("tour-btn")}setReaderFocus(){this.setElementFocus("reader-btn")}setToolsFocus(){this.setElementFocus("tools-btn")}setElementFocus(e){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).find((t=>t.id===e));void 0!==n?n.focus():console.warn("Can't focus. Element ["+e+"] not found.")}onActiveDocument(e,t){if(e&&this.documentProps.off(),t){const e=t.setup;this.documentProps.on(e.interface.ins.tools,e.reader.ins.enabled,e.reader.outs.count,e.tours.ins.enabled,e.tours.outs.count,e.viewer.ins.annotationsVisible,e.audio.outs.narrationPlaying,this.toolProvider.ins.visible)}this.requestUpdate()}onResize(){const e=this.scrollHeight>this.clientHeight;this.isClipped!==e&&(e&&this.scrollTo({top:this.scrollTop+this.scrollHeight,behavior:"smooth"}),this.isClipped=e)}};Xy=qy([Qr("sv-main-menu")],Xy);var Yy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ky=class extends cm{constructor(){super(...arguments),this.needsFocus=!1}get toolProvider(){return this.system.getMainComponent(fm)}get language(){return this.system.getComponent(Lh)}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tool-bar"),this.needsFocus=!0}connected(){super.connected(),this.toolProvider.on("active-component",this.onUpdate,this),this.language.outs.language.on("value",this.onUpdate,this)}disconnected(){this.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.off("active-component",this.onUpdate,this),super.disconnected()}render(){const e=this.toolProvider.scopedComponents,t=this.toolProvider.activeComponent,n=this.language,i=(t&&_r`
`,e.map((e=>_r`this.onSelectTool(e)}>`)));return _r`
this.onKeyDownTool(e)}>${t?t.createView():null}
+
`}onSelectTool(e){this.toolProvider.activeComponent=e}onClose(e){this.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-tool-button").item(0).focus(),this.needsFocus=!1}}onKeyDownMain(e){if("Escape"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("close"));else if("Tab"===e.code){const t=Array.from(this.getElementsByTagName("div")).find((e=>"mainmenu"===e.id));Wm(Gm(t),e)}}onKeyDownTool(e){if("Escape"===e.code)e.preventDefault(),this.closeTool();else if("Tab"===e.code){const t=Array.from(this.getElementsByTagName("div")).find((e=>"toolmenu"===e.id));Wm(Gm(t),e)}}closeTool(){const e=this.getElementsByTagName("ff-button");Array.from(e).find((e=>e.getAttribute("text")===this.language.getLocalizedString(this.toolProvider.activeComponent.text))).focus(),this.toolProvider.activeComponent=null}};Ky=Yy([Qr("sv-tool-bar")],Ky);var Jy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Zy=class extends hm{constructor(){super(...arguments),this.needsFocus=!1,this.firstRender=!0,this.stepTitle=""}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tour-navigator","sv-transition"),setTimeout((()=>this.classList.remove("sv-transition")),1),this.needsFocus=!0}render(){const e=this.tours,t=this.language,n=e.activeTour;let i,s;if(e&&n){const n=e.outs.stepIndex.value+1,r=e.outs.stepCount.value;i=r>0?e.stepTitle:e.title,s=r>0?`${t.getLocalizedString("Step")} ${n} ${t.getLocalizedString("of")} ${r}`:t.getLocalizedString("No tour steps defined")}else i=t.getLocalizedString("No tour selected"),s="---";return this.stepTitle=i,_r`
this.onKeyDown(e)}>
+ +
+
${i}
+
${s}
+
+ + + +
`}updated(e){if(super.updated(e),this.needsFocus){this.getElementsByClassName("sv-section-trail").item(2).focus(),this.needsFocus=!1}const t=this.getElementsByClassName("sv-title").item(0);t&&(t.innerHTML=this.stepTitle,this.firstRender&&(setTimeout((()=>{t.innerHTML=`
${this.stepTitle}
`}),100),this.firstRender=!1))}onClickExit(){this.tours.ins.enabled.setValue(!1),this.tours.ins.closed.set()}onClickMenu(){this.tours.ins.tourIndex.setValue(-1)}onClickPrevious(){this.tours.ins.previous.set()}onClickNext(){this.tours.ins.next.set()}onActiveDocument(e,t){e&&(this.tours.outs.tourIndex.off("value",this.onUpdate,this),this.tours.outs.stepIndex.off("value",this.onUpdate,this),this.language.outs.language.off("value",this.onUpdate,this)),t&&(this.tours=t.setup.tours,this.language=t.setup.language,this.tours.outs.tourIndex.on("value",this.onUpdate,this),this.tours.outs.stepIndex.on("value",this.onUpdate,this),this.language.outs.language.on("value",this.onUpdate,this)),this.requestUpdate()}onKeyDown(e){"Escape"===e.code?(e.preventDefault(),this.tours.ins.tourIndex.setValue(-1)):"Tab"===e.code&&Wm(Gm(this),e)}};Zy=Jy([Qr("sv-tour-navigator")],Zy);var Qy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let eb=class extends Zr{constructor(){super(...arguments),this.needsFocus=!1,this.focusableElements=[]}firstConnected(){super.firstConnected(),this.classList.add("sv-document-overlay","sv-article","sv-tour-menu"),this.needsFocus=!0}renderEntry(e,t){return _r`
this.onKeyDown(e,t)} class="sv-entry" @click=${e=>this.onClickTour(e,t)}> +

${Object.keys(e.titles).length>0?e.titles[vs[this.activeLanguage]]:e.title}

+

${Object.keys(e.leads).length>0?e.leads[vs[this.activeLanguage]]:e.lead}

+
`}render(){const e=this.tours;return 0===e.length?_r`
+

No tours available.

+
`:_r`
+ ${e.map(((e,t)=>this.renderEntry(e,t)))} +
`}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-entry").item(0).focus(),this.needsFocus=!1}}onClickTour(e,t){e.stopPropagation(),this.dispatchEvent(new CustomEvent("select",{detail:{index:t}}))}onKeyDown(e,t){if("Space"===e.code||"Enter"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("select",{detail:{index:t}}));else if("Escape"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{index:t}}));else if("Tab"===e.code)0===this.focusableElements.length&&(this.focusableElements=Gm(this)),Wm(this.focusableElements,e);else if("ArrowUp"===e.code||"ArrowDown"===e.code){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}}};Qy([Or({attribute:!1})],eb.prototype,"tours",void 0),Qy([Or({attribute:!1})],eb.prototype,"activeLanguage",void 0),eb=Qy([Qr("sv-tour-menu")],eb);var tb,nb=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let ib=tb=class extends Fy{constructor(e){super(),this.language=null,this.language=e,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t){const n=new tb(t);return e.appendChild(n),new Promise(((e,t)=>{n.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-language-menu","sv-option-menu")}renderEntry(e,t){const n=e.name===this.language.toString();return _r`
this.onClickLanguage(e,t)} @keydown=${e=>this.onKeyDownEntry(e,t)} ?selected=${n}> + ${e.name} +
`}render(){const e=this.language;return _r` +
this.onKeyDownMain(e)}> +
+
${e.getLocalizedString("Set Language")}
+ +
+
+
+ ${e.activeLanguages.map(((e,t)=>this.renderEntry(e,t)))} +
+
+
+ `}firstUpdated(e){super.firstUpdated(e),Array.from(this.getElementsByClassName("sv-entry")).find((e=>"0"===e.getAttribute("tabIndex"))).focus()}onClickLanguage(e,t){const n=this.language;e.stopPropagation(),n.ins.language.setValue(n.activeLanguages[t].id),this.close()}onKeyDownEntry(e,t){const n=this.language;if("Space"===e.code||"Enter"===e.code)e.preventDefault(),e.stopPropagation(),n.ins.language.setValue(n.activeLanguages[t].id),this.close();else if("ArrowUp"===e.code||"ArrowDown"===e.code){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}else"Tab"===e.code&&this.addEventListener("blur",this.tabReset,{once:!0,capture:!0})}onKeyDownMain(e){"Escape"===e.code?this.close():"Tab"===e.code&&Wm(Gm(this),e)}tabReset(e){const t=e.target instanceof Element?e.target:null;if(t){const e=Array.from(t.parentElement.children).find((e=>e.hasAttribute("selected")));e!==t&&(t.setAttribute("tabIndex","-1"),e.setAttribute("tabIndex","0"))}}};ib=tb=nb([Qr("sv-language-menu")],ib);const sb=ib;var rb=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let ob=class extends hm{get activeTags(){return this.viewer?this.viewer.ins.activeTags.value.split(",").map((e=>e.trim())).filter((e=>!!e)):[]}get tagCloud(){return this.viewer?this.viewer.outs.tagCloud.value.split(",").map((e=>e.trim())).filter((e=>!!e)):[]}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tag-cloud","sv-transition"),setTimeout((()=>this.classList.remove("sv-transition")),1)}render(){const e=this.activeTags,t=this.tagCloud.map((t=>_r`=0} + @click=${e=>this.onSelectTag(t)}>`));return _r`
+ +
${t}
+
`}onClickClose(){this.viewer.ins.annotationsVisible.setValue(!1)}onSelectTag(e){let t=this.activeTags;const n=this.viewer.ins.radioTags.value,i=t.indexOf(e);i>=0&&!n?t.splice(i,1):i<0&&(n?t=[e]:t.push(e)),this.viewer.ins.activeTags.setValue(t.join(", "))}onActiveDocument(e,t){e&&(this.viewer.ins.activeTags.off("value",this.onUpdate,this),this.viewer.outs.tagCloud.off("value",this.onUpdate,this)),t&&(this.viewer=t.setup.viewer,this.viewer.ins.activeTags.on("value",this.onUpdate,this),this.viewer.outs.tagCloud.on("value",this.onUpdate,this))}};ob=rb([Qr("sv-tag-cloud")],ob);var ab=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let lb=class extends hm{constructor(){super(...arguments),this.documentProps=new df("value",this.onUpdate,this)}get toolProvider(){return this.system.getMainComponent(fm)}firstConnected(){this.style.pointerEvents="none",this.setAttribute("pointer-events","none"),this.classList.add("sv-chrome-view")}connected(){super.connected(),this.toolProvider.ins.visible.on("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.on("value",this.onUpdate,this),this.titleElement=this.createElement("div",null),this.titleElement.classList.add("ff-ellipsis")}disconnected(){this.activeDocument.setup.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.ins.visible.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.activeDocument,t=this.titleElement;if(!e)return _r``;const n=e.setup,i=n.interface.ins.visible.value,s=n.interface.ins.logo.value&&n.interface.isShowing(Pu.logo),r=n.interface.ins.menu.value&&n.interface.isShowing(Pu.menu),o=n.interface.ins.visibleElements.value&&n.interface.isShowing(Pu.title),a=n.reader.ins.enabled.value,l=n.tours.tours,c=n.tours.ins.enabled.value,h=n.tours.outs.tourIndex.value>=0,u=n.language,d=u.activeLanguages,p=u.outs.language.value,m=d.length>1&&n.interface.isShowing(Pu.language),f=!!this.system.getComponent("CVStoryApplication",!0)||!c,g=n.viewer.ins.annotationsVisible.value&&n.viewer.outs.tagCloud.value,v=!a&&this.toolProvider.ins.visible.value,y=this.activeDocument.setup.tours.outs.ending.value;if(this.activeDocument.setup.tours.outs.ending.setValue(!1),!i)return _r``;let b;return b=c?h?u.getLocalizedString("Tour")+": "+n.tours.outs.tourTitle.value:u.getLocalizedString("Interactive Tours"):e.outs.title.value||"Missing Title",t.innerHTML=b,_r`${y?_r``:null} +
+
+ ${r?_r``:null} +
+
+ ${o?_r`
${t}
`:null} + ${s?_r``:null} +
+
+
+ ${c&&h?_r``:null} + ${c&&!h?_r``:null} + ${g&&f?_r``:null} + ${v&&f?_r`
`:null} + `}onSelectTour(e){this.activeDocument.setup.tours.ins.tourIndex.setValue(e.detail.index)}closeTours(){const e=this.activeDocument.setup.tours;e.ins.enabled.setValue(!1),e.ins.closed.set()}openLanguageMenu(){const e=this.activeDocument.setup.language;e.ins.enabled.value||(e.ins.enabled.setValue(!0),sb.show(this,this.activeDocument.setup.language).then((()=>{e.ins.enabled.setValue(!1),this.getElementsByClassName("sv-language-display")[0].focus()})))}closeTools(){const e=this.toolProvider.ins;e.visible.setValue(!1),e.closed.set()}onActiveDocument(e,t){if(e&&this.documentProps.off(),t){const e=t.setup;this.documentProps.on(t.outs.title,t.outs.assetPath,e.interface.ins.visible,e.interface.ins.logo,e.interface.ins.menu,e.viewer.ins.annotationsVisible,e.reader.ins.enabled,e.tours.ins.enabled,e.tours.outs.tourIndex)}this.requestUpdate()}};lb=ab([Qr("sv-chrome-view")],lb);const cb=lb;var hb=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};io.add("globe",_r``),io.add("cog",_r``),io.add("eye",_r``),io.add("palette",_r``),io.add("comment",_r``),io.add("article",_r``),io.add("document",_r``),io.add("share",_r``),io.add("expand",_r``),io.add("zoom",_r``),io.add("tools",_r``),io.add("environment",_r``),io.add("bulb",_r``),io.add("tape",_r``),io.add("knife",_r``),io.add("bars",_r``),io.add("triangle-left",_r``),io.add("triangle-right",_r``),io.add("twitter",_r``),io.add("facebook",_r``),io.add("instagram",_r``),io.add("linkedin",_r``),io.add("email",_r``),io.add("copy",_r``),io.add("ar",_r``),io.add("device-move",_r``),io.add("audio",_r``);let ub=class extends Zr{constructor(e){super(),this.application=null,e&&(this.application=e),this.addEventListener("focus",this.onFocus)}static get observedAttributes(){return["root"]}get fullscreen(){return this.application.system.getMainComponent($)}get arManager(){return this.application.system.getMainComponent(gp)}get viewer(){return this.application.system.getComponent(Lu)}firstConnected(){if(super.firstConnected(),!this.application){const e={root:this.getAttribute("root"),dracoRoot:this.getAttribute("dracoRoot"),resourceRoot:this.getAttribute("resourceRoot"),document:this.getAttribute("document"),model:this.getAttribute("model"),geometry:this.getAttribute("geometry"),texture:this.getAttribute("texture"),quality:this.getAttribute("quality"),uiMode:this.getAttribute("uiMode"),bgColor:this.getAttribute("bgColor"),bgStyle:this.getAttribute("bgStyle"),controls:this.getAttribute("controls"),lang:this.getAttribute("lang")};this.application=new uf(null,e)}this.attachShadow({mode:"open"});const e=this.shadowRoot;this.arManager.shadowRoot=e;var t=document.createElement("style");t.innerText='/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:normal;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.ff-fullsize{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.ff-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden}.ff-fullsize{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.ff-caret-down{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(180deg);transition:transform 0.05s}.ff-caret-up{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(0deg);transition:transform 0.05s}.ff-caret-right{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(90deg);transition:transform 0.05s}.ff-caret-left{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(270deg);transition:transform 0.05s}html{color:#c8c8c8}button,input{display:block;padding:0;margin:0;border:none;background-color:inherit;color:inherit;font-size:inherit;cursor:inherit}*:focus{outline:1px solid #0089bf;outline-offset:0}*:focus:not(:focus-visible){outline:0}*:focus-visible{outline:1px solid #0089bf;outline-offset:0}.ff-fullscreen{position:fixed;left:0;right:0;top:0;bottom:0}.ff-noselect{user-select:none;-moz-user-select:none;-webkit-user-select:none}.ff-off{user-select:none;-moz-user-select:none;-webkit-user-select:none;pointer-events:none}.ff-on{user-select:auto;-webkit-user-select:none;pointer-events:auto}.ff-focusable{tab-index:0}.ff-flex-row{display:flex}.ff-flex-column{display:flex;flex-direction:column}.ff-flex-wrap{flex-wrap:wrap}.ff-flex-centered{align-items:center}.ff-flex-item-fixed{flex:0 0 auto;position:relative}.ff-flex-item-stretch,.ff-flex-spacer{flex:1 1 auto;position:relative}.ff-scroll-y{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow-y:auto}.ff-position-above{position:absolute;bottom:0}.ff-position-below{position:absolute;top:100%}.ff-position-left{position:absolute;right:0}.ff-position-right{position:absolute;left:100%}.ff-position-above.ff-align-left,.ff-position-below.ff-align-left{left:0}.ff-position-above.ff-align-right,.ff-position-below.ff-align-right{right:0}.ff-position-left.ff-align-top,.ff-position-right.ff-align-top{top:0}.ff-position-left.ff-align-bottom,.ff-position-right.ff-align-bottom{bottom:0}.ff-ellipsis{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ff-placeholder{flex:1 1 auto;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.ff-splitter-section{flex:1 1 auto;position:relative;box-sizing:border-box;overflow:hidden}.ff-splitter[direction="vertical"]+.ff-splitter-section{border-top:2px solid #1b1b1b}.ff-splitter:not([direction="vertical"])+.ff-splitter-section{border-left:2px solid #1b1b1b}.ff-frame{padding:4px}.ff-frame .ff-control{margin:4px}.ff-icon{display:inline-block;position:relative;height:1rem;fill:#a0a0a0}.ff-icon svg{width:inherit;height:inherit}.ff-button{cursor:pointer}.ff-button[vertical]{flex-direction:column}.ff-button.ff-inline .ff-icon+.ff-text{padding-left:0.5em}.ff-button.ff-inline .ff-icon{display:inline}.ff-button.ff-inline .ff-text{display:inline}.ff-button.ff-transparent{position:relative;display:flex;justify-content:center;align-items:center;flex:0 1 auto;flex-wrap:wrap;padding:5px;background:transparent;fill:#a0a0a0;transition:fill 0.2s}.ff-button.ff-transparent:hover,.ff-button.ff-transparent:focus{fill:#c8c8c8}.ff-button.ff-transparent[selected]{fill:#c8c8c8}.ff-button.ff-transparent>.ff-text{margin:3px;white-space:nowrap}.ff-button.ff-transparent>.ff-icon{margin:3px;height:1.3em}.ff-button.ff-transparent>.ff-caret-down{margin:3px}.ff-button.ff-transparent.ff-disabled{color:gray;fill:#606060;user-select:none;pointer-events:none}.ff-button.ff-control{position:relative;display:flex;justify-content:center;align-items:center;flex:1 1 auto;flex-wrap:wrap;padding:5px;background:#4e4e4e;transition:background-color 0.2s}.ff-button.ff-control:hover,.ff-button.ff-control:focus{background-color:#676767}.ff-button.ff-control[selected]{background-color:#0089bf}.ff-button.ff-control[selected]:hover,.ff-button.ff-control[selected]:focus{background-color:#00a6e8}.ff-button.ff-control>.ff-text{margin:3px;white-space:nowrap}.ff-button.ff-control>.ff-icon{margin:3px;height:1.3em}.ff-button.ff-control>.ff-caret-down{margin:3px}.ff-button.ff-control.ff-disabled{color:gray;fill:#606060;user-select:none;pointer-events:none}.ff-button.ff-control.ff-disabled>.ff-icon{fill:#606060}.ff-menu{background-color:#4e4e4e;z-index:100;display:flex;flex-direction:column}.ff-menu .ff-divider{height:1px;padding:0;background:#a0a0a0}.ff-menu .ff-button{justify-content:flex-start;margin:0;padding:4px 4px}.ff-menu .ff-button .ff-icon{height:1.2em;width:2.2em;margin-right:4px}.ff-dropdown .ff-menu{min-width:100%;margin-top:3px}.ff-modal-plane{position:fixed;left:0;right:0;top:0;bottom:0;background-color:rgba(0,0,0,0.6);opacity:0;transition:opacity .3s;z-index:990;pointer-events:auto}.ff-modal-plane.ff-transition{opacity:1}ff-dialog{box-sizing:border-box;background:#343434;border:1px solid #4e4e4e;box-shadow:3px 3px 24px rgba(0,0,0,0.4)}ff-title-bar{background:#1b1b1b;padding:2px}ff-title-bar .ff-text{flex:1 1 auto;padding-right:8px}ff-title-bar .ff-icon{padding:2px}ff-popup-button .ff-content{transition:opacity .15s}.ff-line-edit{display:block;overflow:hidden;background-color:#1b1b1b;min-height:1.2em}.ff-line-edit input{padding:2px}.ff-text-edit{box-sizing:border-box;flex:1 1 auto;display:flex;background-color:#1b1b1b}.ff-text-edit textarea{display:block;box-sizing:border-box;width:100%;padding:2px;resize:none;background:transparent;color:inherit;border:none}.ff-color-edit{font-size:0.8rem}.ff-color-edit .ff-control{margin:0}.ff-color-edit .ff-slider-controls{align-items:stretch;flex:1 1 auto}.ff-color-edit .ff-numeric-controls{flex:0 0 auto;align-items:center;margin-top:6px}.ff-color-edit .ff-text{color:#a0a0a0;margin:0 3px}.ff-color-edit .ff-line-edit{flex:4 5 auto}.ff-color-edit .ff-line-edit.ff-wide{flex:5 4 auto}.ff-color-edit .ff-knob{margin:-2px 0 0 -2px;border:2px solid white;box-shadow:0 0 5px rgba(0,0,0,0.5)}.ff-color-edit .ff-vector-slider{flex:1 0 auto;padding:0 10px 10px 0;background-image:linear-gradient(to bottom, transparent, black),linear-gradient(to right, white, red)}.ff-color-edit .ff-vector-slider .ff-knob{width:10px;height:10px}.ff-color-edit .ff-linear-slider{flex:0 0 24px;margin-left:6px;padding-bottom:10px}.ff-color-edit .ff-linear-slider .ff-knob{width:100%;height:10px}.ff-color-edit .ff-hue-slider{background:linear-gradient(to bottom, red, #ff0, lime, cyan, blue, #f0f, red)}.ff-color-edit .ff-alpha-slider{color:#4e4e4e}.ff-quad-splitter .ff-left{box-sizing:border-box;border-right:1px solid #343434}.ff-quad-splitter .ff-top{box-sizing:border-box;border-bottom:1px solid #343434}#ff-notification-stack{position:fixed;z-index:100;bottom:0;right:0;width:30%;min-width:250px;max-width:500px}.ff-notification{position:relative;left:0;display:flex;margin:8px;padding:4px;background:#4e4e4e;box-shadow:0 0 20px rgba(0,0,0,0.35)}.ff-notification.ff-info>.ff-icon{fill:#73adff}.ff-notification.ff-success>.ff-icon{fill:#8ae65c}.ff-notification.ff-warning>.ff-icon{fill:#e6a345}.ff-notification.ff-error>.ff-icon{fill:#e64545}.ff-notification>.ff-icon{height:2em;padding:8px}.ff-notification.ff-out{transition:left 0.5s ease-in;left:100%}.ff-notification .ff-text{flex:1;padding:8px;text-overflow:ellipsis;overflow:hidden}.ff-notification .ff-button{flex:0;padding:8px}.ff-message-box{position:relative;min-width:350px;max-width:450px;width:90%;padding:16px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);opacity:0;transition:opacity .15s}.ff-message-box.ff-transition{opacity:1}.ff-message-box .ff-title{align-items:flex-start}.ff-message-box .ff-title .ff-type-icon{margin:0 16px 0 0;height:2.5em}.ff-message-box .ff-title .ff-type-icon[name="prompt"]{fill:#e6cf5c}.ff-message-box .ff-title .ff-type-icon[name="info"]{fill:#73adff}.ff-message-box .ff-title .ff-type-icon[name="warning"]{fill:#e6a345}.ff-message-box .ff-title .ff-type-icon[name="error"]{fill:#e64545}.ff-message-box .ff-title .ff-content{flex:1 1 auto;margin:0 0 2em 0}.ff-message-box .ff-title .ff-caption{font-size:1.5em}.ff-message-box .ff-title .ff-text{margin:2em 0 1em 0}.ff-message-box .ff-title .ff-line-edit{margin:0 0 1em 0}.ff-message-box .ff-title .ff-line-edit input{padding:4px}.ff-message-box .ff-title .ff-close-button{margin:0 0 0 16px;padding:0}.ff-message-box .ff-button+.ff-button{margin-left:8px}.ff-popup-options{box-sizing:border-box;background:#343434;border:1px solid #4e4e4e;box-shadow:3px 3px 24px rgba(0,0,0,0.4);min-width:6rem}.ff-popup-options button{padding:4px 8px;text-align:start;user-select:none}.ff-popup-options button+button{margin-top:1px}.ff-popup-options button:hover{background-color:#4e4e4e}.ff-popup-options button:focus{outline:none;background-color:#0089bf}.ff-list{flex:1 1 auto;background-color:#272727}.ff-list .ff-list-item{cursor:pointer;user-select:none;padding:2px}.ff-list .ff-list-item:hover{background-color:#343434}.ff-list .ff-list-item[selected]{background-color:#0089bf}.ff-list .ff-list-item+.ff-list-item{border-top:1px solid #343434}.ff-table{position:relative;box-sizing:border-box;width:100%}.ff-table table{box-sizing:border-box;width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0}.ff-table tr[selected]{background-color:#0089bf}.ff-table th,.ff-table td{padding:4px}.ff-table th{background-color:#1b1b1b;color:#a0a0a0;text-align:start}.ff-table .ff-table-sort-icon{height:0.8em;margin-left:4px;color:#a0a0a0}.ff-tree{position:relative;overflow-y:auto}.ff-tree .ff-tree-node-container{margin-left:-501px;border-top:1px solid #3e3e3e;border-bottom:1px solid #3e3e3e;margin-bottom:-1px}.ff-tree .ff-tree-node{margin-left:500px}.ff-tree .ff-tree-node.ff-inner{background-color:#2f2f2f}.ff-tree .ff-tree-node.ff-leaf{background-color:#3c3c3c}.ff-tree .ff-tree-node.ff-root{background-color:#272727}.ff-tree .ff-tree-node[selected]{background-color:#0089bf}.ff-tree .ff-tree-node .ff-header{position:relative;cursor:pointer;padding-left:14px}.ff-tree .ff-tree-node .ff-header .ff-text{user-select:none}.ff-tree .ff-tree-node.ff-drop-target>.ff-header{outline:1px dashed #0089bf}.ff-tree .ff-tree-node.ff-inner[expanded]>.ff-header:before{content:\'\';position:absolute;top:0.6em;left:3px;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #a0a0a0;transform:rotate(180deg);transition:transform 0.05s}.ff-tree .ff-tree-node.ff-inner:not([expanded])>.ff-header:before{content:\'\';position:absolute;top:0.6em;left:3px;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #a0a0a0;transform:rotate(90deg);transition:transform 0.05s}.ff-tree .ff-tree-node.ff-leaf .ff-header{cursor:default}.ff-tree .ff-tree-node .ff-content{margin-left:10px}.ff-tree .ff-tree-node:not([expanded])>.ff-content{display:none}ff-tab-container{background:#343434}ff-tab-container,ff-dock-stack{background:#272727;border:1px solid #1b1b1b}ff-tab-container header,ff-dock-stack header{background:#1b1b1b}ff-tab-header,ff-dock-panel-header{background:#1b1b1b;color:#c8c8c8;padding:1px 3px 2px 2px}ff-tab-header[active],ff-dock-panel-header[active]{background:linear-gradient(#626262, #343434);color:#c8c8c8}ff-tab-header label,ff-dock-panel-header label{pointer-events:none}ff-tab-header .ff-text,ff-dock-panel-header .ff-text{padding:0 1px}ff-tab-header .ff-icon,ff-dock-panel-header .ff-icon{top:1px;height:0.8rem;padding:0 1px}.ff-dock-drop-marker{box-sizing:border-box;background:rgba(0,137,191,0.3);border:1px solid #0089bf}.ff-viewport-overlay{padding:6px;font-size:0.75rem}.ff-viewport-overlay .ff-row{display:flex;justify-content:space-between}.ff-viewport-overlay .ff-labels{display:flex;flex-direction:column}.ff-viewport-overlay .ff-top-left,.ff-viewport-overlay .ff-bottom-left{align-items:flex-start}.ff-viewport-overlay .ff-top-center,.ff-viewport-overlay .ff-bottom-center{align-items:center}.ff-viewport-overlay .ff-top-right,.ff-viewport-overlay .ff-bottom-right{align-items:flex-end}.ff-viewport-overlay .ff-label-box{box-sizing:border-box;padding:1px 8px 2px 8px;background:rgba(0,0,0,0.5);border-radius:2em}.sv-article h1{margin:0.3em 0;font-family:"Amiri", serif;font-size:2.3em;font-weight:normal;color:#e8e8e8}.sv-article h1:before{content:"";position:absolute;top:0;left:0;width:75px;height:5px;background-color:#0089bf}.sv-article p,.sv-article h2,.sv-article h3,.sv-article h4,.sv-article h5,.sv-article h6,.sv-article ul,.sv-article ol,.sv-article li{font-family:"Hind Siliguri", sans-serif;color:#c8c8c8}.sv-article h2,.sv-article h3,.sv-article h4,.sv-article h5,.sv-article h6{font-size:1.3em;margin:1.2em 0 0.8em 0}.sv-article p,.sv-article ul,.sv-article ol{font-size:1.15em;margin:0.8em 0}.sv-article p{line-height:1.55em}.sv-article ul{padding-left:0.5em;list-style:square inside}.sv-article ol{padding-left:0.5em;list-style:decimal inside}.sv-article a:link,.sv-article a:visited,.sv-article a:hover,.sv-article a:active{color:#0089bf}.sv-article img{max-width:100%}.sv-content-view{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.85em;line-height:1.35;color:#c8c8c8;background-color:#343434;position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-logo{flex:0 50 180px;min-width:40px;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;overflow:hidden;height:40px;user-select:none}.sv-logo .sv-short{flex-grow:1;width:0;max-width:40px}.sv-logo .sv-full{flex:1 0 180px;display:flex}.sv-logo .sv-full .sv-sunburst{flex:0 0 14%}.sv-logo .sv-full .sv-smithsonian{flex:0 0 83%;margin-left:3%}.ff-flex-spacer{user-select:none;-moz-user-select:none;-webkit-user-select:none}.sr-only{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}@keyframes spin{100%{transform:rotate(360deg)}}.sv-spinner{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;display:flex;justify-content:center;align-items:center;pointer-events:none}.sv-spinner-wheel{height:120px;width:120px;animation:spin 5s linear infinite}*{scrollbar-color:#676767 #1b1b1b;scrollbar-width:thin}* ::-webkit-scrollbar{width:8px;height:8px}* ::-webkit-scrollbar-track{background-color:#1b1b1b}* ::-webkit-scrollbar-thumb{background-color:#676767;border-radius:8px}voyager-explorer{font-size:16px}.sv-content-only .sv-scene-view,.sv-content-stack .sv-scene-view{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.sv-reader-container{overflow-y:auto}.sv-content-stack .sv-reader-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;margin-top:52px}.sv-content-stack .sv-reader-view{pointer-events:auto;display:flex;justify-content:center}.sv-content-stack .sv-reader-view .sv-left{flex:0 0 52px}.sv-content-stack .sv-reader-view .sv-article{flex:0 2 720px;background-color:rgba(27,34,38,0.5);padding-bottom:35px}.sv-content-stack .sv-reader-view .sv-right{flex:0 3 16px;background-color:rgba(27,34,38,0.5)}.sv-content-split{display:flex}.sv-content-split .sv-reader-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;margin-top:52px}.sv-content-split .sv-scene-view{flex:1 1 60%}.sv-content-split .sv-reader-view{pointer-events:auto;flex:1 1 40%;padding:0 20px}.sv-content-split .sv-reader-view .sv-left{flex:0 0 52px}.sv-content-split .sv-reader-view .sv-article{flex:0 2 720px;background-color:rgba(27,34,38,0.5);padding-bottom:35px;padding-right:16px}.sv-content-split .sv-reader-view .sv-right{flex:0 3 16px;background-color:rgba(27,34,38,0.5)}.sv-article{position:relative;padding:5px 8px 0 16px}.ff-viewport-overlay{font-size:1.0em}.sv-scene-view{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden}.sv-scene-view.sv-blur{filter:brightness(60%) blur(5px);transition:filter 0.5s}.sv-annotation{box-sizing:border-box;position:absolute;z-index:1;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-annotation-img{max-width:100%}.sv-circle-annotation{width:16%;min-width:160px;max-width:260px;padding:4px 8px;background-color:rgba(0,0,0,0.7);border-radius:4px}.sv-circle-annotation.sv-align-right{transform:translateX(-100%)}.sv-circle-annotation.sv-align-bottom{transform:translateY(-100%)}.sv-circle-annotation .sv-title{padding:0 0 2px 0;font-weight:bold}.sv-circle-annotation p{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.88em;line-height:1.35;color:#c8c8c8;margin:0.5em 0}.sv-circle-annotation .ff-button{background:rgba(0,0,0,0.01)}.sv-circle-annotation .ff-button .ff-icon{fill:#a0a0a0}.sv-circle-annotation .ff-button:hover{text-decoration:underline}.sv-circle-annotation .sv-content{overflow:hidden;overflow-wrap:break-word}.sv-pin-annotation{padding:0 4px;background-color:rgba(0,0,0,0.5);color:#c8c8c8;transform:translate(-50%, -100%)}.sv-standard-annotation,.sv-extended-annotation{max-width:20%;padding:0 4px;background-color:rgba(0,0,0,0.5);color:#c8c8c8;pointer-events:auto}.sv-standard-annotation.sv-expanded,.sv-extended-annotation.sv-expanded{width:20%;min-width:180px;background-color:rgba(0,0,0,0.8)}.sv-standard-annotation.sv-q0,.sv-extended-annotation.sv-q0{transform:translate(0, -100%);border-bottom-style:solid;border-bottom-width:1px;text-align:left}.sv-standard-annotation.sv-q1,.sv-extended-annotation.sv-q1{transform:translate(-100%, -100%);border-bottom-style:solid;border-bottom-width:1px;text-align:right}.sv-standard-annotation.sv-q2,.sv-extended-annotation.sv-q2{transform:translate(-100%, 0);border-top-style:solid;border-top-width:1px;text-align:right}.sv-standard-annotation.sv-q3,.sv-extended-annotation.sv-q3{transform:translate(0, 0);border-top-style:solid;border-top-width:1px;text-align:left}.sv-standard-annotation.sv-static-width,.sv-extended-annotation.sv-static-width{width:fit-content}.sv-standard-annotation .sv-title,.sv-extended-annotation .sv-title{padding:1px 0 2px 0;font-weight:bold}.sv-standard-annotation .sv-content,.sv-extended-annotation .sv-content{padding:2px 0;height:0;overflow:hidden;overflow-wrap:break-word;transition:height 0.2s}.sv-standard-annotation p,.sv-extended-annotation p{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.88em;line-height:1.35;color:#c8c8c8;margin:0.5em 0}.sv-standard-annotation .ff-button,.sv-extended-annotation .ff-button{background:rgba(0,0,0,0.01)}.sv-standard-annotation .ff-button .ff-icon,.sv-extended-annotation .ff-button .ff-icon{fill:#a0a0a0}.sv-standard-annotation .ff-button:hover,.sv-extended-annotation .ff-button:hover{text-decoration:underline}.sv-extended-annotation .sv-title{cursor:pointer}.sv-standard-annotation{pointer-events:none}.sv-ar-prompt{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;text-align:center;border-radius:20px;margin:30% 0 0 0;overflow:hidden;background-color:rgba(54,61,64,0.6)}.sv-ar-prompt .sv-content{flex:1;width:100%;margin:10px 10px;text-align:center;-webkit-user-select:none;-ms-user-select:none;user-select:none}.sv-ar-prompt .sv-content .sv-ar-icon{height:10em}.sv-ar-menu{display:flex;position:absolute;bottom:0px;flex-direction:row;margin:0 0 6px 6px}.sv-ar-menu>.ff-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;width:38px;height:38px;margin:0 6px 2px 0;background-color:rgba(74,82,87,0.5);border-radius:20px;font-size:17px;transition:all .15s;pointer-events:auto}.sv-ar-menu>.ff-button:hover,.sv-ar-menu>.ff-button:focus{outline:none;background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-ar-menu>.ff-button[selected]{background-color:#0089bf;color:#f0f0f0}.sv-ar-menu>.ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-ar-menu>.ff-button[selected]:hover,.sv-ar-menu>.ff-button[selected]:focus{background-color:#00a6e8}.sv-chrome-view{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.85em;line-height:1.35;color:#c8c8c8;position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;background:linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.15) 10%, transparent 25%);z-index:1}.sv-chrome-view .ff-button{flex:0 1 auto;box-sizing:border-box}.sv-chrome-view .ff-button:focus{outline:none;box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-view .ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-chrome-view .ff-button:focus-visible{outline:none;box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-view .ff-button:hover{outline:none}.sv-chrome-view .ff-button:hover>.ff-icon{fill:#c8c8c8}.sv-chrome-view .ff-button[selected]{background-color:#0089bf}.sv-chrome-view .ff-button[selected][disabled]{background-color:#4e4e4e}.sv-chrome-view .ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-chrome-header{display:flex;align-items:flex-start;height:100%;position:relative}.sv-chrome-header .sv-top-bar{flex:1 1 auto;display:flex;align-items:flex-start;height:40px;margin:9px 9px 0 0;overflow:hidden}.sv-chrome-header .sv-main-title{flex:1 1 auto;margin:6px 8px;font-family:"Hind Siliguri", sans-serif;font-weight:normal;font-size:1.412em;white-space:pre;color:#e8e8e8;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-chrome-header .sv-main-title span{color:transparent}.sv-chrome-footer{display:block;position:absolute;bottom:0;right:0;z-index:-1}.sv-chrome-footer .sv-bottom-bar{flex:1 1 auto;display:flex;align-items:flex-end;text-align:right;overflow:hidden}.sv-chrome-footer .sv-language-display{flex:1 1 auto;margin:6px 8px;font-family:"Hind Siliguri", sans-serif;font-weight:normal;font-size:1.176em;white-space:pre;color:#e8e8e8;pointer-events:auto;background:rgba(31,36,38,0.8);border-radius:4px;padding:4px 6px;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-chrome-footer .sv-language-display:hover,.sv-chrome-footer .sv-language-display:focus{outline:none;background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-chrome-footer .sv-language-display span{color:transparent}.sv-main-menu-wrapper{position:relative;height:100%;min-width:50px}.sv-main-menu{display:flex;flex-direction:column;padding:6px 9px 6px 6px;height:100%;overflow-y:auto;overflow-x:hidden;pointer-events:auto;position:absolute;box-sizing:border-box;overscroll-behavior-y:contain}.sv-main-menu>.ff-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;width:38px;height:38px;margin:2px 0;background-color:rgba(31,36,38,0.8);border-radius:20px;font-size:17px;transition:all .15s;pointer-events:auto}.sv-main-menu>.ff-button:focus{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-main-menu>.ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-main-menu>.ff-button:focus-visible{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-main-menu>.ff-button:hover{background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-main-menu>.ff-button[selected]{background-color:#0089bf;color:#f0f0f0}.sv-main-menu>.ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-main-menu>.ff-button[selected]:hover,.sv-main-menu>.ff-button[selected]:focus{background-color:#00a6e8}.sv-main-menu .sv-scroll-btn{border-radius:2px;font-size:10px;height:19px;background-color:#343434;z-index:2;padding:0px;position:sticky}.sv-main-menu .sv-scroll-btn.up{top:0px;margin-top:0px}.sv-main-menu .sv-scroll-btn.down{bottom:12px;margin-top:12px}.sv-main-menu .sv-scroll-btn:hover{background-color:#676767;fill:#c8c8c8}.sv-main-menu .sv-scroll-btn:focus,.sv-main-menu .sv-scroll-btn:focus-visible{background-color:#343434}.sv-share-menu{position:relative;width:450px;max-width:85%;padding:8px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);pointer-events:auto}.sv-share-menu .ff-title{margin:0.5em 0 1em 0}.sv-share-menu .ff-button{flex:0 0 auto}.sv-share-menu .ff-text-edit{height:6.5em}.sv-share-menu .sv-share-buttons .ff-button{width:48px;height:48px;border-radius:48px;margin:0 1em 1em 0;padding:0}.sv-share-menu .sv-share-buttons .ff-button .ff-icon{height:30px;fill:#f0f0f0}.sv-share-menu .sv-share-button-twitter{background-color:#00aced}.sv-share-menu .sv-share-button-twitter:focus{outline:none;background-color:#00aced;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-twitter:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-twitter:focus-visible{outline:none;background:#00aced;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-twitter:hover{background-color:#21c2ff}.sv-share-menu .sv-share-button-facebook{background-color:#3c5a99}.sv-share-menu .sv-share-button-facebook:focus{outline:none;background-color:#3c5a99;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-facebook:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-facebook:focus-visible{outline:none;background:#3c5a99;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-facebook:hover{background-color:#4e71ba}.sv-share-menu .sv-share-button-linkedin{background-color:#0077B5}.sv-share-menu .sv-share-button-linkedin:focus{outline:none;background-color:#0077B5;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-linkedin:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-linkedin:focus-visible{outline:none;background:#0077B5;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-linkedin:hover{background-color:#0099e8}.sv-share-menu .sv-share-button-email{background-color:#d28842}.sv-share-menu .sv-share-button-email:focus{outline:none;background-color:#d28842;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-email:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-email:focus-visible{outline:none;background:#d28842;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-email:hover{background-color:#dca26b}.sv-document-overlay{position:absolute;left:52px;top:52px;right:6px;bottom:0;pointer-events:auto}.sv-tour-menu .sv-article,.sv-reader-view .sv-article{position:relative}.sv-tour-menu .sv-article .sv-nav-button,.sv-reader-view .sv-article .sv-nav-button{float:right;margin:1em 0.5em;padding:2px}.sv-tour-menu .sv-article .sv-nav-button .ff-icon,.sv-reader-view .sv-article .sv-nav-button .ff-icon{height:1.5em}.sv-tour-menu .sv-entry,.sv-reader-view .sv-entry{position:relative;cursor:pointer;padding:5px 0 5px 15px;margin:2px 2px 16px 2px;max-width:960px;background-color:rgba(27,34,38,0.5)}.sv-tour-menu .sv-entry:hover,.sv-reader-view .sv-entry:hover{background-color:rgba(51,59,64,0.5)}.sv-option-menu{position:relative;width:225px;max-width:85%;height:200px;max-height:85%;padding:8px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);pointer-events:auto}.sv-option-menu .ff-title{margin:0.3em 0 0.3em 0.3em}.sv-option-menu .ff-header{padding:0.3em 0 0.3em 0.3em;background:rgba(31,36,38,0.8)}.sv-option-menu .ff-button{flex:0 0 auto}.sv-option-menu .sv-scroll-offset{top:50px}.sv-option-menu .sv-centered{justify-content:center;padding:0.3em 0 0.3em 0.3em}.sv-option-menu .sv-entry{position:relative;cursor:pointer;padding:5px 0 5px 15px;margin-bottom:2px;max-width:960px;background-color:rgba(27,34,38,0.5);user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-option-menu .sv-entry:focus{outline:2px solid #bfedff;outline-offset:-2px;background-color:rgba(27,34,38,0.5)}.sv-option-menu .sv-entry:focus:not(:focus-visible){outline:0}.sv-option-menu .sv-entry:focus-visible{outline:2px solid #bfedff;outline-offset:-2px;background-color:rgba(27,34,38,0.5)}.sv-option-menu .sv-entry:hover{background-color:rgba(51,59,64,0.5);fill:#c8c8c8}.sv-option-menu .sv-entry[selected]{background-color:#0089bf;color:#f0f0f0}.sv-option-menu .sv-entry[selected]:hover,.sv-option-menu .sv-entry[selected]:focus{background-color:#00a6e8}.sv-bottom-bar-container{position:relative;display:flex;justify-content:center;transition:transform .3s ease-out,opacity .15s ease-out}.sv-bottom-bar-container.sv-transition{transform:translateY(40px);opacity:0}.sv-bottom-bar-container .ff-button{transition:all .15s}.sv-blue-bar{flex:0 1 960px;display:flex;flex-direction:column;background-color:rgba(5,7,8,0.85);border-left:1px solid rgba(0,137,191,0.5);border-right:1px solid rgba(0,137,191,0.5);margin:0 -1px 0 -1px;min-width:0px;pointer-events:auto;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-blue-bar .sv-group{display:flex;flex-direction:column}.sv-blue-bar .sv-section{position:relative;display:flex;flex-direction:row;border-top:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-section-lead,.sv-blue-bar .sv-section-trail{flex:0 0 auto;padding:6px;width:38px}.sv-blue-bar .sv-section-lead:hover,.sv-blue-bar .sv-section-trail:hover{background-color:rgba(74,82,87,0.5)}.sv-blue-bar .sv-section-lead{border-right:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-section-trail{border-left:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-transparent-button{flex:0 1 auto;padding:6px;border-radius:2px}.sv-blue-bar .sv-transparent-button .ff-text{margin:1px 2px}.sv-blue-bar .sv-transparent-button .ff-icon{height:22px;margin:1px 2px}.sv-tour-navigator{color:#c8c8c8}.sv-tour-navigator .sv-content{flex:1;margin:2px 8px;text-align:center}.sv-tour-navigator .sv-title{font-size:1.1em}.sv-tour-navigator .sv-text{font-size:0.9em}.sv-target-navigator .sv-content{flex:1;margin:2px 8px;text-align:center}.sv-target-navigator .sv-title{font-size:1.1em}.sv-tag-cloud .sv-tag-buttons{flex:1 1 auto;display:flex;flex-wrap:wrap;justify-content:center;margin:4px}.sv-tag-cloud .sv-tag-button{flex:0 1 auto;margin:3px 3px;padding:2px 4px;background-color:rgba(31,36,38,0.8);border-radius:3px;font-size:0.88em}.sv-tag-cloud .sv-tag-button:hover{background-color:rgba(74,82,87,0.5)}.sv-tag-cloud .sv-tag-button[selected]{background-color:#0089bf}.sv-tag-cloud .sv-tag-button .ff-text{margin:1px 2px}.sv-tag-cloud .sv-tag-button .ff-icon{height:22px;margin:1px 2px}.sv-tool-bar{color:#c8c8c8;pointer-events:auto}.sv-tool-bar .sv-tool-buttons{flex:1 1 auto;display:flex;margin:4px;overflow-x:auto}.sv-tool-bar .sv-tool-buttons .sv-tool-button:first-child{margin-left:auto}.sv-tool-bar .sv-tool-buttons .sv-tool-button:last-child{margin-right:auto}.sv-tool-bar .sv-tool-button{flex:0 1 auto;margin:2px;padding:1px 2px;border-radius:3px;font-size:0.882em}.sv-tool-bar .sv-tool-button .ff-text{margin:1px 2px}.sv-tool-bar .sv-tool-button .ff-icon{height:22px;margin:1px 2px}.sv-tool-bar-container{position:relative;bottom:0px;width:100%}.sv-tool-controls{flex:1 1 auto;display:flex;justify-content:center;align-items:center;font-size:0.882em}.sv-tool-controls .sv-property-view{flex:0 1 auto;align-self:start;display:flex;flex-direction:column;margin:4px}.sv-tool-controls .sv-property-view label{height:1.25em}.sv-tool-controls .sv-property-view.sv-nogap{margin:4px 0 !important}.sv-tool-controls .sv-property-slider{flex:0 2 180px}.sv-tool-controls .sv-property-slider .ff-linear-slider{height:6px;margin:12px 2px;padding-right:16px;border-radius:2px;background-color:#4e4e4e}.sv-tool-controls .sv-property-slider .ff-linear-slider .ff-knob{width:16px;height:26px;margin:-10px 0 0 0;border-radius:2px;background-color:#0089bf;box-shadow:0 0 6px black}.sv-tool-controls .sv-property-color>.ff-button{width:28px;box-sizing:border-box;border:1px solid #343434}.sv-tool-controls .sv-property-color .ff-color-edit{position:absolute;width:200px;height:180px;right:8px;top:-188px}.sv-tool-controls .sv-options{display:flex}.sv-tool-controls .ff-label{margin:2px}.sv-tool-controls .ff-string{flex:0 1 auto;height:26px;margin:2px;font-size:1.34em}.sv-tool-controls .ff-button{height:26px;margin:2px;padding:0 4px;background:#343434;border-radius:2px}.sv-tool-controls .ff-button:focus{outline:none;background:#343434;box-shadow:0 0 3pt 2pt #bfedff}.sv-tool-controls .ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-tool-controls .ff-button:focus-visible{outline:none;background:#343434;box-shadow:0 0 3pt 2pt #bfedff}.sv-tool-controls .ff-button:hover{background-color:#676767;fill:#c8c8c8}.sv-view-tool-view .sv-options,.sv-render-tool-view .sv-options,.sv-light-tool-view .sv-options{flex-wrap:wrap}.sv-tape-tool-view .sv-tool-controls,.sv-slice-tool-view .sv-tool-controls,.sv-environment-tool-view .sv-tool-controls{flex-wrap:wrap}\n',e.appendChild(t);const n=this.application.system;e.appendChild(new Ny(n)),e.appendChild(new cb(n));const i=document.createElement("div");i.setAttribute("id",ho.stackId),e.appendChild(i),ho.shadowRootNode=e;const s=document.createElement("div");s.classList.add("sr-only"),s.setAttribute("id","sr-intro"),s.setAttribute("aria-live","polite"),e.appendChild(s)}connected(){this.fullscreen.fullscreenElement=this,this.viewer.rootElement=this}disconnected(){this.fullscreen.fullscreenElement=null,this.viewer.rootElement=null,this.application.dispose(),this.application=null}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),this.application&&"root"===e?(this.application.props.root=this.getAttribute("root"),this.application.evaluateProps()):this.application&&"controls"===e&&this.application.enableNavigation(n)}onFocus(){this.shadowRoot.getElementById("sr-intro").innerText="The Voyager web application allows you to view and interact with a 3D model from the Smithsonian collection. Use the tab key to move through interactive elements, enter or spacebar keys to activate, and the escape key to exit menus."}toggleAnnotations(){this.application&&this.application.toggleAnnotations()}toggleReader(){this.application&&this.application.toggleReader()}toggleTours(){this.application&&this.application.toggleTours()}toggleTools(){this.application&&this.application.toggleTools()}toggleMeasurement(){this.application&&this.application.toggleMeasurement()}enableAR(){this.application&&this.application.enableAR()}getArticles(){if(this.application){return this.application.getArticles()}}getAnnotations(){if(this.application){return this.application.getAnnotations()}}getCameraOrbit(){if(this.application){return this.application.getCameraOrbit()}}setCameraOrbit(e,t){this.application&&this.application.setCameraOrbit(e,t)}getCameraOffset(){if(this.application){return this.application.getCameraOffset()}}setCameraOffset(e,t,n){this.application&&this.application.setCameraOffset(e,t,n)}setBackgroundColor(e,t){this.application&&this.application.setBackgroundColor(e,t||null)}setBackgroundStyle(e){this.application&&this.application.setBackgroundStyle(e)}setActiveAnnotation(e){this.application&&this.viewer.ins.activeAnnotation.setValue(e)}setTourStep(e,t,n){this.application&&this.application.setTourStep(e,t,void 0===n||n)}setLanguage(e){this.application&&this.application.setLanguage(e)}};ub=hb([Qr("voyager-explorer")],ub);const db=ub},338:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},360:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};n(8500)})(); From e997a9592d28e4d4aa60a4276d7842e074f60fa0 Mon Sep 17 00:00:00 2001 From: qqmyers Date: Thu, 8 Aug 2024 10:41:09 -0400 Subject: [PATCH 2/5] registration example, readme updates --- 6.1curlcommands.md | 34 ++++++++++++++++++++++++++++++++++ README.md | 3 ++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/6.1curlcommands.md b/6.1curlcommands.md index efb2605..29c7e18 100644 --- a/6.1curlcommands.md +++ b/6.1curlcommands.md @@ -1753,5 +1753,39 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin ] }' ``` +### Smithsonian Voyager 3D model Previewer (beta) +__Note:__ Voyager supports multiple formats. Only *.glb (model/gltf-binary) is currently supported by the Previewer. +Also note that with current styling the Voyager app fills the window when launched as a separate page, so the usual +preview header/footer information doesn't show (and therefore isn't even requested from Dataverse). + +```bash +curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \ +'{ + "displayName":"View 3D model", + "description":"Explore the 3D model file using Voyager.", + "toolName":"voyagerPreviewer", + "scope":"file", + "types":["preview"], + "toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/betatest/VoyagerPreview.html", + "toolParameters": { + "queryParameters":[ + {"fileid":"{fileId}"}, + {"siteUrl":"{siteUrl}"}, + {"datasetid":"{datasetId}"}, + {"datasetversion":"{datasetVersion}"}, + {"locale":"{localeCode}"} + ] + }, + "contentType":"model/gltf-binary", + "allowedApiCalls": [ + { + "name": "retrieveFileContents", + "httpMethod": "GET", + "urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=true", + "timeOut": 3600 + } + ] +}' +``` diff --git a/README.md b/README.md index b2162bc..a68561e 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,8 @@ The image previewer only works with image/tiff files on some browsers (as of ~Ja The original tools were developed through the [Qualitative Data Repository](https://qdr.syr.edu) but are being offered to the Dataverse community at large. -[qqmyers](https://github.com/qqmyers) - developer of the original previewer framework, contributions to the Rich Html Previewer +[qqmyers](https://github.com/qqmyers) - developer of the original previewer framework, contributions to the Rich Html Previewer, Voyager Previewer, updating to use signed URLs + The Spreadsheet Previewer was contributed by [anncie-pcss](https://github.com/anncie-pcss). [pdurbin](https://github.com/pdurbin) updated the retriever.js script to allow previewers to be embedded directly in the Dataverse file pages. From 41e6f1e2353bf5f7601a3c0e8fad3dcd97c18ccc Mon Sep 17 00:00:00 2001 From: qqmyers Date: Thu, 8 Aug 2024 14:17:58 -0400 Subject: [PATCH 3/5] update to the latest compatible 42.1 version --- previewers/betatest/js/voyager.js | 2 +- .../lib/voyager-explorer.min.v0.17.0.gdcc.js | 239 ----------- .../lib/voyager-explorer.min.v0.42.1.gdcc.js | 381 ++++++++++++++++++ 3 files changed, 382 insertions(+), 240 deletions(-) delete mode 100644 previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js create mode 100644 previewers/betatest/lib/voyager-explorer.min.v0.42.1.gdcc.js diff --git a/previewers/betatest/js/voyager.js b/previewers/betatest/js/voyager.js index 39ef524..6c18301 100644 --- a/previewers/betatest/js/voyager.js +++ b/previewers/betatest/js/voyager.js @@ -15,5 +15,5 @@ function writeContent(fileUrl, file, title, authors) { const fileName = fileUrl.substring(lastIndexOfChar + 1); console.log(fileUrl); $("voyager-explorer").attr("root", rootUrl).attr("model", fileName); - $.getScript("lib/voyager-explorer.min.v0.17.0.gdcc.js"); + $.getScript("lib/voyager-explorer.min.v0.42.1.gdcc.js"); } \ No newline at end of file diff --git a/previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js b/previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js deleted file mode 100644 index 746be60..0000000 --- a/previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js +++ /dev/null @@ -1,239 +0,0 @@ -/*This file has been modified for use with Dataverse. Current modifications: - * Added * as anAccept header file type for voyager-explorer in addition to text/plain for model files (line 14 of the minimized file) - -*/ -/*! For license information please see voyager-explorer.min.js.LICENSE.txt */ -(()=>{var e={3523:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n\n// #include \n// replaced with\nvarying vec2 vUv;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\n vec2 coords = vUv * 2.0 - 1.0;\n float f = dot(coords, coords);\n\tgl_FragColor = vec4(outgoingLight, mix(diffuseColor.a, 0.0, f));\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n\n"},2001:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n\n// #include \n// replaced with\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t// #include \n\t// replaced with\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n\n"},8669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="//#define PHYSICAL\n//#define STANDARD\n\n#ifdef PHYSICAL\n #define REFLECTIVITY\n #define CLEARCOAT\n #define TRANSPARENCY\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef TRANSPARENCY\n uniform float transparency;\n#endif\n\n#ifdef REFLECTIVITY\n uniform float reflectivity;\n#endif\n\n#ifdef CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_SHEEN\n uniform vec3 sheen;\n#endif\n\n//#ifndef STANDARD\n//\tuniform float clearCoat;\n//\tuniform float clearCoatRoughness;\n//#endif\n\nvarying vec3 vViewPosition;\n\n\n#include \n#include \n#include \n#include \n\n//#include \n//#include \n// REPLACED WITH\n#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP) || defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n\tvarying vec2 vUv;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n//#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_ZONEMAP\n\tuniform sampler2D zoneMap;\n#endif\n\n#ifdef USE_AOMAP\n uniform vec3 aoMapMix;\n#endif\n\n#ifdef MODE_XRAY\n varying float vIntensity;\n#endif\n\n#ifdef CUT_PLANE\n varying vec3 vWorldPosition;\n uniform vec4 cutPlaneDirection;\n uniform vec3 cutPlaneColor;\n#endif\n\nvoid main() {\n #ifdef CUT_PLANE\n if (dot(vWorldPosition, cutPlaneDirection.xyz) < -cutPlaneDirection.w) {\n discard;\n }\n #endif\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n #include \n\n\t#ifdef CUT_PLANE\n\t // on the cut surface (back facing fragments revealed), replace normal with cut plane direction\n if (!gl_FrontFacing) {\n normal = -cutPlaneDirection.xyz;\n diffuseColor.rgb = cutPlaneColor.rgb;\n }\n\t#endif\n\n #include \n #include \n #include \n\n\t// accumulation\n #if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n vec2 vUv2 = vUv;\n #endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t//#include \n\t// REPLACED WITH\n\t#ifdef USE_AOMAP\n\t // if cut plane is enabled, disable ambient occlusion on back facing fragments\n\t #ifdef CUT_PLANE\n if (gl_FrontFacing) {\n\t #endif\n\n \t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n \tvec3 aoSample = texture2D(aoMap, vUv).rgb;\n \tvec3 aoFactors = mix(vec3(1.0), aoSample, clamp(aoMapMix * aoMapIntensity, 0.0, 1.0));\n \tfloat ambientOcclusion = aoFactors.x * aoFactors.y * aoFactors.z;\n \tfloat ambientOcclusion2 = ambientOcclusion * ambientOcclusion;\n \treflectedLight.directDiffuse *= ambientOcclusion2;\n \treflectedLight.directSpecular *= ambientOcclusion;\n \t//reflectedLight.indirectDiffuse *= ambientOcclusion;\n\n \t#if defined(USE_ENVMAP) && defined(PHYSICAL)\n \t\tfloat dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n \t\treflectedLight.indirectSpecular *= computeSpecularOcclusion(dotNV, ambientOcclusion, material.specularRoughness);\n \t#endif\n\n \t#ifdef CUT_PLANE\n \t }\n \t#endif\n #endif\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n // this is a stub for the transparency model\n #ifdef TRANSPARENCY\n diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n #endif\n\n\t#ifdef CUT_PLANE\n\tif (!gl_FrontFacing) {\n\t\toutgoingLight = cutPlaneColor.rgb;\n\t}\n\t#endif\n\n\tgl_FragColor = vec4(outgoingLight, diffuseColor.a);\n\n\t#ifdef USE_ZONEMAP\n\t\tvec4 zoneColor = texture2D(zoneMap, vUv);\n\t\tgl_FragColor += vec4(zoneColor.rgb, 1.0);\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n #ifdef MODE_NORMALS\n gl_FragColor = vec4(vec3(normal * 0.5 + 0.5), 1.0);\n #endif\n\n #ifdef MODE_XRAY\n gl_FragColor = vec4(vec3(0.4, 0.7, 1.0) * vIntensity, 1.0);\n #endif\n}\n"},9849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="//#define PHYSICAL\n//#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#include \n\n#include \n\n//#include \n//#include \n// REPLACED WITH\n#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP) || defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef MODE_XRAY\n varying float vIntensity;\n#endif\n\n#ifdef CUT_PLANE\n varying vec3 vWorldPosition;\n#endif\n\nvoid main() {\n\n//\t#include \n//\t#include \n// REPLACED WITH\n#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP) || defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n\tvUv = (uvTransform * vec3(uv, 1)).xy;\n#endif\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifdef MODE_XRAY\n vIntensity = pow(abs(1.0 - abs(dot(vNormal, vec3(0.0, 0.0, 1.0)))), 3.0);\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = -mvPosition.xyz;\n\n\t// #include \n\t// REPLACED WITH\n\t#if defined(USE_ENVMAP) || defined(DISTANCE) || defined(USE_SHADOWMAP) || defined(CUT_PLANE)\n \tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n\n\t#include \n\t#include \n\n#ifdef CUT_PLANE\n vWorldPosition = worldPosition.xyz / worldPosition.w;\n#endif\n\n#ifdef MODE_NORMALS\n vNormal = normal;\n#endif\n}\n"},5310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const i=n(2206),s=n(610),r=n(3348),o=n(360),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends i.default{_addVocabularies(){super._addVocabularies(),s.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var h=n(3750);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var u=n(6110);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}})},6657:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends n{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=i;class s extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof i&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function r(e,...t){const n=[e[0]];let i=0;for(;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const i=n(6657),s=n(2715);var r=n(6657);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var o=n(2715);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),t.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?s.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=L(this.rhs,e,t)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof i.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=L(this.rhs,e,t),this}get names(){return R(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class h extends c{constructor(e,t,n,i){super(e,n,i),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class p extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=L(this.code,e,t),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,n)=>t+n.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:n}=this;let i=n.length;for(;i--;){const s=n[i];s.optimizeNames(e,t)||(N(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>P(e,t.names)),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends f{}class y extends g{}y.kind="else";class b extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof b?t:t.nodes:this.nodes.length?this:new b(D(e),t instanceof b?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var n;if(this.else=null===(n=this.else)||void 0===n?void 0:n.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=L(this.condition,e,t),this}get names(){const e=super.names;return R(e,this.condition),this.else&&P(e,this.else.names),e}}b.kind="if";class x extends g{}x.kind="for";class _ extends x{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=L(this.iteration,e,t),this}get names(){return P(super.names,this.iteration.names)}}class w extends x{constructor(e,t,n,i){super(),this.varKind=e,this.name=t,this.from=n,this.to=i}render(e){const t=e.es5?s.varKinds.var:this.varKind,{name:n,from:i,to:r}=this;return`for(${t} ${n}=${i}; ${n}<${r}; ${n}++)`+super.render(e)}get names(){const e=R(super.names,this.from);return R(e,this.to)}}class S extends x{constructor(e,t,n,i){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=L(this.iterable,e,t),this}get names(){return P(super.names,this.iterable.names)}}class M extends g{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}M.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class T extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var n,i;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(i=this.finally)||void 0===i||i.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&P(e,this.catch.names),this.finally&&P(e,this.finally.names),e}}class C extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}C.kind="catch";class A extends g{render(e){return"finally"+super.render(e)}}A.kind="finally";function P(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function R(e,t){return t instanceof i._CodeOrName?P(e,t.names):e}function L(e,t,n){return e instanceof i.Name?r(e):(s=e)instanceof i._Code&&s._items.some((e=>e instanceof i.Name&&1===t[e.str]&&void 0!==n[e.str]))?new i._Code(e._items.reduce(((e,t)=>(t instanceof i.Name&&(t=r(t)),t instanceof i._Code?e.push(...t._items):e.push(t),e)),[])):e;var s;function r(e){const i=n[e.str];return void 0===i||1!==t[e.str]?e:(delete t[e.str],i)}}function N(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function D(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:i._`!${z(e)}`}t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new s.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,i){const s=this._scope.toName(t);return void 0!==n&&i&&(this._constants[s.str]=n),this._leafNode(new l(e,s,n)),s}const(e,t,n){return this._def(s.varKinds.const,e,t,n)}let(e,t,n){return this._def(s.varKinds.let,e,t,n)}var(e,t,n){return this._def(s.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new h(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==i.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[n,s]of e)t.length>1&&t.push(","),t.push(n),(n!==s||this.opts.es5)&&(t.push(":"),(0,i.addCodeArg)(t,s));return t.push("}"),new i._Code(t)}if(e,t,n){if(this._blockNode(new b(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new b(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(b,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,n,i,r=(this.opts.es5?s.varKinds.var:s.varKinds.let)){const o=this._scope.toName(e);return this._for(new w(r,o,t,n),(()=>i(o)))}forOf(e,t,n,r=s.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof i.Name?t:this.var("_arr",t);return this.forRange("_i",0,i._`${e}.length`,(t=>{this.var(o,i._`${e}[${t}]`),n(o)}))}return this._for(new S("of",r,o,t),(()=>n(o)))}forIn(e,t,n,r=(this.opts.es5?s.varKinds.var:s.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,i._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new S("in",r,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(x)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new T;if(this._blockNode(i),this.code(e),t){const e=this.name("e");this._currNode=i.catch=new C(e),t(e)}return n&&(this._currNode=i.finally=new A,this.code(n)),this._endBlockNode(C,A)}throw(e){return this._leafNode(new p(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=i.nil,n,s){return this._blockNode(new M(e,t,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(M)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=D;const O=k(t.operators.AND);t.and=function(...e){return e.reduce(O)};const I=k(t.operators.OR);function k(e){return(t,n)=>t===i.nil?n:n===i.nil?t:i._`${z(t)} ${e} ${z(n)}`}function z(e){return e instanceof i.Name?e:i._`(${e})`}t.or=function(...e){return e.reduce(I)}},2715:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const i=n(6657);class s extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var r;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(r=t.UsedValueState||(t.UsedValueState={})),t.varKinds={const:new i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof i.Name?e:this.name(e)}name(e){return new i.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,n;if((null===(n=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===n?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class a extends i.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=i._`.${new i.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=i._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:i.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(e),{prefix:s}=i,r=null!==(n=t.key)&&void 0!==n?n:t.ref;let o=this._values[s];if(o){const e=o.get(r);if(e)return e}else o=this._values[s]=new Map;o.set(r,i);const a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,i.setValue(t,{property:s,itemIndex:l}),i}getValue(e,t){const n=this._values[e];if(n)return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return i._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,n){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,n)}_reduceValues(e,n,o={},a){let l=i.nil;for(const c in e){const h=e[c];if(!h)continue;const u=o[c]=o[c]||new Map;h.forEach((e=>{if(u.has(e))return;u.set(e,r.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=i._`${l}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new s(e);l=i._`${l}${o}${this.opts._n}`}u.set(e,r.Completed)}))}return l}}},6257:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const i=n(6110),s=n(530),r=n(7748);function o(e,t){const n=e.const("err",t);e.if(i._`${r.default.vErrors} === null`,(()=>e.assign(r.default.vErrors,i._`[${n}]`)),i._`${r.default.vErrors}.push(${n})`),e.code(i._`${r.default.errors}++`)}function a(e,t){const{gen:n,validateName:s,schemaEnv:r}=e;r.$async?n.throw(i._`new ${e.ValidationError}(${t})`):(n.assign(i._`${s}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>i.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?i.str`"${e}" keyword must be ${t} ($data)`:i.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,s,r){const{it:l}=e,{gen:h,compositeRule:u,allErrors:d}=l,p=c(e,n,s);(null!=r?r:u||d)?o(h,p):a(l,i._`[${p}]`)},t.reportExtraError=function(e,n=t.keywordError,i){const{it:s}=e,{gen:l,compositeRule:h,allErrors:u}=s;o(l,c(e,n,i)),h||u||a(s,r.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(r.default.errors,t),e.if(i._`${r.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(i._`${r.default.vErrors}.length`,t)),(()=>e.assign(r.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:s,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",o,r.default.errors,(o=>{e.const(l,i._`${r.default.vErrors}[${o}]`),e.if(i._`${l}.instancePath === undefined`,(()=>e.assign(i._`${l}.instancePath`,(0,i.strConcat)(r.default.instancePath,a.errorPath)))),e.assign(i._`${l}.schemaPath`,i.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(i._`${l}.schema`,n),e.assign(i._`${l}.data`,s))}))};const l={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function c(e,t,n){const{createErrors:s}=e.it;return!1===s?i._`{}`:function(e,t,n={}){const{gen:s,it:o}=e,a=[h(o,n),u(e,n)];return function(e,{params:t,message:n},s){const{keyword:o,data:a,schemaValue:c,it:h}=e,{opts:u,propertyName:d,topSchemaRef:p,schemaPath:m}=h;s.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||i._`{}`]),u.messages&&s.push([l.message,"function"==typeof n?n(e):n]);u.verbose&&s.push([l.schema,c],[l.parentSchema,i._`${p}${m}`],[r.default.data,a]);d&&s.push([l.propertyName,d])}(e,t,a),s.object(...a)}(e,t,n)}function h({errorPath:e},{instancePath:t}){const n=t?i.str`${e}${(0,s.getErrorPath)(t,s.Type.Str)}`:e;return[r.default.instancePath,(0,i.strConcat)(r.default.instancePath,n)]}function u({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let o=r?t:i.str`${t}/${e}`;return n&&(o=i.str`${o}${(0,s.getErrorPath)(n,s.Type.Str)}`),[l.schemaPath,o]}},9336:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const i=n(6110),s=n(7939),r=n(7748),o=n(6184),a=n(530),l=n(3750),c=n(5858);class h{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){const t=p.call(this,e);if(t)return t;const n=(0,o.getFullPath)(e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:h}=this.opts,u=new i.CodeGen(this.scope,{es5:a,lines:c,ownProperties:h});let d;e.$async&&(d=u.scopeValue("Error",{ref:s.default,code:i._`require("ajv/dist/runtime/validation_error").default`}));const m=u.scopeName("validate");e.validateName=m;const f={gen:u,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,i.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:d,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:i.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:i._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),u.optimize(this.opts.code.optimize);const t=u.toString();g=`${u.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:n}),n.errors=null,n.schema=e.schema,n.schemaEnv=e,e.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:m,validateCode:t,scopeValues:u._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof i.Name?void 0:e,items:t instanceof i.Name?void 0:t,dynamicProps:e instanceof i.Name,dynamicItems:t instanceof i.Name},n.source&&(n.source.evaluated=(0,i.stringify)(n.evaluated))}return e.validate=n,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function d(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function p(e){for(const i of this._compilations)if(n=e,(t=i).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return i;var t,n}function m(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||f.call(this,e,t)}function f(e,t){const n=c.parse(t),i=(0,o._getFullPath)(n);let s=(0,o.getFullPath)(e.baseId);if(Object.keys(e.schema).length>0&&i===s)return v.call(this,n,e);const r=(0,o.normalizeId)(i),a=this.refs[r]||this.schemas[r];if("string"==typeof a){const t=f.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return v.call(this,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||u.call(this,a),r===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,i=t[n];return i&&(s=(0,o.resolveUrl)(s,i)),new h({schema:t,schemaId:n,root:e,baseId:s})}return v.call(this,n,a)}}t.SchemaEnv=h,t.compileSchema=u,t.resolveRef=function(e,t,n){var i;n=(0,o.resolveUrl)(t,n);const s=e.refs[n];if(s)return s;let r=m.call(this,e,n);if(void 0===r){const s=null===(i=e.localRefs)||void 0===i?void 0:i[n],{schemaId:o}=this.opts;s&&(r=new h({schema:s,schemaId:o,root:e,baseId:t}))}return void 0!==r?e.refs[n]=d.call(this,r):void 0},t.getCompilingSchema=p,t.resolveSchema=f;const g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(e,{baseId:t,schema:n,root:i}){var s;if("/"!==(null===(s=e.fragment)||void 0===s?void 0:s[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(i)];if(void 0===e)return;const s="object"==typeof(n=e)&&n[this.opts.schemaId];!g.has(i)&&s&&(t=(0,o.resolveUrl)(t,s))}let r;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,o.resolveUrl)(t,n.$ref);r=f.call(this,i,e)}const{schemaId:l}=this.opts;return r=r||new h({schema:n,schemaId:l,root:i,baseId:t}),r.schema!==r.root.schema?r:void 0}},7748:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")};t.default=s},3482:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6184);class s extends Error{constructor(e,t,n){super(n||`can't resolve reference ${t} from id ${e}`),this.missingRef=(0,i.resolveUrl)(e,t),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(this.missingRef))}}t.default=s},6184:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const i=n(530),s=n(8926),r=n(8125),o=n(5858),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&h(e)<=t)};const l=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(l.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(c))return!0;if("object"==typeof n&&c(n))return!0}return!1}function h(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!a.has(n)&&("object"==typeof e[n]&&(0,i.eachItem)(e[n],(e=>t+=h(e))),t===1/0))return 1/0}return t}function u(e="",t){!1!==t&&(e=m(e));return d(o.parse(e))}function d(e){return o.serialize(e).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=d;const p=/#\/?$/;function m(e){return e?e.replace(p,""):""}t.normalizeId=m,t.resolveUrl=function(e,t){return t=m(t),o.resolve(e,t)};const f=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n}=this.opts,i=m(e[n]||t),a={"":i},l=u(i,!1),c={},h=new Set;return r(e,{allKeys:!0},((e,t,i,s)=>{if(void 0===s)return;const r=l+t;let u=a[s];function g(t){if(t=m(u?o.resolve(u,t):t),h.has(t))throw p(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?d(e,n.schema,t):t!==m(r)&&("#"===t[0]?(d(e,c[t],t),c[t]=e):this.refs[t]=r),t}function v(e){if("string"==typeof e){if(!f.test(e))throw new Error(`invalid anchor "${e}"`);g.call(this,`#${e}`)}}"string"==typeof e[n]&&(u=g.call(this,e[n])),v.call(this,e.$anchor),v.call(this,e.$dynamicAnchor),a[t]=u})),c;function d(e,t,n){if(void 0!==t&&!s(e,t))throw p(n)}function p(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},6754:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const n=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&n.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},530:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const i=n(6110),s=n(6657);function r(e,t=e.schema){const{opts:n,self:i}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const s=i.RULES.keywords;for(const n in t)s[n]||m(e,`unknown keyword: "${n}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const n in e)if(t[n])return!0;return!1}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:s}){return(r,o,a,l)=>{const c=void 0===a?o:a instanceof i.Name?(o instanceof i.Name?e(r,o,a):t(r,o,a),a):o instanceof i.Name?(t(r,a,o),o):n(o,a);return l!==i.Name||c instanceof i.Name?c:s(r,c)}}function h(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",i._`{}`);return void 0!==t&&u(e,n,t),n}function u(e,t,n){Object.keys(n).forEach((n=>e.assign(i._`${t}${(0,i.getProperty)(n)}`,!0)))}t.toHash=function(e){const t={};for(const n of e)t[n]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!o(t,e.self.RULES.all))},t.checkUnknownRules=r,t.schemaHasRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,s,r){if(!r){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return i._`${n}`}return i._`${e}${t}${(0,i.getProperty)(s)}`},t.unescapeFragment=function(e){return l(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=l,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>{e.if(i._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,i._`${n} || {}`).code(i._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,i._`${n} || {}`),u(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:h}),items:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,i._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>e.assign(n,!0===t||i._`${n} > ${t} ? ${n} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=h,t.setEvaluated=u;const d={};var p;function m(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:d[t.code]||(d[t.code]=new s._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(p=t.Type||(t.Type={})),t.getErrorPath=function(e,t,n){if(e instanceof i.Name){const s=t===p.Num;return n?s?i._`"[" + ${e} + "]"`:i._`"['" + ${e} + "']"`:s?i._`"/" + ${e}`:i._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=m},7177:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>i(e,t)))}function i(e,t){var n;return void 0!==e[t.keyword]||(null===(n=t.definition.implements)||void 0===n?void 0:n.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},i){const s=t.RULES.types[i];return s&&!0!==s&&n(e,s)},t.shouldUseGroup=n,t.shouldUseRule=i},2971:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const i=n(6257),s=n(6110),r=n(7748),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:s}=e,r={gen:n,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,i.reportError)(r,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:i}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(r.default.data):(t.assign(s._`${i}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:i}=e;!1===i?(n.var(t,!1),a(e)):n.var(t,!0)}},7349:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const i=n(6754),s=n(7177),r=n(6257),o=n(6110),a=n(530);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(i.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l=t.DataType||(t.DataType={})),t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:i,opts:r}=e,a=function(e,t){return t?e.filter((e=>h.has(e)||"array"===t&&"array"===e)):[]}(t,r.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,s.schemaHasRulesForType)(e,t[0]));if(c){const s=d(t,i,r.strictNumbers,l.Wrong);n.if(s,(()=>{a.length?function(e,t,n){const{gen:i,data:s,opts:r}=e,a=i.let("dataType",o._`typeof ${s}`),l=i.let("coerced",o._`undefined`);"array"===r.coerceTypes&&i.if(o._`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,(()=>i.assign(s,o._`${s}[0]`).assign(a,o._`typeof ${s}`).if(d(t,s,r.strictNumbers),(()=>i.assign(l,s)))));i.if(o._`${l} !== undefined`);for(const e of n)(h.has(e)||"array"===e&&"array"===r.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void i.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${s}`).elseIf(o._`${s} === null`).assign(l,o._`""`);case"number":return void i.elseIf(o._`${a} == "boolean" || ${s} === null - || (${a} == "string" && ${s} && ${s} == +${s})`).assign(l,o._`+${s}`);case"integer":return void i.elseIf(o._`${a} === "boolean" || ${s} === null - || (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(l,o._`+${s}`);case"boolean":return void i.elseIf(o._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(l,!1).elseIf(o._`${s} === "true" || ${s} === 1`).assign(l,!0);case"null":return i.elseIf(o._`${s} === "" || ${s} === 0 || ${s} === false`),void i.assign(l,null);case"array":i.elseIf(o._`${a} === "string" || ${a} === "number" - || ${a} === "boolean" || ${s} === null`).assign(l,o._`[${s}]`)}}i.else(),m(e),i.endIf(),i.if(o._`${l} !== undefined`,(()=>{i.assign(s,l),function({gen:e,parentData:t,parentDataProperty:n},i){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,i)))}(e,l)}))}(e,t,a):m(e)}))}return c};const h=new Set(["string","number","integer","boolean","null"]);function u(e,t,n,i=l.Correct){const s=i===l.Correct?o.operators.EQ:o.operators.NEQ;let r;switch(e){case"null":return o._`${t} ${s} null`;case"array":r=o._`Array.isArray(${t})`;break;case"object":r=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":r=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":r=a();break;default:return o._`typeof ${t} ${s} ${e}`}return i===l.Correct?r:(0,o.not)(r);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function d(e,t,n,i){if(1===e.length)return u(e[0],t,n,i);let s;const r=(0,a.toHash)(e);if(r.array&&r.object){const e=o._`typeof ${t} != "object"`;s=r.null?e:o._`!${t} || ${e}`,delete r.null,delete r.array,delete r.object}else s=o.nil;r.number&&delete r.integer;for(const e in r)s=(0,o.and)(s,u(e,t,n,i));return s}t.checkDataType=u,t.checkDataTypes=d;const p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:n,schema:i}=e,s=(0,a.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:n,schema:i.type,schemaCode:s,schemaValue:s,parentSchema:i,params:{},it:e}}(e);(0,r.reportError)(t,p)}t.reportTypeError=m},5944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const i=n(6110),s=n(530);function r(e,t,n){const{gen:r,compositeRule:o,data:a,opts:l}=e;if(void 0===n)return;const c=i._`${a}${(0,i.getProperty)(t)}`;if(o)return void(0,s.checkStrictMode)(e,`default is ignored for: ${c}`);let h=i._`${c} === undefined`;"empty"===l.useDefaults&&(h=i._`${h} || ${c} === null || ${c} === ""`),r.if(h,i._`${c} = ${(0,i.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:i}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(i)&&i.forEach(((t,n)=>r(e,n,t.default)))}},3750:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const i=n(2971),s=n(7349),r=n(7177),o=n(7349),a=n(5944),l=n(2e3),c=n(5678),h=n(6110),u=n(7748),d=n(6184),p=n(530),m=n(6257);function f({gen:e,validateName:t,schema:n,schemaEnv:i,opts:s},r){s.code.es5?e.func(t,h._`${u.default.data}, ${u.default.valCxt}`,i.$async,(()=>{e.code(h._`"use strict"; ${g(n,s)}`),function(e,t){e.if(u.default.valCxt,(()=>{e.var(u.default.instancePath,h._`${u.default.valCxt}.${u.default.instancePath}`),e.var(u.default.parentData,h._`${u.default.valCxt}.${u.default.parentData}`),e.var(u.default.parentDataProperty,h._`${u.default.valCxt}.${u.default.parentDataProperty}`),e.var(u.default.rootData,h._`${u.default.valCxt}.${u.default.rootData}`),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`${u.default.valCxt}.${u.default.dynamicAnchors}`)}),(()=>{e.var(u.default.instancePath,h._`""`),e.var(u.default.parentData,h._`undefined`),e.var(u.default.parentDataProperty,h._`undefined`),e.var(u.default.rootData,u.default.data),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`{}`)}))}(e,s),e.code(r)})):e.func(t,h._`${u.default.data}, ${function(e){return h._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${e.dynamicRef?h._`, ${u.default.dynamicAnchors}={}`:h.nil}}={}`}(s)}`,i.$async,(()=>e.code(g(n,s)).code(r)))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?h._`/*# sourceURL=${n} */`:h.nil}function v(e,t){b(e)&&(x(e),y(e))?function(e,t){const{schema:n,gen:i,opts:s}=e;s.$comment&&n.$comment&&w(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const r=i.const("_errs",u.default.errors);_(e,r),i.var(t,h._`${r} === ${u.default.errors}`)}(e,t):(0,i.boolOrEmptySchema)(e,t)}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function b(e){return"boolean"!=typeof e.schema}function x(e){(0,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:i,self:s}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function _(e,t){if(e.opts.jtd)return S(e,[],!1,t);const n=(0,s.getSchemaTypes)(e.schema);S(e,n,!(0,s.coerceAndCheckDataType)(e,n),t)}function w({gen:e,schemaEnv:t,schema:n,errSchemaPath:i,opts:s}){const r=n.$comment;if(!0===s.$comment)e.code(h._`${u.default.self}.logger.log(${r})`);else if("function"==typeof s.$comment){const n=h.str`${i}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code(h._`${u.default.self}.opts.$comment(${r}, ${n}, ${s}.schema)`)}}function S(e,t,n,i){const{gen:s,schema:a,data:l,allErrors:c,opts:d,self:m}=e,{RULES:f}=m;function g(p){(0,r.shouldUseGroup)(a,p)&&(p.type?(s.if((0,o.checkDataType)(p.type,l,d.strictNumbers)),M(e,p),1===t.length&&t[0]===p.type&&n&&(s.else(),(0,o.reportTypeError)(e)),s.endIf()):M(e,p),c||s.if(h._`${u.default.errors} === ${i||0}`))}!a.$ref||!d.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(d.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{T(e.dataTypes,t)||C(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),e.dataTypes=e.dataTypes.filter((e=>T(t,e)))})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&C(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const i in n){const s=n[i];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:n}=s.definition;n.length&&!n.some((e=>E(t,e)))&&C(e,`missing type "${n.join(",")}" for keyword "${i}"`)}}}(e,e.dataTypes)}(e,t),s.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):s.block((()=>P(e,"$ref",f.all.$ref.definition)))}function M(e,t){const{gen:n,schema:i,opts:{useDefaults:s}}=e;s&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,r.shouldUseRule)(i,n)&&P(e,n.keyword,n.definition,t.type)}))}function E(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function T(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function C(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){b(e)&&(x(e),y(e))?function(e){const{schema:t,opts:n,gen:i}=e;f(e,(()=>{n.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),i.let(u.default.vErrors,null),i.let(u.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",h._`${n}.evaluated`),t.if(h._`${e.evaluated}.dynamicProps`,(()=>t.assign(h._`${e.evaluated}.props`,h._`undefined`))),t.if(h._`${e.evaluated}.dynamicItems`,(()=>t.assign(h._`${e.evaluated}.items`,h._`undefined`)))}(e),_(e),function(e){const{gen:t,schemaEnv:n,validateName:i,ValidationError:s,opts:r}=e;n.$async?t.if(h._`${u.default.errors} === 0`,(()=>t.return(u.default.data)),(()=>t.throw(h._`new ${s}(${u.default.vErrors})`))):(t.assign(h._`${i}.errors`,u.default.vErrors),r.unevaluated&&function({gen:e,evaluated:t,props:n,items:i}){n instanceof h.Name&&e.assign(h._`${t}.props`,n);i instanceof h.Name&&e.assign(h._`${t}.items`,i)}(e),t.return(h._`${u.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,i.topBoolOrEmptySchema)(e)))};class A{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",N(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",u.default.errors))}result(e,t,n){this.failResult((0,h.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,h.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(h._`${t} !== undefined && (${(0,h.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_error(e,t){(e?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=h.nil){this.gen.block((()=>{this.check$data(e,n),t()}))}check$data(e=h.nil,t=h.nil){if(!this.$data)return;const{gen:n,schemaCode:i,schemaType:s,def:r}=this;n.if((0,h.or)(h._`${i} === undefined`,t)),e!==h.nil&&n.assign(e,!0),(s.length||r.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==h.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:n,def:i,it:s}=this;return(0,h.or)(function(){if(n.length){if(!(t instanceof h.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return h._`${(0,o.checkDataTypes)(e,t,s.opts.strictNumbers,o.DataType.Wrong)}`}return h.nil}(),function(){if(i.validateSchema){const n=e.scopeValue("validate$data",{ref:i.validateSchema});return h._`!${n}(${t})`}return h.nil}())}subschema(e,t){const n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);const i={...this.it,...n,items:void 0,props:void 0};return v(i,t),i}mergeEvaluated(e,t){const{it:n,gen:i}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(i,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(i,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:i}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return i.if(t,(()=>this.mergeEvaluated(e,h.Name))),!0}}function P(e,t,n,i){const s=new A(e,n,t);"code"in n?n.code(s,i):s.$data&&n.validate?(0,l.funcKeywordCode)(s,n):"macro"in n?(0,l.macroKeywordCode)(s,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(s,n)}t.KeywordCxt=A;const R=/^\/(?:[^~]|~0|~1)*$/,L=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:n,dataPathArr:i}){let s,r;if(""===e)return u.default.rootData;if("/"===e[0]){if(!R.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,r=u.default.rootData}else{const o=L.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(s=o[2],"#"===s){if(a>=t)throw new Error(l("property/index",a));return i[t-a]}if(a>t)throw new Error(l("data",a));if(r=n[t-a],!s)return r}let o=r;const a=s.split("/");for(const e of a)e&&(r=h._`${r}${(0,h.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=h._`${o} && ${r}`);return o;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=N},2e3:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const i=n(6110),s=n(7748),r=n(7111),o=n(6257);function a(e){const{gen:t,data:n,it:s}=e;t.if(s.parentData,(()=>t.assign(n,i._`${s.parentData}[${s.parentDataProperty}]`)))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,i.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:s,schema:r,parentSchema:o,it:a}=e,c=t.macro.call(a.self,r,o,a),h=l(n,s,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const u=n.name("valid");e.subschema({schema:c,schemaPath:i.nil,errSchemaPath:`${a.errSchemaPath}/${s}`,topSchemaRef:h,compositeRule:!0},u),e.pass(u,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:h,schema:u,parentSchema:d,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const f=!p&&t.compile?t.compile.call(m.self,u,d,m):t.validate,g=l(c,h,f),v=c.let("valid");function y(n=(t.async?i._`await `:i.nil)){const o=m.opts.passContext?s.default.this:s.default.self,a=!("compile"in t&&!p||!1===t.schema);c.assign(v,i._`${n}${(0,r.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var n;c.if((0,i.not)(null!==(n=t.valid)&&void 0!==n?n:v),e)}e.block$data(v,(function(){if(!1===t.errors)y(),t.modifying&&a(e),b((()=>e.error()));else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>y(i._`await `)),(t=>c.assign(v,!1).if(i._`${t} instanceof ${m.ValidationError}`,(()=>c.assign(e,i._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=i._`${g}.errors`;return c.assign(e,null),y(i.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:n}=e;n.if(i._`Array.isArray(${t})`,(()=>{n.assign(s.default.vErrors,i._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`).assign(s.default.errors,i._`${s.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:v)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:i},s,r){if(Array.isArray(s.keyword)?!s.keyword.includes(r):s.keyword!==r)throw new Error("ajv implementation error");const o=s.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${r}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[r])){const e=`keyword "${r}" value is invalid at path "${i}": `+n.errorsText(s.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}}},5678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const i=n(6110),s=n(530);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==r)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const r=e.schema[t];return void 0===n?{schema:r,schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:r[n],schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}${(0,i.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,s.escapeFragment)(n)}`}}if(void 0!==r){if(void 0===o||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:l,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:a,propertyName:l}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:l}=t;h(c.let("data",i._`${t.data}${(0,i.getProperty)(n)}`,!0)),e.errorPath=i.str`${o}${(0,s.getErrorPath)(n,r,l.jsPropertySyntax)}`,e.parentDataProperty=i._`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}if(void 0!==o){h(o instanceof i.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)}function h(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:i,createErrors:s,allErrors:r}){void 0!==i&&(e.compositeRule=i),void 0!==s&&(e.createErrors=s),void 0!==r&&(e.allErrors=r),e.jtdDiscriminator=t,e.jtdMetadata=n}},2206:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var i=n(3750);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return i.KeywordCxt}});var s=n(6110);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return s.CodeGen}});const r=n(7939),o=n(3482),a=n(6754),l=n(9336),c=n(6110),h=n(6184),u=n(7349),d=n(530),p=n(338),m=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function y(e){var t,n,i,s,r,o,a,l,c,h,u,d,p,m,f,g,v,y,b,x,_,w;const S=e.strict,M=null===(t=e.code)||void 0===t?void 0:t.optimize,E=!0===M||void 0===M?1:M||0;return{strictSchema:null===(i=null!==(n=e.strictSchema)&&void 0!==n?n:S)||void 0===i||i,strictNumbers:null===(r=null!==(s=e.strictNumbers)&&void 0!==s?s:S)||void 0===r||r,strictTypes:null!==(a=null!==(o=e.strictTypes)&&void 0!==o?o:S)&&void 0!==a?a:"log",strictTuples:null!==(c=null!==(l=e.strictTuples)&&void 0!==l?l:S)&&void 0!==c?c:"log",strictRequired:null!==(u=null!==(h=e.strictRequired)&&void 0!==h?h:S)&&void 0!==u&&u,code:e.code?{...e.code,optimize:E}:{optimize:E},loopRequired:null!==(d=e.loopRequired)&&void 0!==d?d:200,loopEnum:null!==(p=e.loopEnum)&&void 0!==p?p:200,meta:null===(m=e.meta)||void 0===m||m,messages:null===(f=e.messages)||void 0===f||f,inlineRefs:null===(g=e.inlineRefs)||void 0===g||g,schemaId:null!==(v=e.schemaId)&&void 0!==v?v:"$id",addUsedSchema:null===(y=e.addUsedSchema)||void 0===y||y,validateSchema:null===(b=e.validateSchema)||void 0===b||b,validateFormats:null===(x=e.validateFormats)||void 0===x||x,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(w=e.int32range)||void 0===w||w}}class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...y(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:f,es5:t,lines:n}),this.logger=function(e){if(!1===e)return T;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),x.call(this,g,e,"NOT SUPPORTED"),x.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=E.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&M.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let i=p;"id"===n&&(i={...p},i.id=i.$id,delete i.$id),t&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let n;if("string"==typeof e){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);const i=n(t);return"$async"in n||(this.errors=n.errors),i}compile(e,t){const n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:n}=this.opts;return i.call(this,e,t);async function i(e,t){await s.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||r.call(this,n)}async function s(e){e&&!this.getSchema(e)&&await i.call(this,{$ref:e},!0)}async function r(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),r.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){const n=await c.call(this,e);this.refs[e]||await s.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,i);return this}let s;if("object"==typeof e){const{schemaId:t}=this.opts;if(s=e[t],void 0!==s&&"string"!=typeof s)throw new Error(`schema ${t} must be string`)}return t=(0,h.normalizeId)(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,i,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let n;if(n=e.$schema,void 0!==n&&"string"!=typeof n)throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(n,e);if(!i&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return i}getSchema(e){let t;for(;"string"==typeof(t=_.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,i=new l.SchemaEnv({schema:{},schemaId:n});if(t=l.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=_.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,h.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(A.call(this,n,t),!t)return(0,d.eachItem)(n,(e=>P.call(this,e))),this;L.call(this,t);const i={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,0===i.type.length?e=>P.call(this,e,i):e=>i.type.forEach((t=>P.call(this,e,i,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const n of t.rules){const t=n.rules.findIndex((t=>t.keyword===e));t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){return e&&0!==e.length?e.map((e=>`${n}${e.instancePath} ${e.message}`)).reduce(((e,n)=>e+t+n)):"No errors"}$dataMetaSchema(e,t){const n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const i of t){const t=i.split("/").slice(1);let s=e;for(const e of t)s=s[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:i}=t.definition,r=s[e];i&&r&&(s[e]=D(r))}}return e}_removeAllSchemas(e,t){for(const n in e){const i=e[n];t&&!t.test(n)||("string"==typeof i?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,t,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let r;const{schemaId:o}=this.opts;if("object"==typeof e)r=e[o];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;n=(0,h.normalizeId)(r||n);const c=h.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),i&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function x(e,t,n,i="error"){for(const s in e){const r=s;r in t&&this.logger[i](`${n}: option ${s}. ${e[r]}`)}}function _(e){return e=(0,h.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function M(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}}function E(){const e={...this.opts};for(const t of m)delete e[t];return e}t.default=b,b.ValidationError=r.default,b.MissingRefError=o.default;const T={log(){},warn(){},error(){}};const C=/^[a-z_$][a-z0-9_$:-]*$/i;function A(e,t){const{RULES:n}=this;if((0,d.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!C.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function P(e,t,n){var i;const s=null==t?void 0:t.post;if(n&&s)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:r}=this;let o=s?r.post:r.rules.find((({type:e})=>e===n));if(o||(o={type:n,rules:[]},r.rules.push(o)),r.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?R.call(this,o,a,t.before):o.rules.push(a),r.all[e]=a,null===(i=t.implements)||void 0===i||i.forEach((e=>this.addKeyword(e)))}function R(e,t,n){const i=e.rules.findIndex((e=>e.keyword===n));i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function L(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=D(t)),e.validateSchema=this.compile(t,!0))}const N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D(e){return{anyOf:[e,N]}}},8062:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8926);i.code='require("ajv/dist/runtime/equal").default',t.default=i},5842:(e,t)=>{"use strict";function n(e){const t=e.length;let n,i=0,s=0;for(;s=55296&&n<=56319&&s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=n},1600:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const i=n(6110),s=n(530),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:i}=t;Array.isArray(i)?o(e,i):(0,s.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:r,data:o,keyword:a,it:l}=e;l.items=!0;const c=n.const("len",i._`${o}.length`);if(!1===r)e.setParams({len:t.length}),e.pass(i._`${c} <= ${t.length}`);else if("object"==typeof r&&!(0,s.alwaysValidSchema)(l,r)){const r=n.var("valid",i._`${c} <= ${t.length}`);n.if((0,i.not)(r),(()=>function(r){n.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:s.Type.Num},r),l.allErrors||n.if((0,i.not)(r),(()=>n.break()))}))}(r))),e.ok(r)}}t.validateAdditionalItems=o,t.default=r},8183:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r=n(7748),o=n(530),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>s._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:l,errsCount:c,it:h}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:u,opts:d}=h;if(h.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(h,n))return;const p=(0,i.allSchemaProperties)(a.properties),m=(0,i.allSchemaProperties)(a.patternProperties);function f(e){t.code(s._`delete ${l}[${e}]`)}function g(i){if("all"===d.removeAdditional||d.removeAdditional&&!1===n)f(i);else{if(!1===n)return e.setParams({additionalProperty:i}),e.error(),void(u||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(h,n)){const n=t.name("valid");"failing"===d.removeAdditional?(v(i,n,!1),t.if((0,s.not)(n),(()=>{e.reset(),f(i)}))):(v(i,n),u||t.if((0,s.not)(n),(()=>t.break())))}}}function v(t,n,i){const s={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===i&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(s,n)}t.forIn("key",l,(n=>{p.length||m.length?t.if(function(n){let r;if(p.length>8){const e=(0,o.schemaRefOrVal)(h,a.properties,"properties");r=(0,i.isOwnProperty)(t,e,n)}else r=p.length?(0,s.or)(...p.map((e=>s._`${n} === ${e}`))):s.nil;return m.length&&(r=(0,s.or)(r,...m.map((t=>s._`${(0,i.usePattern)(e,t)}.test(${n})`)))),(0,s.not)(r)}(n),(()=>g(n))):g(n)})),e.ok(s._`${c} === ${r.default.errors}`)}};t.default=a},8302:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(530),s={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:s}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const r=t.name("valid");n.forEach(((t,n)=>{if((0,i.alwaysValidSchema)(s,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},r);e.ok(r),e.mergeEvaluated(o)}))}};t.default=s},120:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(7111).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=i},7458:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?i.str`must contain at least ${e} valid item(s)`:i.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?i._`{minContains: ${e}}`:i._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:a}=e;let l,c;const{minContains:h,maxContains:u}=r;a.opts.next?(l=void 0===h?1:h,c=u):l=1;const d=t.const("len",i._`${o}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,s.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,s.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,s.alwaysValidSchema)(a,n)){let t=i._`${d} >= ${l}`;return void 0!==c&&(t=i._`${t} && ${d} <= ${c}`),void e.pass(t)}a.items=!0;const p=t.name("valid");function m(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(i._`${e}++`),void 0===c?t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0).break())):(t.if(i._`${e} > ${c}`,(()=>t.assign(p,!1).break())),1===l?t.assign(p,!0):t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,i){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:s.Type.Num,compositeRule:!0},n),i()}))}void 0===c&&1===l?f(p,(()=>t.if(p,(()=>t.break())))):(t.let(p,!1),0===l?t.if(i._`${o}.length > 0`,m,(()=>t.assign(p,!0))):m()),e.result(p,(()=>e.reset()))}};t.default=r},2790:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const i=n(6110),s=n(530),r=n(7111);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const s=1===t?"property":"properties";return i.str`must have ${s} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:s}})=>i._`{property: ${e}, - missingProperty: ${s}, - depsCount: ${t}, - deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const i in e){if("__proto__"===i)continue;(Array.isArray(e[i])?t:n)[i]=e[i]}return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:s,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const h=(0,r.propertyInData)(n,s,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?n.if(h,(()=>{for(const t of c)(0,r.checkReportMissingProp)(e,t)})):(n.if(i._`${h} && (${(0,r.checkMissingProp)(e,c,a)})`),(0,r.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:i,keyword:o,it:a}=e,l=n.name("valid");for(const c in t)(0,s.alwaysValidSchema)(a,t[c])||(n.if((0,r.propertyInData)(n,i,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},7498:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>i.str`must match "${e.ifClause}" schema`,params:({params:e})=>i._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:r}=e;void 0===n.then&&void 0===n.else&&(0,s.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const a=o(r,"then"),l=o(r,"else");if(!a&&!l)return;const c=t.let("valid",!0),h=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(h,u("then",n),u("else",n))}else a?t.if(h,u("then")):t.if((0,i.not)(h),u("else"));function u(n,s){return()=>{const r=e.subschema({keyword:n},h);t.assign(c,h),e.mergeValidEvaluated(r,c),s?t.assign(s,i._`${n}`):e.setParams({ifClause:n})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,s.alwaysValidSchema)(e,n)}t.default=r},3698:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1600),s=n(3609),r=n(8223),o=n(2490),a=n(7458),l=n(2790),c=n(3796),h=n(8183),u=n(1935),d=n(8289),p=n(2514),m=n(120),f=n(6328),g=n(8302),v=n(7498),y=n(6105);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,v.default,y.default,c.default,h.default,l.default,u.default,d.default];return e?t.push(s.default,o.default):t.push(i.default,r.default),t.push(a.default),t}},8223:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const i=n(6110),s=n(530),r=n(7111),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,s.alwaysValidSchema)(n,t)||e.ok((0,r.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:r,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:i,errSchemaPath:r}=c,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(i.strictTuples&&!a){const e=`"${l}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${r}"`;(0,s.checkStrictMode)(c,e,i.strictTuples)}}(o),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=s.mergeEvaluated.items(r,n.length,c.items));const h=r.name("valid"),u=r.const("len",i._`${a}.length`);n.forEach(((t,n)=>{(0,s.alwaysValidSchema)(c,t)||(r.if(i._`${u} > ${n}`,(()=>e.subschema({keyword:l,schemaProp:n,dataProp:n},h))),e.ok(h))}))}t.validateTuple=a,t.default=o},2490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(7111),o=n(1600),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:i}=e,{prefixItems:a}=n;i.items=!0,(0,s.alwaysValidSchema)(i,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,r.validateArray)(e)))}};t.default=a},2514:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(530),s={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:s}=e;if((0,i.alwaysValidSchema)(s,n))return void e.fail();const r=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),e.failResult(r,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=s},6328:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>i._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const a=n,l=t.let("valid",!1),c=t.let("passing",null),h=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((n,r)=>{let a;(0,s.alwaysValidSchema)(o,n)?t.var(h,!0):a=e.subschema({keyword:"oneOf",schemaProp:r,compositeRule:!0},h),r>0&&t.if(i._`${h} && ${l}`).assign(l,!1).assign(c,i._`[${c}, ${r}]`).else(),t.if(h,(()=>{t.assign(l,!0),t.assign(c,r),a&&e.mergeEvaluated(a,i.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=r},8289:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r=n(530),o=n(530),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:l,it:c}=e,{opts:h}=c,u=(0,i.allSchemaProperties)(n),d=u.filter((e=>(0,r.alwaysValidSchema)(c,n[e])));if(0===u.length||d.length===u.length&&(!c.opts.unevaluated||!0===c.props))return;const p=h.strictSchema&&!h.allowMatchingProperties&&l.properties,m=t.name("valid");!0===c.props||c.props instanceof s.Name||(c.props=(0,o.evaluatedPropsToName)(t,c.props));const{props:f}=c;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(n){t.forIn("key",a,(r=>{t.if(s._`${(0,i.usePattern)(e,n)}.test(${r})`,(()=>{const i=d.includes(n);i||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:r,dataPropType:o.Type.Str},m),c.opts.unevaluated&&!0!==f?t.assign(s._`${f}[${r}]`,!0):i||c.allErrors||t.if((0,s.not)(m),(()=>t.break()))}))}))}!function(){for(const e of u)p&&g(e),c.allErrors?v(e):(t.var(m,!0),v(e),t.if(m))}()}};t.default=a},3609:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8223),s={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,i.validateTuple)(e,"items")};t.default=s},1935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3750),s=n(7111),r=n(530),o=n(8183),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new i.KeywordCxt(c,o.default,"additionalProperties"));const h=(0,s.allSchemaProperties)(n);for(const e of h)c.definedProperties.add(e);c.opts.unevaluated&&h.length&&!0!==c.props&&(c.props=r.mergeEvaluated.props(t,(0,r.toHash)(h),c.props));const u=h.filter((e=>!(0,r.alwaysValidSchema)(c,n[e])));if(0===u.length)return;const d=t.name("valid");for(const n of u)p(n)?m(n):(t.if((0,s.propertyInData)(t,l,n,c.opts.ownProperties)),m(n),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(d);function p(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},3796:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>i._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,s.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",r,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,i.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=r},6105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(530),s={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,i.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=s},7111:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const i=n(6110),s=n(530),r=n(7748);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:i._`Object.prototype.hasOwnProperty`})}function a(e,t,n){return i._`${o(e)}.call(${t}, ${n})`}function l(e,t,n,s){const r=i._`${t}${(0,i.getProperty)(n)} === undefined`;return s?(0,i.or)(r,(0,i.not)(a(e,t,n))):r}function c(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:s,it:r}=e;n.if(l(n,s,t,r.opts.ownProperties),(()=>{e.setParams({missingProperty:i._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},s,r){return(0,i.or)(...s.map((s=>(0,i.and)(l(e,t,s,n.ownProperties),i._`${r} = ${s}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=a,t.propertyInData=function(e,t,n,s){const r=i._`${t}${(0,i.getProperty)(n)} !== undefined`;return s?i._`${r} && ${a(e,t,n)}`:r},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(e,t){return c(t).filter((n=>!(0,s.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:s,schemaPath:o,errorPath:a},it:l},c,h,u){const d=u?i._`${e}, ${t}, ${s}${o}`:t,p=[[r.default.instancePath,(0,i.strConcat)(r.default.instancePath,a)],[r.default.parentData,l.parentData],[r.default.parentDataProperty,l.parentDataProperty],[r.default.rootData,r.default.rootData]];l.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const m=i._`${d}, ${n.object(...p)}`;return h!==i.nil?i._`${c}.call(${h}, ${m})`:i._`${c}(${m})`},t.usePattern=function({gen:e,it:{opts:t}},n){const s=t.unicodeRegExp?"u":"";return e.scopeValue("pattern",{key:n,ref:new RegExp(n,s),code:i._`new RegExp(${n}, ${s})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:r,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return l((()=>t.assign(e,!1))),e}return t.var(a,!0),l((()=>t.break())),a;function l(o){const l=t.const("len",i._`${n}.length`);t.forRange("i",0,l,(n=>{e.subschema({keyword:r,dataProp:n,dataPropType:s.Type.Num},a),t.if((0,i.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,s.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>n.forEach(((n,s)=>{const o=e.subschema({keyword:r,schemaProp:s,compositeRule:!0},l);t.assign(a,i._`${a} || ${l}`);e.mergeValidEvaluated(o,l)||t.if((0,i.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},4874:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},9730:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4874),s=n(5403),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",i.default,s.default];t.default=r},5403:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const i=n(3482),s=n(7111),r=n(6110),o=n(7748),a=n(9336),l=n(530),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:s}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:p}=s,{root:m}=l;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(l===m)return u(e,c,l,l.$async);const n=t.scopeValue("root",{ref:m});return u(e,r._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new i.default(o,n);return f instanceof a.SchemaEnv?function(t){const n=h(e,t);u(e,n,t,t.$async)}(f):function(i){const s=t.scopeValue("schema",!0===d.code.source?{ref:i,code:(0,r.stringify)(i)}:{ref:i}),o=t.name("valid"),a=e.subschema({schema:i,dataTypes:[],schemaPath:r.nil,topSchemaRef:s,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function h(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function u(e,t,n,i){const{gen:a,it:c}=e,{allErrors:h,schemaEnv:u,opts:d}=c,p=d.passContext?o.default.this:r.nil;function m(e){const t=r._`${e}.errors`;a.assign(o.default.vErrors,r._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,r._`${o.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;const i=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(i&&!i.dynamicProps)void 0!==i.props&&(c.props=l.mergeEvaluated.props(a,i.props,c.props));else{const t=a.var("props",r._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,r.Name)}if(!0!==c.items)if(i&&!i.dynamicItems)void 0!==i.items&&(c.items=l.mergeEvaluated.items(a,i.items,c.items));else{const t=a.var("items",r._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,r.Name)}}i?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(r._`await ${(0,s.callValidateCode)(e,t,p)}`),f(t),h||a.assign(n,!0)}),(e=>{a.if(r._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),m(e),h||a.assign(n,!1)})),e.ok(n)}():e.result((0,s.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=h,t.callRef=u,t.default=c},3348:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(2997),r={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===s.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>i._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:a}=e,{oneOf:l}=o;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");const c=r.propertyName;if("string"!=typeof c)throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const h=t.let("valid",!1),u=t.const("tag",i._`${n}${(0,i.getProperty)(c)}`);function d(n){const s=t.name("valid"),r=e.subschema({keyword:"oneOf",schemaProp:n},s);return e.mergeEvaluated(r,i.Name),s}t.if(i._`typeof ${u} == "string"`,(()=>function(){const n=function(){var e;const t={},n=s(o);let i=!0;for(let t=0;te.error(!1,{discrError:s.DiscrError.Tag,tag:u,tagName:c}))),e.ok(h)}};t.default=r},2997:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(t.DiscrError||(t.DiscrError={}))},610:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9730),s=n(6020),r=n(3698),o=n(5036),a=n(9275),l=[i.default,s.default,(0,r.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},8997:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match format "${e}"`,params:({schemaCode:e})=>i._`{format: ${e}}`},code(e,t){const{gen:n,data:s,$data:r,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:h,schemaEnv:u,self:d}=l;c.validateFormats&&(r?function(){const r=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=n.const("fDef",i._`${r}[${a}]`),l=n.let("fType"),h=n.let("format");n.if(i._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(l,i._`${o}.type || "string"`).assign(h,i._`${o}.validate`)),(()=>n.assign(l,i._`"string"`).assign(h,o))),e.fail$data((0,i.or)(!1===c.strictSchema?i.nil:i._`${a} && !${h}`,function(){const e=u.$async?i._`(${o}.async ? await ${h}(${s}) : ${h}(${s}))`:i._`${h}(${s})`,n=i._`(typeof ${h} == "function" ? ${e} : ${h}.test(${s}))`;return i._`${h} && ${h} !== true && ${l} === ${t} && !${n}`}()))}():function(){const r=d.formats[o];if(!r)return void function(){if(!1===c.strictSchema)return void d.logger.warn(e());throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${h}"`}}();if(!0===r)return;const[a,l,p]=function(e){const t=e instanceof RegExp?(0,i.regexpCode)(e):c.code.formats?i._`${c.code.formats}${(0,i.getProperty)(o)}`:void 0,s=n.scopeValue("formats",{key:o,ref:e,code:t});if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,i._`${s}.validate`];return["string",e,s]}(r);a===t&&e.pass(function(){if("object"==typeof r&&!(r instanceof RegExp)&&r.async){if(!u.$async)throw new Error("async format in sync schema");return i._`await ${p}(${s})`}return"function"==typeof l?i._`${p}(${s})`:i._`${p}.test(${s})`}())}())}};t.default=s},5036:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=[n(8997).default];t.default=i},9275:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},3103:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(8062),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>i._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(i._`!${(0,s.useFunc)(t,r.default)}(${n}, ${a})`):e.fail(i._`${l} !== ${n}`)}};t.default=o},3139:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(8062),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>i._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const h=a.length>=c.opts.loopEnum,u=(0,s.useFunc)(t,r.default);let d;if(h||o)d=t.let("valid"),e.block$data(d,(function(){t.assign(d,!1),t.forOf("v",l,(e=>t.if(i._`${u}(${n}, ${e})`,(()=>t.assign(d,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);d=(0,i.or)(...a.map(((t,s)=>function(e,t){const s=a[t];return"object"==typeof s&&null!==s?i._`${u}(${n}, ${e}[${t}])`:i._`${n} === ${s}`}(e,s))))}e.pass(d)}};t.default=o},6020:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(897),s=n(5162),r=n(4905),o=n(2508),a=n(82),l=n(6846),c=n(7569),h=n(5640),u=n(3103),d=n(3139),p=[i.default,s.default,r.default,o.default,a.default,l.default,c.default,h.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];t.default=p},7569:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:s}=e,r="maxItems"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`${n}.length ${r} ${s}`)}};t.default=s},4905:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=n(530),r=n(5842),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,l="maxLength"===t?i.operators.GT:i.operators.LT,c=!1===a.opts.unicode?i._`${n}.length`:i._`${(0,s.useFunc)(e.gen,r.default)}(${n})`;e.fail$data(i._`${c} ${l} ${o}`)}};t.default=o},897:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s=i.operators,r={maximum:{okStr:"<=",ok:s.LTE,fail:s.GT},minimum:{okStr:">=",ok:s.GTE,fail:s.LT},exclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},exclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}},o={message:({keyword:e,schemaCode:t})=>i.str`must be ${r[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{comparison: ${r[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:n,schemaCode:s}=e;e.fail$data(i._`${n} ${r[t].fail} ${s} || isNaN(${n})`)}};t.default=a},82:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:s}=e,r="maxProperties"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`Object.keys(${n}).length ${r} ${s}`)}};t.default=s},5162:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6110),s={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>i.str`must be multiple of ${e}`,params:({schemaCode:e})=>i._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:s,it:r}=e,o=r.opts.multipleOfPrecision,a=t.let("res"),l=o?i._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:i._`${a} !== parseInt(${a})`;e.fail$data(i._`(${s} === 0 || (${a} = ${n}/${s}, ${l}))`)}};t.default=s},2508:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>s.str`must match pattern "${e}"`,params:({schemaCode:e})=>s._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:r,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?s._`(new RegExp(${o}, ${l}))`:(0,i.usePattern)(e,r);e.fail$data(s._`!${c}.test(${t})`)}};t.default=r},6846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7111),s=n(6110),r=n(530),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>s.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>s._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:l,it:c}=e,{opts:h}=c;if(!l&&0===n.length)return;const u=n.length>=h.loopRequired;if(c.allErrors?function(){if(u||l)e.block$data(s.nil,d);else for(const t of n)(0,i.checkReportMissingProp)(e,t)}():function(){const r=t.let("missing");if(u||l){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,r){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(r,(0,i.propertyInData)(t,a,n,h.ownProperties)),t.if((0,s.not)(r),(()=>{e.error(),t.break()}))}),s.nil)}(r,n))),e.ok(n)}else t.if((0,i.checkMissingProp)(e,n,r)),(0,i.reportMissingProp)(e,r),t.else()}(),h.strictRequired){const t=e.parentSchema.properties,{definedProperties:i}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!i.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(c,t,c.opts.strictRequired)}}function d(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,i.noPropertyInData)(t,a,n,h.ownProperties),(()=>e.error()))}))}}};t.default=o},5640:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7349),s=n(6110),r=n(530),o=n(8062),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>s.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>s._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:l,parentSchema:c,schemaCode:h,it:u}=e;if(!a&&!l)return;const d=t.let("valid"),p=c.items?(0,i.getSchemaTypes)(c.items):[];function m(r,o){const a=t.name("item"),l=(0,i.checkDataTypes)(p,a,u.opts.strictNumbers,i.DataType.Wrong),c=t.const("indices",s._`{}`);t.for(s._`;${r}--;`,(()=>{t.let(a,s._`${n}[${r}]`),t.if(l,s._`continue`),p.length>1&&t.if(s._`typeof ${a} == "string"`,s._`${a} += "_"`),t.if(s._`typeof ${c}[${a}] == "number"`,(()=>{t.assign(o,s._`${c}[${a}]`),e.error(),t.assign(d,!1).break()})).code(s._`${c}[${a}] = ${r}`)}))}function f(i,a){const l=(0,r.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(s._`;${i}--;`,(()=>t.for(s._`${a} = ${i}; ${a}--;`,(()=>t.if(s._`${l}(${n}[${i}], ${n}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const i=t.let("i",s._`${n}.length`),r=t.let("j");e.setParams({i,j:r}),t.assign(d,!0),t.if(s._`${i} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(i,r)))}),s._`${h} === false`),e.ok(d)}};t.default=a},9981:e=>{var t=Object.prototype.toString;e.exports=function(e){return e.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===t.call(e.buffer)||Array.isArray(e)}},1512:e=>{e.exports=function(e,t){return"number"==typeof e?e:"number"==typeof t?t:0}},984:e=>{e.exports=function(e){switch(e){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},8926:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,s,r;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(s=i;0!=s--;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(r=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(s=i;0!=s--;)if(!Object.prototype.hasOwnProperty.call(n,r[s]))return!1;for(s=i;0!=s--;){var o=r[s];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9105:e=>{"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},6186:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},8125:e=>{"use strict";var t=e.exports=function(e,t,i){"function"==typeof t&&(i=t,t={}),n(t,"function"==typeof(i=t.cb||i)?i:i.pre||function(){},i.post||function(){},e,"",e)};function n(e,i,s,r,o,a,l,c,h,u){if(r&&"object"==typeof r&&!Array.isArray(r)){for(var d in i(r,o,a,l,c,h,u),r){var p=r[d];if(Array.isArray(p)){if(d in t.arrayKeywords)for(var m=0;m{var i=n(1516),s=n(139),r=n(1512),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function u(e){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(e)}function d(e){return new Function(["return function "+e+"() {"," return this._"+e,"}"].join("\n"))()}function p(e,t){if(!e.chars||0===e.chars.length)return null;var n=f(e.chars,t);return n>=0?e.chars[n]:null}function m(e,t,n){if(!e.kernings||0===e.kernings.length)return 0;for(var i=e.kernings,s=0;s=0)return e.chars[i].height}return 0}(a),this._capHeight=function(e){for(var t=0;t=0)return e.chars[i].height}return 0}(a),this._lineHeight=g,this._ascender=g-y-this._xHeight;var w=this;c.forEach((function(e,i){for(var s,r=e.start,o=e.end,l=e.width,c=r;c=0)return e.chars[i]}return 0}(e)||e.chars[0],n=this._opt.tabSize*t.xadvance;this._fallbackSpaceGlyph=t,this._fallbackTabGlyph=s(t,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(e,t){var n=p(e,t);return n||(t===c?this._fallbackTabGlyph:t===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(e,t,n,i){var s,r=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:t,end:t,width:0};n=Math.min(e.length,n);for(var h=t;h=i||p>=i)break;a=p,l=f,s=u}c++}return s&&(l+=s.xoffset),{start:t,end:t+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(e){Object.defineProperty(u.prototype,e,{get:d(e),configurable:!0})}))},4439:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,r){for(var o,a,l=s(e),c=1;c{var i=n(984),s=n(9981),r=n(6186),o=[0,2,3],a=[2,1,3];e.exports=function(e,t){e&&(s(e)||r(e))||(t=e||{},e=null);for(var n="string"==typeof(t="number"==typeof t?{count:t}:t||{}).type?t.type:"uint16",l="number"==typeof t.count?t.count:1,c=t.start||0,h=!1!==t.clockwise?o:a,u=h[0],d=h[1],p=h[2],m=6*l,f=e||new(i(n))(m),g=0,v=0;g{var t={min:[0,0],max:[0,0]};function n(e){var n=e.length/2;t.min[0]=e[0],t.min[1]=e[1],t.max[0]=e[0],t.max[1]=e[1];for(var i=0;i{e.exports.pages=function(e){var t=new Float32Array(4*e.length*1),n=0;return e.forEach((function(e){var i=e.data.page||0;t[n++]=i,t[n++]=i,t[n++]=i,t[n++]=i})),t},e.exports.uvs=function(e,t,n,i){var s=new Float32Array(4*e.length*2),r=0;return e.forEach((function(e){var o=e.data,a=o.x+o.width,l=o.y+o.height,c=o.x/t,h=o.y/n,u=a/t,d=l/n;i&&(h=(n-o.y)/n,d=(n-l)/n),s[r++]=c,s[r++]=h,s[r++]=c,s[r++]=d,s[r++]=u,s[r++]=d,s[r++]=u,s[r++]=h})),s},e.exports.positions=function(e){var t=new Float32Array(4*e.length*2),n=0;return e.forEach((function(e){var i=e.data,s=e.position[0]+i.xoffset,r=e.position[1]+i.yoffset,o=i.width,a=i.height;t[n++]=s,t[n++]=r,t[n++]=s,t[n++]=r+a,t[n++]=s+o,t[n++]=r+a,t[n++]=s+o,t[n++]=r})),t}},5858:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),n=0;n1){t[0]=t[0].slice(0,-1);for(var i=t.length-1,s=1;s= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=p-m,T=Math.floor,C=String.fromCharCode;function A(e){throw new RangeError(M[e])}function P(e,t){for(var n=[],i=e.length;i--;)n[i]=t(e[i]);return n}function R(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+P((e=e.replace(S,".")).split("."),t).join(".")}function L(e){for(var t=[],n=0,i=e.length;n=55296&&s<=56319&&n>1,e+=T(e/t);e>E*f>>1;i+=p)e=T(e/E);return T(i+(E+1)*e/(e+g))},I=function(e){var t=[],n=e.length,i=0,s=b,r=y,o=e.lastIndexOf(x);o<0&&(o=0);for(var a=0;a=128&&A("not-basic"),t.push(e.charCodeAt(a));for(var l=o>0?o+1:0;l=n&&A("invalid-input");var g=N(e.charCodeAt(l++));(g>=p||g>T((d-i)/h))&&A("overflow"),i+=g*h;var v=u<=r?m:u>=r+f?f:u-r;if(gT(d/_)&&A("overflow"),h*=_}var w=t.length+1;r=O(i-c,w,0==c),T(i/w)>d-s&&A("overflow"),s+=T(i/w),i%=w,t.splice(i++,0,s)}return String.fromCodePoint.apply(String,t)},k=function(e){var t=[],n=(e=L(e)).length,i=b,s=0,r=y,o=!0,a=!1,l=void 0;try{for(var c,h=e[Symbol.iterator]();!(o=(c=h.next()).done);o=!0){var u=c.value;u<128&&t.push(C(u))}}catch(e){a=!0,l=e}finally{try{!o&&h.return&&h.return()}finally{if(a)throw l}}var g=t.length,v=g;for(g&&t.push(x);v=i&&R<_&&(_=R)}}catch(e){S=!0,M=e}finally{try{!w&&P.return&&P.return()}finally{if(S)throw M}}var N=v+1;_-i>T((d-s)/N)&&A("overflow"),s+=(_-i)*N,i=_;var I=!0,k=!1,z=void 0;try{for(var U,V=e[Symbol.iterator]();!(I=(U=V.next()).done);I=!0){var F=U.value;if(Fd&&A("overflow"),F==i){for(var B=s,j=p;;j+=p){var $=j<=r?m:j>=r+f?f:j-r;if(B<$)break;var H=B-$,G=p-$;t.push(C(D($+H%G,0))),B=T(H/G)}t.push(C(D(B,0))),r=O(s,N,v==g),s=0,++v}}}catch(e){k=!0,z=e}finally{try{!I&&V.return&&V.return()}finally{if(k)throw z}}++s,++i}return t.join("")},z=function(e){return R(e,(function(e){return _.test(e)?I(e.slice(4).toLowerCase()):e}))},U=function(e){return R(e,(function(e){return w.test(e)?"xn--"+k(e):e}))},V={version:"2.1.0",ucs2:{decode:L,encode:function(e){return String.fromCodePoint.apply(String,u(e))}},decode:I,encode:k,toASCII:U,toUnicode:z},F={};function B(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function j(e){for(var t="",n=0,i=e.length;n=194&&s<224){if(i-n>=6){var r=parseInt(e.substr(n+4,2),16);t+=String.fromCharCode((31&s)<<6|63&r)}else t+=e.substr(n,6);n+=6}else if(s>=224){if(i-n>=9){var o=parseInt(e.substr(n+4,2),16),a=parseInt(e.substr(n+7,2),16);t+=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a)}else t+=e.substr(n,9);n+=9}else t+=e.substr(n,3),n+=3}return t}function $(e,t){function n(e){var n=j(e);return n.match(t.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,n).replace(t.NOT_USERINFO,B).replace(t.PCT_ENCODED,s)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_HOST,B).replace(t.PCT_ENCODED,s)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,n).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,B).replace(t.PCT_ENCODED,s)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,n).replace(t.NOT_QUERY,B).replace(t.PCT_ENCODED,s)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,n).replace(t.NOT_FRAGMENT,B).replace(t.PCT_ENCODED,s)),e}function H(e){return e.replace(/^0*(.*)/,"$1")||"0"}function G(e,t){var n=e.match(t.IPV4ADDRESS)||[],i=h(n,2)[1];return i?i.split(".").map(H).join("."):e}function W(e,t){var n=e.match(t.IPV6ADDRESS)||[],i=h(n,3),s=i[1],r=i[2];if(s){for(var o=s.toLowerCase().split("::").reverse(),a=h(o,2),l=a[0],c=a[1],u=c?c.split(":").map(H):[],d=l.split(":").map(H),p=t.IPV4ADDRESS.test(d[d.length-1]),m=p?7:8,f=d.length-m,g=Array(m),v=0;v1){var x=g.slice(0,y.index),_=g.slice(y.index+y.length);b=x.join(":")+"::"+_.join(":")}else b=g.join(":");return r&&(b+="%"+r),b}return e}var q=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,X=void 0==="".match(/(){0}/)[1];function Y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},i=!1!==t.iri?c:l;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var s=e.match(q);if(s){X?(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5])):(n.scheme=s[1]||void 0,n.userinfo=-1!==e.indexOf("@")?s[3]:void 0,n.host=-1!==e.indexOf("//")?s[4]:void 0,n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=-1!==e.indexOf("?")?s[7]:void 0,n.fragment=-1!==e.indexOf("#")?s[8]:void 0,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?s[4]:void 0)),n.host&&(n.host=W(G(n.host,i),i)),void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||n.path||void 0!==n.query?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==n.reference&&(n.error=n.error||"URI is not a "+t.reference+" reference.");var r=F[(t.scheme||n.scheme||"").toLowerCase()];if(t.unicodeSupport||r&&r.unicodeSupport)$(n,i);else{if(n.host&&(t.domainHost||r&&r.domainHost))try{n.host=V.toASCII(n.host.replace(i.PCT_ENCODED,j).toLowerCase())}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+e}$(n,l)}r&&r.parse&&r.parse(n,t)}else n.error=n.error||"URI can not be parsed.";return n}function K(e,t){var n=!1!==t.iri?c:l,i=[];return void 0!==e.userinfo&&(i.push(e.userinfo),i.push("@")),void 0!==e.host&&i.push(W(G(String(e.host),n),n).replace(n.IPV6ADDRESS,(function(e,t,n){return"["+t+(n?"%25"+n:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(i.push(":"),i.push(String(e.port))),i.length?i.join(""):void 0}var J=/^\.\.?\//,Z=/^\/\.(\/|$)/,Q=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(J))e=e.replace(J,"");else if(e.match(Z))e=e.replace(Z,"/");else if(e.match(Q))e=e.replace(Q,"/"),t.pop();else if("."===e||".."===e)e="";else{var n=e.match(ee);if(!n)throw new Error("Unexpected dot segment condition");var i=n[0];e=e.slice(i.length),t.push(i)}return t.join("")}function ne(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.iri?c:l,i=[],s=F[(t.scheme||e.scheme||"").toLowerCase()];if(s&&s.serialize&&s.serialize(e,t),e.host)if(n.IPV6ADDRESS.test(e.host));else if(t.domainHost||s&&s.domainHost)try{e.host=t.iri?V.toUnicode(e.host):V.toASCII(e.host.replace(n.PCT_ENCODED,j).toLowerCase())}catch(n){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+n}$(e,n),"suffix"!==t.reference&&e.scheme&&(i.push(e.scheme),i.push(":"));var r=K(e,t);if(void 0!==r&&("suffix"!==t.reference&&i.push("//"),i.push(r),e.path&&"/"!==e.path.charAt(0)&&i.push("/")),void 0!==e.path){var o=e.path;t.absolutePath||s&&s.absolutePath||(o=te(o)),void 0===r&&(o=o.replace(/^\/\//,"/%2F")),i.push(o)}return void 0!==e.query&&(i.push("?"),i.push(e.query)),void 0!==e.fragment&&(i.push("#"),i.push(e.fragment)),i.join("")}function ie(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(e=Y(ne(e,n),n),t=Y(ne(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=te(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function se(e,t,n){var i=o({scheme:"null"},n);return ne(ie(Y(e,i),Y(t,i),i,!0),i)}function re(e,t){return"string"==typeof e?e=ne(Y(e,t),t):"object"===i(e)&&(e=Y(ne(e,t),t)),e}function oe(e,t,n){return"string"==typeof e?e=ne(Y(e,n),n):"object"===i(e)&&(e=ne(e,n)),"string"==typeof t?t=ne(Y(t,n),n):"object"===i(t)&&(t=ne(t,n)),e===t}function ae(e,t){return e&&e.toString().replace(t&&t.iri?c.ESCAPE:l.ESCAPE,B)}function le(e,t){return e&&e.toString().replace(t&&t.iri?c.PCT_ENCODED:l.PCT_ENCODED,j)}var ce={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var n="https"===String(e.scheme).toLowerCase();return e.port!==(n?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},he={scheme:"https",domainHost:ce.domainHost,parse:ce.parse,serialize:ce.serialize};function ue(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var de={scheme:"ws",domainHost:!0,parse:function(e,t){var n=e;return n.secure=ue(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=void 0,n.query=void 0,n},serialize:function(e,t){if(e.port!==(ue(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var n=e.resourceName.split("?"),i=h(n,2),s=i[0],r=i[1];e.path=s&&"/"!==s?s:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},pe={scheme:"wss",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize},me={},fe="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ge="[0-9A-Fa-f]",ve=n(n("%[EFef]"+ge+"%"+ge+ge+"%"+ge+ge)+"|"+n("%[89A-Fa-f]"+ge+"%"+ge+ge)+"|"+n("%"+ge+ge)),ye="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),xe="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",_e=new RegExp(fe,"g"),we=new RegExp(ve,"g"),Se=new RegExp(t("[^]",ye,"[\\.]",'[\\"]',be),"g"),Me=new RegExp(t("[^]",fe,xe),"g"),Ee=Me;function Te(e){var t=j(e);return t.match(_e)?t:e}var Ce={scheme:"mailto",parse:function(e,t){var n=e,i=n.to=n.path?n.path.split(","):[];if(n.path=void 0,n.query){for(var s=!1,r={},o=n.query.split("&"),a=0,l=o.length;a{var t=/\n/,n="\n",i=/\s/;function s(e,t,n,i){var s=e.indexOf(t,n);return-1===s||s>i?i:s}function r(e){return i.test(e)}function o(e,t,n,i){return{start:t,end:t+Math.min(i,n-t)}}e.exports=function(t,n){return e.exports.lines(t,n).map((function(e){return t.substring(e.start,e.end)})).join("\n")},e.exports.lines=function(e,i){if(0===(i=i||{}).width&&"nowrap"!==i.mode)return[];e=e||"";var a="number"==typeof i.width?i.width:Number.MAX_VALUE,l=Math.max(0,i.start||0),c="number"==typeof i.end?i.end:e.length,h=i.mode,u=i.measure||o;return"pre"===h?function(e,n,i,s,r){for(var o=[],a=i,l=i;li&&!r(t.charAt(p));)p--;if(p===i)m>i+n.length&&m--,p=m;else for(m=p;p>i&&r(t.charAt(p-n.length));)p--}if(p>=i){var f=e(t,i,p,h);c.push(f)}i=m}return c}(u,e,l,c,a,h)}},139:e=>{e.exports=function(){for(var e={},n=0;n{"use strict";n.d(t,{Z:()=>db});var i={};n.r(i),n.d(i,{ArcCurve:()=>gi,CatmullRomCurve3:()=>wi,CubicBezierCurve:()=>Ti,CubicBezierCurve3:()=>Ci,EllipseCurve:()=>fi,LineCurve:()=>Ai,LineCurve3:()=>Pi,QuadraticBezierCurve:()=>Ri,QuadraticBezierCurve3:()=>Li,SplineCurve:()=>Ni});const s=Symbol("Publisher private data"),r=Symbol("Publisher strict option");class o{constructor(e){const t=!e||e.knownEvents;this[s]={[r]:t}}on(e,t,n){if(Array.isArray(e))return void e.forEach((e=>{this.on(e,t,n)}));if(!t)throw new Error("missing callback function");let i=this[s][e];if(!i){if(this[s][r])throw new Error(`can't subscribe; unknown event: '${e}'`);i=this[s][e]=[]}let o={callback:t,context:n};i.push(o)}addEventListener(e,t,n){this.on(e,t,n)}once(e,t,n){if(Array.isArray(e))return void e.forEach((e=>{this.once(e,t,n)}));const i=s=>{this.off(e,i,n),t.call(n,s)};i.cb=t,this.on(e,i,n)}off(e,t,n){if("object"==typeof e){if(Array.isArray(e))e.forEach((e=>{this.off(e,t,n)}));else{const t=this[s];for(let n=0,i=Object.keys(t).length;n{this[s][e]||(this[s][e]=[])}))}hasEvent(e){return!!this[s][e]}listEvents(){return Object.getOwnPropertyNames(this[s])}}const a=[function(e){return e},function(e,t){for(let n=0,i=t.length;n=0)throw new Error("non-array source property; can't link to element");if(1===t.elementCount&&i>=0)throw new Error("non-array destination property; can't link to element");this.source=e,this.destination=t,this.sourceIndex=n,this.destinationIndex=i;const s=void 0===n?-1:n,r=void 0===i?-1:i,o=e.elementCount>1&&s<0&&r<0;this.fnConvert=function(e,t,n){const i=n?1:0;return u[e][t][i]}(e.type,t.type,o);const a=function(e,t,n){return-1===e&&-1===t?n:e<=3&&t<=3?p[e+1][t+1]:function(n,i,s){return i[t]=s(n[e]),i}}(s,r,this.fnConvert);var l,c,h;this.fnCopy=(l=e.isMulti(),c=t.isMulti(),h=a,!1===l?!1===c?h:function(e,t,n){for(let n=0,i=t.length;n0&&(t=h(e[0],t)),t}:function(e,t,n){for(let n=0,i=e.length,s=t.length;nv(y.Number,e,t),x=(e,t)=>v(y.Integer,e,t),_=(e,t)=>v(y.Percent,e,t),w=(e,t)=>v(y.Vector3,e,t),S=(e,t)=>v(y.Matrix4,e,t),M=(e,t)=>v(y.Scale,e,t),E=(e,t)=>v(y.Scale3,e,t),T=(e,t)=>v(y.ColorRGB,e,t),C=(e,t)=>v(y.Boolean,e,t),A=(e,t)=>v(y.String,e,t),P=(e,t)=>v(y.AssetPath,e,t),R=(e,t,n)=>function(e,t,n){n=g(n);const i={enum:e,options:(s=e,Object.keys(s).filter((e=>isNaN(Number(e))))),preset:0};var s;return{path:t,schema:n?Object.assign({},i,n):i}}(t,e,n),L=(e,t,n)=>function(e,t,n){const i={options:e,preset:0};return{path:t,schema:(n=g(n))?Object.assign({},i,n):i}}(t,e,n),N=(e,t,n)=>function(e,t,n){const i={preset:null,objectType:e};return{path:t,schema:(n=g(n))?Object.assign({},i,n):i}}(t,e,n),D=(e,t)=>v(y.Event,e,t);class O extends o{constructor(e,t,n){if(super(),this.addEvents("value","link","change","dispose"),!t||void 0===t.preset)throw new Error("missing schema/preset");const i=t.preset,s=Array.isArray(i);this.type=typeof(s?i[0]:i),this.schema=t,this.custom=n||!1,this.elementCount=s?i.length:1,this.inLinks=[],this.outLinks=[],this._group=null,this._key="",this._path=e,this.value=null,this.reset(),this.changed=!t.event}get group(){return this._group}get key(){return this._key}get path(){return this._path}set path(e){this._path=e,this.emit({type:"change",what:"path",property:this})}get name(){return this._path.split(".").pop()}dispose(){this.unlink(),this._group&&this._group.removeProperty(this),this.emit({type:"dispose",property:this})}setValue(e,t,n){this.value=e,t||(this.changed=!0,this.isInput()&&(this._group.linkable.changed=!0)),n||this.emit("value",e);const i=this.outLinks;for(let e=0,t=i.length;e=0&&this.setValue(i,t,n)}copyValue(e,t){Array.isArray(e)&&(e=e.slice()),this.setValue(e,t)}set(e){e||(this.changed=!0,this.isInput()&&(this._group.linkable.changed=!0)),this.emit("value",this.value);const t=this.outLinks;for(let e=0,n=t.length;ei.source===e&&i.sourceIndex===t&&i.destinationIndex===n));return!!i&&(e.removeOutLink(i),this.removeInLink(i),!0)}unlink(){this.inLinks.slice().forEach((e=>{e.source.removeOutLink(e),this.removeInLink(e)}));if(this.outLinks.slice().forEach((e=>{this.removeOutLink(e),e.destination.removeInLink(e)})),0!==this.inLinks.length||0!==this.outLinks.length)throw new Error("fatal: leftover links")}addInLink(e){if(e.destination!==this)throw new Error("input link's destination must equal this");this.inLinks.push(e),this.requestSort(),this.emit({type:"link",add:!0,remove:!1,link:e})}addOutLink(e){if(e.source!==this)throw new Error("output link's source must equal this");this.outLinks.push(e),this.requestSort(),e.push()}removeInLink(e){const t=this.inLinks.indexOf(e);if(t<0)throw new Error("input link not found");this.inLinks.splice(t,1),this.requestSort(),0===this.inLinks.length&&"object"===this.type&&this.reset(),this.emit({type:"link",add:!1,remove:!0,link:e})}removeOutLink(e){const t=this.outLinks.indexOf(e);if(t<0)throw new Error("output link not found");this.outLinks.splice(t,1),this.requestSort()}canLinkTo(e,t,n){return e.canLinkFrom(this,t,n)}canLinkFrom(e,t,n){if(this.isOutput())return!1;const i=t>=0,s=n>=0;if(!e.isArray()&&i)throw new Error("non-array source property; can't link to element");if(!this.isArray()&&s)throw new Error("non-array destination property; can't link to element");const r=e.isArray()&&!i;return r===(this.isArray()&&!s)&&((!r||e.elementCount===this.elementCount)&&(!("object"===e.type&&"object"===this.type&&!function(e,t){if(!e||!t)return!1;let n=e.prototype;for(;n;){if(n===t.prototype)return!0;n=n.prototype}return!1}(e.schema.objectType,this.schema.objectType))&&(o=e.type,a=this.type,d[o][a])));var o,a}reset(){let e;if(this.isMulti()){let t=this.value;t?t.length=1:e=t=[],t[0]=this.clonePreset()}else e=this.clonePreset();this.setValue(e)}setMultiChannelCount(e){if(!this.isMulti())throw new Error("can't set multi channel count on non-multi property");const t=this.value,n=t.length;t.length=e;for(let i=n;i=e.length?0:t]||""}}isInput(){return this._group&&this._group===this._group.linkable.ins}isOutput(){return this._group&&this._group===this._group.linkable.outs}isArray(){return Array.isArray(this.schema.preset)}isMulti(){return!!this.schema.multi}isDefault(){const e=this.schema.multi?this.value[0]:this.value,t=this.schema.preset,n=Array.isArray(e)?e.length:-1;if(n!==(Array.isArray(t)?t.length:-1))return!1;if(n>=0){for(let i=0;i0||this.outLinks.length>0}hasInLinks(e){const t=this.inLinks;if(!(e>=0))return t.length>0;for(let n=0,i=t.length;n=0))return!0;return!1}hasOutLinks(e){const t=this.outLinks;if(!(e>=0))return t.length>0;for(let n=0,i=t.length;n0&&(e=e||{},e.links=this.outLinks.map((e=>{const t={id:e.destination._group.linkable.id,key:e.destination.key};return e.sourceIndex>=0&&(t.srcIndex=e.sourceIndex),e.destinationIndex>=0&&(t.dstIndex=e.destinationIndex),t}))),e}fromJSON(e,t){void 0!==e.value&&(this.value=e.value),void 0!==e.links&&e.links.forEach((e=>{t[e.id].ins[e.key].linkFrom(this,e.srcIndex,e.dstIndex)}))}toString(){const e=this.schema,t=e.event?"event":e.options?"enum":this.type;return`${this.path} [${t}]`}dump(e=""){console.log(e+`Property '${this.path}', key: ${this.key}, value: ${this.value}`)}validateValue(e){const t=this.schema;if(t.enum){const n=Math.trunc(e);return t.enum[n]?n:0}if(t.options){const n=Math.trunc(e);return n<0||n>=t.options.length?0:n}return"number"===this.type?(e=t.min?Math.max(t.min,e):e,e=t.max?Math.min(t.max,e):e):e}clonePreset(){const e=this.schema.preset;return Array.isArray(e)?e.slice():e}}function I(e,t){let n;e&&"number"==typeof e||(e=12);do{n="";for(let t=0;te.custom))}dispose(){this.unlinkAllProperties()}isInputGroup(){return this===this.linkable.ins}isOutputGroup(){return this===this.linkable.outs}createProperties(e,t){return Object.keys(e).forEach(((n,i)=>{const s=void 0===t?void 0:t+i,r=e[n];this.createProperty(r.path,r.schema,n,s)})),this}createProperty(e,t,n,i){const s=new O(e,t);return this.addProperty(s,n,i),s}createCustomProperty(e,t,n){const i=new O(e,t,!0);return this.addCustomProperty(i,n),i}addCustomProperty(e,t){const n=I(5);this.addProperty(e,n,t)}addProperty(e,t,n){if(e.group)throw new Error("can't add, property already part of a group");if(this[t])throw new Error(`key '${t}' already exists in group`);e._group=this,e._key=t,void 0===n?this.properties.push(e):this.properties.splice(n,0,e),this[t]=e,this.emit({type:"property",add:!0,remove:!1,property:e})}removeProperty(e){if(e.group!==this)throw new Error("can't remove, property not in this group");if(e.hasLinks())throw new Error("can't remove, property has links");if(this[e.key]!==e)throw new Error(`property key '${e.key}' not found in group`);this.properties.slice(this.properties.indexOf(e),1),delete this[e.key],e._group=null,e._key="",this.emit({type:"property",add:!1,remove:!0,property:e})}getProperty(e){const t=this[e];if(!t)throw new Error(`no property found with key '${e}'`);return t}getKeys(e=!1){const t=[];return this.properties.forEach((n=>{(e||"object"!==n.type)&&t.push(n.key)})),t}getValues(e=!1){const t=[];return this.properties.map((n=>{(e||"object"!==n.type)&&t.push(n.value)})),t}cloneValues(e=!1){const t=[];return this.properties.map((n=>{(e||"object"!==n.type)&&t.push(n.cloneValue())})),t}setValues(e){Object.keys(e).forEach((t=>this.getProperty(t).value=e[t]))}copyValues(e){Object.keys(e).forEach((t=>this.getProperty(t).copyValue(e[t])))}unlinkAllProperties(){this.properties.forEach((e=>e.unlink()))}toJSON(){let e=null;return this.properties.forEach((t=>{const n=t.toJSON();n&&(e=e||{},e[t.key]=n)})),e}fromJSON(e){Object.keys(e).forEach((t=>{const n=e[t];if(n.schema){const e=new O(n.path,n.schema,!0);this.addProperty(e,t)}}))}linksFromJSON(e,t){Object.keys(e).forEach((n=>{this[n].fromJSON(e[n],t)}))}}class z{constructor(e,t,n,i){this.typeName=j.getTypeName(t),this.didAdd=n,this.willRemove=i,this._registry=e,e.on(this.typeName,this.onComponent,this),this.component=e.get(t,!0),this.component&&n&&n(this.component)}dispose(){this._registry.off(this.typeName,this.onComponent,this),this.component=null,this.didAdd=null,this.willRemove=null}onComponent(e){e.add?(this.component=e.object,this.didAdd&&this.didAdd(e.object)):e.remove&&(this.willRemove&&this.willRemove(e.object),this.component=null)}}class U{constructor(e,t){this._typeName=t?j.getTypeName(t):null,this._id=t instanceof j?t.id:void 0,this._system=e}get component(){return this._id&&this._system.components.getById(this._id)||null}set component(e){if(e&&this._typeName&&!(e instanceof this._system.registry.getType(this._typeName)))throw new Error(`can't assign component of class '${e.constructor.name||"unknown"}' to link of class '${this._typeName}'`);this._id=e?e.id:void 0}}const V=[];class F extends o{constructor(e){super({knownEvents:!1});const t=e.typeName;if(!t)throw new Error("root type must have a 'typeName' member");this._rootTypeName=t,this._objLists={[this._rootTypeName]:[]},this._objTags={},this._objDict={}}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e}add(e){const t=e.id;if("string"==typeof t){if(void 0!==this._objDict[t])throw new Error("object already registered");this._objDict[t]=e}let n,i=e;const s=this._rootTypeName,r={type:"",add:!0,remove:!1,object:e};do{i=Object.getPrototypeOf(i),n=i.constructor.typeName,n&&((this._objLists[n]||(this._objLists[n]=[])).push(e),r.type=n,this.emit(r))}while(n!==s)}remove(e){const t=e.id;if("string"==typeof t){if(this._objDict[t]!==e)throw new Error("object not registered");delete this._objDict[t]}let n,i=e;const s=this._rootTypeName,r={type:"",add:!1,remove:!0,object:e};do{if(i=Object.getPrototypeOf(i),n=i.constructor.typeName,n){r.type=n;const t=this._objLists[n];t.splice(t.indexOf(e),1),this.emit(r)}}while(n!==s)}addByTag(e,t){if(!e||"tag"===e)throw new Error("illegal tag name");(this._objTags[e]||(this._objTags[e]=[])).push(t);const n={type:"tag",add:!0,remove:!1,object:t,tag:e};this.emit(n),n.type=e,this.emit(n)}removeByTag(e,t){if(!e||"tag"===e)throw new Error("illegal tag name");const n=this._objTags[e];if(n){const i=n.indexOf(t);if(i>=0){const s={type:"tag",add:!1,remove:!0,object:t,tag:e};return this.emit(s),s.type=e,this.emit(s),n.splice(i,1),!0}}return!1}clear(){this.cloneArray().forEach((e=>this.remove(e)))}get length(){return this._objLists[this._rootTypeName].length}count(e){const t=this._objLists[this.getTypeName(e)];return t?t.length:0}has(e){if("function"==typeof e){const t=this._objLists[e.typeName];return!!t&&t.length>0}if("string"==typeof e){const t=this._objLists[e];return!!t&&t.length>0}const t=this._objLists[e.constructor.typeName];return t&&t.indexOf(e)>=0}contains(e){const t=e.id;if("string"==typeof t)return!!this._objDict[t];const n=this._objLists[e.constructor.typeName];return n&&n.indexOf(e)>=0}get(e,t=!1){const n=this.getTypeName(e),i=this._objLists[n],s=i?i[0]:void 0;if(!t&&!s)throw new Error(`no instances of class '${n}' in object registry`);return s}getArray(e){return this._objLists[this.getTypeName(e)]||V}cloneArray(e){return this.getArray(e).slice()}getById(e){return this._objDict[e]}getDictionary(){return this._objDict}getByTag(e){return this._objTags[e]||V}on(e,t,n){super.on(this.getTypeName(e),t,n)}once(e,t,n){super.once(this.getTypeName(e),t,n)}off(e,t,n){super.off(this.getTypeName(e),t,n)}getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||this._rootTypeName}}class B extends o{constructor(e,t){super({knownEvents:!1}),this.graph=null,this.components=new F(j),this._name="",this._tags=new Set,this._isLocked=void 0,this.graph=e,this.id=t}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||B.typeName}get typeName(){return this.constructor.typeName}get displayTypeName(){const e=this.typeName;return"Node"===e?e:e.substr(1)}get isLocked(){return this._isLocked}get text(){return this.constructor.text}get icon(){return this.constructor.icon}get name(){return this._name}get displayName(){return this._name||this.text||this.displayTypeName}set name(e){this._name=e,this.emit({type:"change",what:"name",node:this})}get tags(){return this._tags}addTag(e){this._tags.has(e)||(this._tags.add(e),this.graph._addNodeTag(e,this))}removeTag(e){this._tags.has(e)&&(this._tags.delete(e),this.graph._removeNodeTag(e,this))}get system(){return this.graph.system}getComponent(e,t=!1){return this.components.get(e,t)}getComponents(e){return this.components.getArray(e)}getComponentsByTag(e){return this.components.getByTag(e)}getOrCreateComponent(e){return this.components.get(e,!0)||this.createComponent(e)}hasComponent(e){return this.components.has(e)}getGraphComponent(e,t=!1){return this.graph.components.get(e,t)}getGraphComponents(e){return this.graph.components.getArray(e)}getGraphComponentsByTag(e){return this.graph.components.getByTag(e)}hasGraphComponent(e){return this.graph.components.has(e)}getMainComponent(e,t=!1){return this.graph.system.graph.components.get(e,t)}getMainComponents(e){return this.graph.system.graph.components.getArray(e)}getMainComponentsByTag(e){return this.graph.system.graph.components.getByTag(e)}hasMainComponent(e){return this.graph.system.graph.components.has(e)}getSystemComponent(e,t=!1){return this.graph.system.components.get(e,t)}getSystemComponents(e){return this.graph.system.components.getArray(e)}getSystemComponentsByTag(e){return this.graph.system.components.getByTag(e)}hasSystemComponent(e){return this.graph.system.components.has(e)}getComponentById(e){return this.graph.system.components.getById(e)}getNode(e,t=!1){return this.graph.nodes.get(e,t)}getNodes(e){return this.graph.nodes.getArray(e)}getNodesByTag(e){return this.graph.nodes.getByTag(e)}hasNode(e){return this.graph.nodes.has(e)}getMainNode(e,t=!1){return this.graph.system.graph.nodes.get(e,t)}getMainNodes(e){return this.graph.system.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.graph.system.graph.nodes.getByTag(e)}hasMainNode(e){return this.graph.system.graph.nodes.has(e)}getSystemNode(e,t=!1){return this.graph.system.nodes.get(e,t)}getSystemNodes(e){return this.graph.system.nodes.getArray(e)}getSystemNodesByTag(e){return this.graph.system.nodes.getByTag(e)}hasSystemNode(e){return this.graph.system.nodes.has(e)}getNodeById(e){return this.graph.system.nodes.getById(e)}lock(){if(!1===this._isLocked)throw new Error("can't lock an unlocked node again");this._isLocked=!0}unlock(){this._isLocked=!1}create(){this.graph._addNode(this)}createComponents(){}clear(){this.components.getArray().slice().forEach((e=>e.dispose()))}dispose(){this.components.cloneArray().reverse().forEach((e=>e.dispose())),this.emit({type:"dispose",node:this}),this.graph&&(this.graph._removeNode(this),this.graph=null)}createComponent(e,t,n){if(!0===this._isLocked)throw new Error("node is locked, can't create component");const i=this.system.registry.getType(e);if(!i)throw new Error(`component type '${j.getTypeName(e)}' not registered`);const s=new i(this,n||I(12,this.system.components.getDictionary()));return s.create(),t&&(s.name=t),s}is(e){const t=B.getTypeName(e);let n=this;do{if(n=Object.getPrototypeOf(n),n.constructor.typeName===t)return!0}while(n.constructor.typeName!==B.typeName);return!1}toString(e=!1){const t=this.components.getArray(),n=`Node '${this.name}' - ${t.length} components`;return e?n+"\n"+t.map((e=>" "+e.toString())).join("\n"):n}dump(e=""){console.log(e+`%cNode '${this.typeName}' (${this.displayName})`,"color: blue"),this.components.getArray().forEach((t=>t.dump(e+" ")))}toJSON(){const e={},t=[];this._isLocked&&(e.locked=!0);const n=this.components.getArray();for(let e=0,i=n.length;e0&&(e.components=t),e}fromJSON(e){this._isLocked=!!e.locked,e.components&&e.components.forEach((e=>this.componentFromJSON(e)))}componentFromJSON(e){this.createComponent(e.type,e.name,e.id).fromJSON(e)}referencesFromJSON(e){e.components&&e.components.forEach((e=>{this.components.getById(e.id).referencesFromJSON(e)}))}componentToJSON(e){return e.toJSON()}_addComponent(e){if(e.isNodeSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per node`);this.components.add(e),this.graph._addComponent(e)}_removeComponent(e){this.graph._removeComponent(e),this.components.remove(e)}_addComponentTag(e,t){this.components.addByTag(e,t),this.graph._addComponentTag(e,t)}_removeComponentTag(e,t){this.graph._removeComponentTag(e,t),this.components.removeByTag(e,t)}}B.typeName="Node",B.text="",B.icon="";class j extends o{constructor(e,t){super({knownEvents:!1}),this.ins=new k(this),this.outs=new k(this),this.changed=!0,this.updated=!1,this._name="",this._tags=new Set,this._trackers=[],this.node=e,this.id=t}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||j.typeName}create(){this.node._addComponent(this),this.graph.isActive&&this.activate&&this.activate()}dispose(){this.graph.isActive&&this.deactivate&&this.deactivate(),this.emit({type:"dispose",component:this}),this.ins.dispose(),this.outs.dispose(),this._trackers.forEach((e=>e.dispose())),this.node&&(this.node._removeComponent(this),this.node=null)}get isNodeSingleton(){return this.constructor.isNodeSingleton}get isGraphSingleton(){return this.constructor.isGraphSingleton}get isSystemSingleton(){return this.constructor.isSystemSingleton}get typeName(){return this.constructor.typeName}get displayTypeName(){const e=this.typeName;return"Component"===e?e:e.substr(1)}get text(){return this.constructor.text}get icon(){return this.constructor.icon}get name(){return this._name}get displayName(){return this._name||this.text||this.displayTypeName}set name(e){this._name=e,this.emit({type:"change",component:this,what:"name"})}get tags(){return this._tags}addTag(e){this._tags.has(e)||(this._tags.add(e),this.node._addComponentTag(e,this))}removeTag(e){this._tags.has(e)&&(this._tags.delete(e),this.node._removeComponentTag(e,this))}get graph(){return this.node.graph}get system(){return this.node.system}get components(){return this.node.components}get isActive(){return this.graph.isActive}getComponent(e,t=!1){return this.node.components.get(e,t)}getComponents(e){return this.node.components.getArray(e)}getComponentsByTag(e){return this.node.components.getByTag(e)}createComponent(e){return this.node.createComponent(e)}getOrCreateComponent(e){return this.node.components.get(e,!0)||this.node.createComponent(e)}hasComponent(e){return this.node.components.has(e)}getGraphComponent(e,t=!1){return this.node.graph.components.get(e,t)}getGraphComponents(e){return this.node.graph.components.getArray(e)}getGraphComponentsByTag(e){return this.node.graph.components.getByTag(e)}hasGraphComponent(e){return this.node.graph.components.has(e)}getMainComponent(e,t=!1){return this.node.system.graph.components.get(e,t)}getMainComponents(e){return this.node.system.graph.components.getArray(e)}getMainComponentsByTag(e){return this.node.system.graph.components.getByTag(e)}hasMainComponent(e){return this.node.system.graph.components.has(e)}getSystemComponent(e,t=!1){return this.node.system.components.get(e,t)}getSystemComponents(e){return this.node.system.components.getArray(e)}getSystemComponentsByTag(e){return this.node.system.components.getByTag(e)}hasSystemComponent(e){return this.node.system.components.has(e)}getComponentById(e){return this.node.system.components.getById(e)}getNode(e,t=!1){return this.node.graph.nodes.get(e,t)}getNodes(e){return this.node.graph.nodes.getArray(e)}getNodesByTag(e){return this.node.graph.nodes.getByTag(e)}hasNode(e){return this.node.graph.nodes.has(e)}getMainNode(e,t=!1){return this.node.system.graph.nodes.get(e,t)}getMainNodes(e){return this.node.system.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.node.system.graph.nodes.getByTag(e)}hasMainNode(e){return this.node.system.graph.nodes.has(e)}getSystemNode(e,t=!1){return this.node.system.nodes.get(e,t)}getSystemNodes(e){return this.node.system.nodes.getArray(e)}getSystemNodesByTag(e){return this.node.system.nodes.getByTag(e)}hasSystemNode(e){return this.node.system.nodes.has(e)}getNodeById(e){return this.node.system.nodes.getById(e)}activate(){}update(e){throw new Error("this should never be called")}tick(e){throw new Error("this should never be called")}tock(e){throw new Error("this should never be called")}deactivate(){}requestSort(){this.graph.requestSort()}is(e){const t=j.getTypeName(e);let n=this;do{if(n=Object.getPrototypeOf(n),n.constructor.typeName===t)return!0}while(n.constructor.typeName!==j.typeName);return!1}unlinkAllProperties(){this.ins.unlinkAllProperties(),this.outs.unlinkAllProperties()}resetChanged(){this.changed=!1;const e=this.ins.properties;for(let t=0,n=e.length;tt.dump(e+" IN "))),this.outs.properties.forEach((t=>t.dump(e+" OUT ")))}toJSON(){let e={};const t=this.ins.toJSON();t&&(e.ins=t);const n=this.outs.toJSON();return n&&(e.outs=n),e}fromJSON(e){e.ins&&this.ins.fromJSON(e.ins),e.outs&&this.outs.fromJSON(e.outs)}referencesFromJSON(e){const t=this.system.components.getDictionary();e.ins&&this.ins.linksFromJSON(e.ins,t),e.outs&&this.outs.linksFromJSON(e.outs,t)}addCustomInput(e,t,n){return this.changed=!0,this.ins.createCustomProperty(e,t,n)}allowCustomInput(e){return!1}addCustomOutput(e,t,n){return this.outs.createCustomProperty(e,t,n)}allowCustomOutput(e){return!1}addInputs(e,t){return this.ins.createProperties(e,t)}addOutputs(e,t){return this.outs.createProperties(e,t)}}j.typeName="Component",j.text="",j.icon="",j.isNodeSingleton=!0,j.isGraphSingleton=!1,j.isSystemSingleton=!1,j.prototype.activate=null,j.prototype.update=null,j.prototype.tick=null,j.prototype.tock=null,j.prototype.deactivate=null;class $ extends j{constructor(e,t){super(e,t),this.ins=this.addInputs($.ins),this.outs=this.addOutputs($.outs),this._fullscreenElement=null,this.onFullscreenChange=this.onFullscreenChange.bind(this);const n=document.documentElement,i=n.requestFullscreen||n.mozRequestFullScreen||n.webkitRequestFullscreen;this.outs.fullscreenAvailable.setValue(!!i),this.ins.toggle.on("value",this.toggle,this)}get fullscreenElement(){return this._fullscreenElement}set fullscreenElement(e){e!==this._fullscreenElement&&(this._fullscreenElement&&this._fullscreenElement.removeEventListener("fullscreenchange",this.onFullscreenChange),this._fullscreenElement=e,e&&e.addEventListener("fullscreenchange",this.onFullscreenChange))}update(e){return!0}toggle(){const e=this.outs,t=this._fullscreenElement;if(t){const n=e.fullscreenActive.value;if(!n&&e.fullscreenAvailable.value)t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);else if(n){const e=document;e.exitFullscreen?e.exitFullscreen():e.cancelFullScreen?e.cancelFullScreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()}}}onFullscreenChange(e){const t=document,n=t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement;this.outs.fullscreenActive.setValue(!!n)}}$.typeName="CFullscreen",$.ins={toggle:D("Fullscreen.Toggle")},$.outs={fullscreenAvailable:C("Fullscreen.Available",!1),fullscreenActive:C("Fullscreen.Active",!1)};const H=100,G=301,W=302,q=303,X=306,Y=1e3,K=1001,J=1002,Z=1003,Q=1004,ee=1005,te=1006,ne=1008,ie=1009,se=1012,re=1014,oe=1015,ae=1016,le=1020,ce=1023,he=1026,ue=1027,de=33776,pe=33777,me=33778,fe=33779,ge=2300,ve=2301,ye=2302,be=3e3,xe=3001,_e=7680,we=35044,Se="300 es",Me=1035;class Ee extends j{constructor(e,t){super(e,t),this.outs=this.addOutputs(Ee.pulseOuts),this._tockUpdated=!1,this.addEvent("pulse"),this.onAnimationFrame=this.onAnimationFrame.bind(this),this.context={time:new Date,secondsElapsed:0,secondsDelta:0,frameNumber:0},this._secondsStarted=.001*Date.now(),this._secondsStopped=this._secondsStarted,this._animHandler=0,this._pulseEvent={type:"pulse",context:this.context,systemUpdated:!1}}start(){0===this._animHandler&&(this._secondsStopped>0&&(this._secondsStarted+=.001*Date.now()-this._secondsStopped,this._secondsStopped=0),this._animHandler=window.requestAnimationFrame(this.onAnimationFrame))}stop(){0!==this._animHandler&&(0===this._secondsStopped&&(this._secondsStopped=.001*Date.now()),window.cancelAnimationFrame(this._animHandler),this._animHandler=0)}pulse(e){const{outs:t,context:n,_pulseEvent:i}=this;n.time.setTime(e);const s=.001*e-this._secondsStarted;n.secondsDelta=s-n.secondsElapsed,n.secondsElapsed=s,n.frameNumber++,t.time.setValue(n.secondsElapsed),t.frame.setValue(n.frameNumber);const r=this.system.graph.tick(n);i.systemUpdated=r||this._tockUpdated,this.emit(i),this._tockUpdated=this.system.graph.tock(n)}onAnimationFrame(){this.pulse(Date.now()),this._animHandler=window.requestAnimationFrame(this.onAnimationFrame)}}var Te;Ee.typeName="CPulse",Ee.isSystemSingleton=!0,Ee.pulseOuts={time:b("Pulse.Time"),frame:x("Pulse.Frame")},function(e){e[e.Basic=0]="Basic",e[e.PCF=1]="PCF",e[e.PCFSoft=2]="PCFSoft"}(Te||(Te={}));const Ce={[Te.Basic]:0,[Te.PCF]:1,[Te.PCFSoft]:2};class Ae extends j{constructor(e,t){super(e,t),this.ins=this.addInputs(Ae.ins),this.outs=this.addOutputs(Ae.outs),this.views=[],this._activeSceneComponent=null,this._forceRender=!1,this.addEvents("active-scene","active-camera")}get activeSceneComponent(){return this._activeSceneComponent}set activeSceneComponent(e){if(e!==this._activeSceneComponent){const t=this._activeSceneComponent,n=this.activeCameraComponent;t&&t.off("active-camera",this.onActiveCamera,this),e&&e.on("active-camera",this.onActiveCamera,this),this._activeSceneComponent=e;const i=this.activeCameraComponent,s={type:"active-scene",previous:t,next:e};this.emit(s);const r={type:"active-camera",previous:n,next:i};this.emit(r)}}get activeSceneGraph(){return this._activeSceneComponent?this._activeSceneComponent.graph:null}get activeScene(){return this._activeSceneComponent?this._activeSceneComponent.scene:null}get activeCameraComponent(){return this._activeSceneComponent?this._activeSceneComponent.activeCameraComponent:null}get activeCamera(){const e=this._activeSceneComponent?this._activeSceneComponent.activeCameraComponent:null;return e?e.camera:null}forceRender(){this._forceRender=!0}create(){super.create(),this.trackComponent(Ee,(e=>{e.on("pulse",this.onPulse,this)}),(e=>{e.off("pulse",this.onPulse,this)}))}update(){const e=this.ins;return e.exposure.changed&&this.views.forEach((t=>t.renderer.toneMappingExposure=e.exposure.value)),e.gamma.changed,e.shadowsEnabled.changed&&this.views.forEach((t=>t.renderer.shadowMap.enabled=e.shadowsEnabled.value)),e.shadowMapType.changed&&this.views.forEach((t=>t.renderer.shadowMap.type=Ce[e.shadowMapType.getValidatedValue()])),!0}attachView(e){if(0===this.views.length){const t=e.renderer,n=this.outs;n.maxTextureSize.setValue(t.capabilities.maxTextureSize),n.maxCubemapSize.setValue(t.capabilities.maxCubemapSize)}this.views.push(e)}detachView(e){const t=this.views.indexOf(e);if(t<0)throw new Error("render view not registered");this.views.splice(t,1)}logInfo(){this.views.forEach((e=>{console.log(e.renderer.info)}))}onPulse(e){(e.systemUpdated||this._forceRender)&&(this.views.forEach((e=>{e.renderer.xr.isPresenting||e.render()})),this._forceRender=!1)}onActiveCamera(e){this.emit(e)}}Ae.typeName="CRenderer",Ae.isSystemSingleton=!0,Ae.ins={exposure:b("Shading.Exposure",1),gamma:b("Shading.Gamma",2),shadowsEnabled:C("Shadows.Enabled",!0),shadowMapType:R("Shadows.MapType",Te,Te.PCF)},Ae.outs={maxTextureSize:x("Caps.MaxTextureSize"),maxCubemapSize:x("Caps.MaxCubemapSize")};const Pe=[];for(let e=0;e<256;e++)Pe[e]=(e<16?"0":"")+e.toString(16);const Re=Math.PI/180,Le=180/Math.PI;function Ne(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Pe[255&e]+Pe[e>>8&255]+Pe[e>>16&255]+Pe[e>>24&255]+"-"+Pe[255&t]+Pe[t>>8&255]+"-"+Pe[t>>16&15|64]+Pe[t>>24&255]+"-"+Pe[63&n|128]+Pe[n>>8&255]+"-"+Pe[n>>16&255]+Pe[n>>24&255]+Pe[255&i]+Pe[i>>8&255]+Pe[i>>16&255]+Pe[i>>24&255]).toUpperCase()}function De(e,t,n){return Math.max(t,Math.min(n,e))}function Oe(e,t){return(e%t+t)%t}function Ie(e,t,n){return(1-n)*e+n*t}function ke(e){return 0==(e&e-1)&&0!==e}function ze(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}class Ue{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,s,r,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=s[r+0],d=s[r+1],p=s[r+2],m=s[r+3];if(0===o)return e[t+0]=a,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=u,e[t+1]=d,e[t+2]=p,void(e[t+3]=m);if(h!==m||a!==u||l!==d||c!==p){let e=1-o;const t=a*u+l*d+c*p+h*m,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const s=Math.sqrt(i),r=Math.atan2(s,t*n);e=Math.sin(e*r)/s,o=Math.sin(o*r)/s}const s=o*n;if(a=a*e+u*s,l=l*e+d*s,c=c*e+p*s,h=h*e+m*s,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,r){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=s[r],u=s[r+1],d=s[r+2],p=s[r+3];return e[t]=o*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-o*d,e[t+2]=l*p+c*d+o*u-a*h,e[t+3]=c*p-o*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,s=e._z,r=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(s/2),u=a(n/2),d=a(i/2),p=a(s/2);switch(r){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+o+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(s-l)*e,this._z=(r-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+r)/e,this._z=(s+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(s-l)/e,this._x=(i+r)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(r-i)/e,this._x=(s+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(De(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,r=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+r*o+i*l-s*a,this._y=i*c+r*a+s*o-n*l,this._z=s*c+r*l+n*a-i*o,this._w=r*c-n*o-i*a-s*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,s=this._z,r=this._w;let o=r*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=r,this._x=n,this._y=i,this._z=s,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*r+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=r*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=s*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ue.prototype.isQuaternion=!0;class Ve{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Be.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Be.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,r=e.y,o=e.z,a=e.w,l=a*t+r*i-o*n,c=a*n+o*t-s*i,h=a*i+s*n-r*t,u=-s*t-r*n-o*i;return this.x=l*a+u*-s+c*-o-h*-r,this.y=c*a+u*-r+h*-s-l*-o,this.z=h*a+u*-o+l*-r-c*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,r=t.x,o=t.y,a=t.z;return this.x=i*a-s*o,this.y=s*r-n*a,this.z=n*o-i*r,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Fe.copy(this).projectOnVector(e),this.sub(Fe)}reflect(e){return this.sub(Fe.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(De(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}Ve.prototype.isVector3=!0;const Fe=new Ve,Be=new Ue;class je{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,r,o,a,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=f,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 je).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/$e.setFromMatrixColumn(e,0).length(),s=1/$e.setFromMatrixColumn(e,1).length(),r=1/$e.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,s=e.z,r=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(s),h=Math.sin(s);if("XYZ"===e.order){const e=r*c,n=r*h,i=o*c,s=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-s*l,t[9]=-o*a,t[2]=s-e*l,t[6]=i+n*l,t[10]=r*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,s=l*h;t[0]=e+s*o,t[4]=i*o-n,t[8]=r*l,t[1]=r*h,t[5]=r*c,t[9]=-o,t[2]=n*o-i,t[6]=s+e*o,t[10]=r*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,s=l*h;t[0]=e-s*o,t[4]=-r*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=r*c,t[9]=s-e*o,t[2]=-r*l,t[6]=o,t[10]=r*a}else if("ZYX"===e.order){const e=r*c,n=r*h,i=o*c,s=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+s,t[1]=a*h,t[5]=s*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=r*a}else if("YZX"===e.order){const e=r*a,n=r*l,i=o*a,s=o*l;t[0]=a*c,t[4]=s-e*h,t[8]=i*h+n,t[1]=h,t[5]=r*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-s*h}else if("XZY"===e.order){const e=r*a,n=r*l,i=o*a,s=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+s,t[5]=r*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=s*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ge,e,We)}lookAt(e,t,n){const i=this.elements;return Ye.subVectors(e,t),0===Ye.lengthSq()&&(Ye.z=1),Ye.normalize(),qe.crossVectors(n,Ye),0===qe.lengthSq()&&(1===Math.abs(n.z)?Ye.x+=1e-4:Ye.z+=1e-4,Ye.normalize(),qe.crossVectors(n,Ye)),qe.normalize(),Xe.crossVectors(Ye,qe),i[0]=qe.x,i[4]=Xe.x,i[8]=Ye.x,i[1]=qe.y,i[5]=Xe.y,i[9]=Ye.y,i[2]=qe.z,i[6]=Xe.z,i[10]=Ye.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,r=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],_=i[0],w=i[4],S=i[8],M=i[12],E=i[1],T=i[5],C=i[9],A=i[13],P=i[2],R=i[6],L=i[10],N=i[14],D=i[3],O=i[7],I=i[11],k=i[15];return s[0]=r*_+o*E+a*P+l*D,s[4]=r*w+o*T+a*R+l*O,s[8]=r*S+o*C+a*L+l*I,s[12]=r*M+o*A+a*N+l*k,s[1]=c*_+h*E+u*P+d*D,s[5]=c*w+h*T+u*R+d*O,s[9]=c*S+h*C+u*L+d*I,s[13]=c*M+h*A+u*N+d*k,s[2]=p*_+m*E+f*P+g*D,s[6]=p*w+m*T+f*R+g*O,s[10]=p*S+m*C+f*L+g*I,s[14]=p*M+m*A+f*N+g*k,s[3]=v*_+y*E+b*P+x*D,s[7]=v*w+y*T+b*R+x*O,s[11]=v*S+y*C+b*L+x*I,s[15]=v*M+y*A+b*N+x*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+s*a*h-i*l*h-s*o*u+n*l*u+i*o*d-n*a*d)+e[7]*(+t*a*d-t*l*u+s*r*u-i*r*d+i*l*c-s*a*c)+e[11]*(+t*l*h-t*o*d-s*r*h+n*r*d+s*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*u+i*r*h-n*r*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],m=e[13],f=e[14],g=e[15],v=h*f*l-m*u*l+m*a*d-o*f*d-h*a*g+o*u*g,y=p*u*l-c*f*l-p*a*d+r*f*d+c*a*g-r*u*g,b=c*m*l-p*h*l+p*o*d-r*m*d-c*o*g+r*h*g,x=p*h*a-c*m*a-p*o*u+r*m*u+c*o*f-r*h*f,_=t*v+n*y+i*b+s*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/_;return e[0]=v*w,e[1]=(m*u*s-h*f*s-m*i*d+n*f*d+h*i*g-n*u*g)*w,e[2]=(o*f*s-m*a*s+m*i*l-n*f*l-o*i*g+n*a*g)*w,e[3]=(h*a*s-o*u*s-h*i*l+n*u*l+o*i*d-n*a*d)*w,e[4]=y*w,e[5]=(c*f*s-p*u*s+p*i*d-t*f*d-c*i*g+t*u*g)*w,e[6]=(p*a*s-r*f*s-p*i*l+t*f*l+r*i*g-t*a*g)*w,e[7]=(r*u*s-c*a*s+c*i*l-t*u*l-r*i*d+t*a*d)*w,e[8]=b*w,e[9]=(p*h*s-c*m*s-p*n*d+t*m*d+c*n*g-t*h*g)*w,e[10]=(r*m*s-p*o*s+p*n*l-t*m*l-r*n*g+t*o*g)*w,e[11]=(c*o*s-r*h*s-c*n*l+t*h*l+r*n*d-t*o*d)*w,e[12]=x*w,e[13]=(c*m*i-p*h*i+p*n*u-t*m*u-c*n*f+t*h*f)*w,e[14]=(p*o*i-r*m*i-p*n*a+t*m*a+r*n*f-t*o*f)*w,e[15]=(r*h*i-c*o*i+c*n*a-t*h*a-r*n*u+t*o*u)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,r=e.x,o=e.y,a=e.z,l=s*r,c=s*o;return this.set(l*r+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*r,0,l*a-i*o,c*a+i*r,s*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,r=t._y,o=t._z,a=t._w,l=s+s,c=r+r,h=o+o,u=s*l,d=s*c,p=s*h,m=r*c,f=r*h,g=o*h,v=a*l,y=a*c,b=a*h,x=n.x,_=n.y,w=n.z;return i[0]=(1-(m+g))*x,i[1]=(d+b)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-b)*_,i[5]=(1-(u+g))*_,i[6]=(f+v)*_,i[7]=0,i[8]=(p+y)*w,i[9]=(f-v)*w,i[10]=(1-(u+m))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=$e.set(i[0],i[1],i[2]).length();const r=$e.set(i[4],i[5],i[6]).length(),o=$e.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],He.copy(this);const a=1/s,l=1/r,c=1/o;return He.elements[0]*=a,He.elements[1]*=a,He.elements[2]*=a,He.elements[4]*=l,He.elements[5]*=l,He.elements[6]*=l,He.elements[8]*=c,He.elements[9]*=c,He.elements[10]*=c,t.setFromRotationMatrix(He),n.x=s,n.y=r,n.z=o,this}makePerspective(e,t,n,i,s,r){void 0===r&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*s/(t-e),l=2*s/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(r+s)/(r-s),d=-2*r*s/(r-s);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,s,r){const o=this.elements,a=1/(t-e),l=1/(n-i),c=1/(r-s),h=(t+e)*a,u=(n+i)*l,d=(r+s)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}je.prototype.isMatrix4=!0;const $e=new Ve,He=new je,Ge=new Ve(0,0,0),We=new Ve(1,1,1),qe=new Ve,Xe=new Ve,Ye=new Ve,Ke=new je,Je=new Ue;class Ze{constructor(e=0,t=0,n=0,i=Ze.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],r=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(De(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-De(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(De(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(a,s));break;case"ZYX":this._y=Math.asin(-De(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(De(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-De(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ke.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ke,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Je.setFromEuler(this),this.setFromQuaternion(Je,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new Ve(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ze.prototype.isEuler=!0,Ze.DefaultOrder="XYZ",Ze.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Qe{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>>0}enable(e){this.mask|=1<0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,r,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=s,c[5]=a,c[6]=n,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,r=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],b=i[7],x=i[2],_=i[5],w=i[8];return s[0]=r*m+o*v+a*x,s[3]=r*f+o*y+a*_,s[6]=r*g+o*b+a*w,s[1]=l*m+c*v+h*x,s[4]=l*f+c*y+h*_,s[7]=l*g+c*b+h*w,s[2]=u*m+d*v+p*x,s[5]=u*f+d*y+p*_,s[8]=u*g+d*b+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*r*c-t*o*l-n*s*c+n*o*a+i*s*l-i*r*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*r-o*l,u=o*a-c*s,d=l*s-r*a,p=t*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=h*m,e[1]=(i*l-c*n)*m,e[2]=(o*n-i*r)*m,e[3]=u*m,e[4]=(c*t-i*a)*m,e[5]=(i*s-o*t)*m,e[6]=d*m,e[7]=(n*a-l*t)*m,e[8]=(r*t-n*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,o){const a=Math.cos(s),l=Math.sin(s);return this.set(n*a,n*l,-n*(a*r+l*o)+r+e,-i*l,i*a,-i*(-l*r+a*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],r=i[3],o=i[6],a=i[1],l=i[4],c=i[7];return i[0]=t*s+n*a,i[3]=t*r+n*l,i[6]=t*o+n*c,i[1]=-n*s+t*a,i[4]=-n*r+t*l,i[7]=-n*o+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}tt.prototype.isMatrix3=!0;let nt=0;const it=new Ve,st=new Ue,rt=new je,ot=new Ve,at=new Ve,lt=new Ve,ct=new Ue,ht=new Ve(1,0,0),ut=new Ve(0,1,0),dt=new Ve(0,0,1),pt={type:"added"},mt={type:"removed"};class ft extends Qe{constructor(){super(),Object.defineProperty(this,"id",{value:nt++}),this.uuid=Ne(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ft.DefaultUp.clone();const e=new Ve,t=new Ze,n=new Ue,i=new Ve(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new je},normalMatrix:{value:new tt}}),this.matrix=new je,this.matrixWorld=new je,this.matrixAutoUpdate=ft.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new et,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return st.setFromAxisAngle(e,t),this.quaternion.multiply(st),this}rotateOnWorldAxis(e,t){return st.setFromAxisAngle(e,t),this.quaternion.premultiply(st),this}rotateX(e){return this.rotateOnAxis(ht,e)}rotateY(e){return this.rotateOnAxis(ut,e)}rotateZ(e){return this.rotateOnAxis(dt,e)}translateOnAxis(e,t){return it.copy(e).applyQuaternion(this.quaternion),this.position.add(it.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ht,e)}translateY(e){return this.translateOnAxis(ut,e)}translateZ(e){return this.translateOnAxis(dt,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(rt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ot.copy(e):ot.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),at.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rt.lookAt(at,ot,this.up):rt.lookAt(ot,at,this.up),this.quaternion.setFromRotationMatrix(rt),i&&(rt.extractRotation(i.matrixWorld),st.setFromRotationMatrix(rt),this.quaternion.premultiply(st.invert()))}add(e){if(arguments.length>1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=i,n;function r(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;ten?n:e,limitInt:function(e,t,n){return(e=Math.trunc(e))n?n:e},normalize:(e,t,n)=>(e-t)/(n-t),normalizeLimit:(e,t,n)=>(e=(e-t)/(n-t))<0?0:e>1?1:e,denormalize:(e,t,n)=>(t+e)*(n-t),scale:(e,t,n,i,s)=>i+(e-t)/(n-t)*(s-i),scaleLimit:(e,t,n,i,s)=>i+((e=en?n:e)-t)/(n-t)*(s-i),deg2rad:function(e){return.017453292519943295*e},rad2deg:function(e){return 57.29577951308232*e},deltaRadians:function(e,t){return e=(e%=gt.DOUBLE_PI)<0?e+gt.DOUBLE_PI:e,(t=(t%=gt.DOUBLE_PI)<0?t+gt.DOUBLE_PI:t)-e>gt.PI&&(e+=gt.DOUBLE_PI),t-e},deltaDegrees:function(e,t){return e=(e%=gt.DOUBLE_PI)<0?e+gt.DOUBLE_PI:e,(t=(t%=gt.DOUBLE_PI)<0?t+gt.DOUBLE_PI:t)-e>gt.PI&&(e+=gt.DOUBLE_PI),t-e},curves:{linear:e=>e,easeIn:e=>Math.sin(e*gt.HALF_PI),easeOut:e=>Math.cos(e*gt.HALF_PI-gt.PI)+1,ease:e=>.5*Math.cos(e*gt.PI-gt.PI)+.5,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e}},vt=gt;class yt{constructor(){this.visited={},this.visiting={},this.sorted=[]}sort(e){for(let t=0,n=e.length;t0)throw new Error("graph not empty")}requestSort(){this._sortRequested=!0}sort(){this._sortedList=this._sorter.sort(this.components.getArray());this.parent&&(this.parent.name||this.parent.typeName)}createCustomNode(e,t,n){const i=this.system.registry.getType(e);if(!i)throw new Error(`node type '${B.getTypeName(e)}' not registered`);const s=new i(this,n||I(12,this.system.nodes.getDictionary()));return s.create(),t&&(s.name=t),n||(s.createComponents(),s.unlock()),s}createNode(e,t){const n=new B(this,t||I(12,this.system.nodes.getDictionary()));return n.create(),e&&(n.name=e),n.unlock(),n}findNodeByName(e,t){const n=this.nodes.getArray(t);for(let t=0,i=n.length;te.toString(!0))).join("\n"):i}dump(e=""){console.log(e+"%cGraph","color: red");this.findRootNodes().forEach((t=>t.dump(e+" ")))}toJSON(){const e={},t=[],n=this.nodes.getArray();for(let e=0,i=n.length;e0&&(e.nodes=t),e}fromJSON(e){e.nodes&&(e.nodes.forEach((e=>{this.createCustomNode(e.type,e.name,e.id).fromJSON(e)})),e.nodes.forEach((e=>{this.nodes.getById(e.id).referencesFromJSON(e)})))}nodeToJSON(e){return e.toJSON()}_addNode(e){this.nodes.add(e),this.system._addNode(e)}_removeNode(e){this.system._removeNode(e),this.nodes.remove(e)}_addNodeTag(e,t){this.nodes.addByTag(e,t),this.system._addNodeTag(e,t)}_removeNodeTag(e,t){this.system._removeNodeTag(e,t),this.nodes.removeByTag(e,t)}_addComponent(e){if(e.isGraphSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per graph`);this.components.add(e),this.system._addComponent(e),e.tock&&this._tockList.push(e),this._sortRequested=!0}_removeComponent(e){this.system._removeComponent(e),this.components.remove(e),e.tock&&this._tockList.splice(this._tockList.indexOf(e),1),this._sortRequested=!0}_addComponentTag(e,t){this.components.addByTag(e,t),this.system._addComponentTag(e,t)}_removeComponentTag(e,t){this.system._removeComponentTag(e,t),this.components.removeByTag(e,t)}_addRoot(e){this.roots.push(e),this.parent&&this.parent.onAddInnerRoot(e)}_removeRoot(e){this.parent&&this.parent.onRemoveInnerRoot(e),this.roots.splice(this.roots.indexOf(e),1)}}class xt extends j{constructor(e,t){super(e,t),this.ins=this.addInputs(xt.graphIns),this._innerGraph=null,this._innerRoot=null,this._innerGraph=new bt(this.system,this)}get innerGraph(){return this._innerGraph}get innerNodes(){return this._innerGraph.nodes}get innerComponents(){return this._innerGraph.components}get innerRoots(){return this._innerGraph.roots}getInnerComponent(e,t=!1){return this._innerGraph.components.get(e,t)}getInnerComponents(e){return this._innerGraph.components.getArray(e)}hasInnerComponent(e){return this._innerGraph.components.has(e)}getInnerNode(e,t=!1){return this._innerGraph.nodes.get(e,t)}getInnerNodes(e){return this._innerGraph.nodes.getArray(e)}hasInnerNode(e){return this._innerGraph.nodes.has(e)}isEmpty(){return 0===this._innerGraph.nodes.count()}update(e){const t=this.ins;if(t.active.changed){const e=t.active.value;e!==this._innerGraph.isActive&&(e?this.activateInnerGraph():this.deactivateInnerGraph())}return!0}tick(e){return this._innerGraph.tick(e)}tock(e){return this._innerGraph.tock(e)}dispose(){this._innerGraph.clear(),this._innerGraph=null,this._innerRoot=null,super.dispose()}clearInnerGraph(){this._innerGraph.clear()}fromJSON(e){super.fromJSON(e),this._innerGraph.clear(),this._innerGraph.fromJSON(e.graph)}toJSON(){const e=super.toJSON();return e.graph=this._innerGraph.toJSON(),e}dump(e=""){super.dump(e),this.innerGraph.dump(e+" ")}onAddInnerRoot(e){}onRemoveInnerRoot(e){}activateInnerGraph(){this._innerGraph.activate()}deactivateInnerGraph(){this._innerGraph.deactivate()}}xt.typeName="CGraph",xt.graphIns={active:C("Graph.Active",!0)};const _t=(e,t,n)=>{let i;const s=e.children;for(let e=0,n=s.length;e{let i;const s=e.children;for(let e=0,n=s.length;e{let i=[];const s=e.children;for(let e=0,n=s.length;ee.node.dispose())),this._parent&&this._parent.removeChild(this),this.graph._removeRoot(this),super.dispose()}getRootComponent(e){let t=this;for(;t._parent;)t=t._parent;return t?t.node.components.get(e):null}getParentComponent(e,t){let n=this;for(;;){if(n=n._parent,!n){const e=this.graph.parent;n=e?e.components.get(Mt):void 0}if(!n)return;const i=n.node.components.get(e,!0);if(i)return i;if(!t)return}}getParentNode(e,t){let n=this;for(;;){if(n=n._parent,!n){const e=this.graph.parent;n=e?e.components.get(Mt):void 0}if(!n)return;const i=n.node;if(i.is(e))return i;if(!t)return}}getSiblingNode(e){return this.getSiblingNodes(e)[0]}getSiblingNodes(e){const t=this._parent;return this.graph.nodes.getArray(e).filter((e=>{const n=e.components.get(Mt);return(n?n._parent:null)==t}))}hasChildComponents(e,t){return _t(this,e,t)}getChildComponent(e,t){return wt(this,e,t)}getChildComponents(e,t){return St(this,e,t)}traverseUp(e,t,n,i){if(e)if(t){const e=this.node.components.getArray();for(let t=0,n=e.length;t(e.emit(n),n.stopPropagation)))}propagateDown(e,t,n){this.traverseDown(!0,e,t,(e=>(e.emit(n),n.stopPropagation)))}addChild(e){if(e===this)throw new Error("can't add self as child");if(e._parent)throw new Error("can't add child, component has a parent");if(e.graph!==this.graph)throw new Error("can't add child, component in different graph");e._parent=this,this._children.push(e),this.graph._removeRoot(e);const t={type:"hierarchy",add:!0,remove:!1,parent:this,child:e};this.traverseUp(!0,!1,!0,(e=>e.emit(t))),this.traverseDown(!1,!1,!0,(e=>e.emit(t))),this.system.emit(t)}removeChild(e){if(e._parent!==this)throw new Error("component not a child of this");const t={type:"hierarchy",add:!1,remove:!0,parent:this,child:e};this.traverseUp(!0,!1,!0,(e=>e.emit(t))),this.traverseDown(!1,!1,!0,(e=>e.emit(t))),this.system.emit(t);const n=this._children.indexOf(e);this._children.splice(n,1),e._parent=null,this.graph._addRoot(e)}onComponent(e){if(e.object===this)return;const t={type:"child",add:e.add,remove:e.remove,component:e.object};this.traverseUp(!0,!1,!0,(e=>e.emit(t)))}toJSON(){const e=super.toJSON();return this._children.length>0&&(e.children=this._children.map((e=>e.id))),e}referencesFromJSON(e){super.referencesFromJSON(e);const t=this.system.components.getDictionary();e.children&&e.children.forEach((e=>{const n=t[e];this.addChild(n)}))}toString(){return super.toString()+` - children: ${this.children.length}`}dump(e=""){super.dump(e),this.children.length>0&&(console.log(e+"%cChildren","color: purple"),this.children.forEach((t=>t.node.dump(e+" "))))}}Mt.typeName="CHierarchy";const Et=new Ve,Tt=new Ve,Ct=new Ue,At=new Ze;var Pt;!function(e){e[e.XYZ=0]="XYZ",e[e.YZX=1]="YZX",e[e.ZXY=2]="ZXY",e[e.XZY=3]="XZY",e[e.YXZ=4]="YXZ",e[e.ZYX=5]="ZYX"}(Pt||(Pt={}));class Rt extends Mt{constructor(e,t){super(e,t),this.ins=this.addInputs(Rt.transformIns),this.outs=this.addOutputs(Rt.transformOuts),this._object3D=this.createObject3D(),this._object3D.matrixAutoUpdate=!1}get transform(){return this}get object3D(){return this._object3D}get children(){return this._children||[]}get matrix(){return this._object3D.matrix}update(e){const t=this._object3D,{position:n,rotation:i,order:s,scale:r}=this.ins,{matrix:o}=this.outs;t.position.fromArray(n.value),Et.fromArray(i.value).multiplyScalar(vt.DEG2RAD);const a=s.getOptionText();return t.rotation.setFromVector3(Et,a),t.scale.fromArray(r.value),t.updateMatrix(),t.matrix.toArray(o.value),o.set(),!0}dispose(){this._object3D&&(this._object3D.children.slice().forEach((e=>this._object3D.remove(e))),this._object3D.parent&&this._object3D.parent.remove(this._object3D)),super.dispose()}setPropertiesFromMatrix(e){const t=!e;e=e||this._object3D.matrix;const{position:n,rotation:i,order:s,scale:r}=this.ins;e.decompose(Et,Ct,Tt),Et.toArray(n.value);const o=s.getOptionText();At.setFromQuaternion(Ct,o),At.toVector3(Et),Et.multiplyScalar(vt.RAD2DEG).toArray(i.value),Tt.toArray(r.value),n.set(t),i.set(t),r.set(t)}addChild(e){super.addChild(e),this._object3D.add(e._object3D)}removeChild(e){this._object3D.remove(e._object3D),super.removeChild(e)}createObject3D(){return new ft}}Rt.typeName="CTransform",Rt.transformIns={position:w("Transform.Position"),rotation:w("Transform.Rotation"),order:R("Transform.Order",Pt),scale:E("Transform.Scale")},Rt.transformOuts={matrix:S("Transform.Matrix")};class Lt{constructor(e=new Ve(1/0,1/0,1/0),t=new Ve(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,s=-1/0,r=-1/0,o=-1/0;for(let a=0,l=e.length;as&&(s=l),c>r&&(r=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(s,r,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,r=-1/0,o=-1/0;for(let a=0,l=e.count;as&&(s=l),c>r&&(r=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(s,r,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Dt),Dt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bt),jt.subVectors(this.max,Bt),It.subVectors(e.a,Bt),kt.subVectors(e.b,Bt),zt.subVectors(e.c,Bt),Ut.subVectors(kt,It),Vt.subVectors(zt,kt),Ft.subVectors(It,zt);let t=[0,-Ut.z,Ut.y,0,-Vt.z,Vt.y,0,-Ft.z,Ft.y,Ut.z,0,-Ut.x,Vt.z,0,-Vt.x,Ft.z,0,-Ft.x,-Ut.y,Ut.x,0,-Vt.y,Vt.x,0,-Ft.y,Ft.x,0];return!!Gt(t,It,kt,zt,jt)&&(t=[1,0,0,0,1,0,0,0,1],!!Gt(t,It,kt,zt,jt)&&($t.crossVectors(Ut,Vt),t=[$t.x,$t.y,$t.z],Gt(t,It,kt,zt,jt)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Dt.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(Dt).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Nt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Nt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Nt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Nt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Nt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Nt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Nt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Nt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Nt)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Lt.prototype.isBox3=!0;const Nt=[new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve],Dt=new Ve,Ot=new Lt,It=new Ve,kt=new Ve,zt=new Ve,Ut=new Ve,Vt=new Ve,Ft=new Ve,Bt=new Ve,jt=new Ve,$t=new Ve,Ht=new Ve;function Gt(e,t,n,i,s){for(let r=0,o=e.length-3;r<=o;r+=3){Ht.fromArray(e,r);const o=s.x*Math.abs(Ht.x)+s.y*Math.abs(Ht.y)+s.z*Math.abs(Ht.z),a=t.dot(Ht),l=n.dot(Ht),c=i.dot(Ht);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Wt=new Ve,qt=new Ve,Xt=new Ve,Yt=new Ve,Kt=new Ve,Jt=new Ve,Zt=new Ve;class Qt{constructor(e=new Ve,t=new Ve(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Wt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Wt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Wt.copy(this.direction).multiplyScalar(t).add(this.origin),Wt.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){qt.copy(e).add(t).multiplyScalar(.5),Xt.copy(t).sub(e).normalize(),Yt.copy(this.origin).sub(qt);const s=.5*e.distanceTo(t),r=-this.direction.dot(Xt),o=Yt.dot(this.direction),a=-Yt.dot(Xt),l=Yt.lengthSq(),c=Math.abs(1-r*r);let h,u,d,p;if(c>0)if(h=r*a-o,u=r*o-a,p=s*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+r*u+2*o)+u*(r*h+u+2*a)+l}else u=s,h=Math.max(0,-(r*u+o)),d=-h*h+u*(u+2*a)+l;else u=-s,h=Math.max(0,-(r*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-r*s+o)),u=h>0?-s:Math.min(Math.max(-s,-a),s),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-s,-a),s),d=u*(u+2*a)+l):(h=Math.max(0,-(r*s+o)),u=h>0?s:Math.min(Math.max(-s,-a),s),d=-h*h+u*(u+2*a)+l);else u=r>0?-s:s,h=Math.max(0,-(r*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Xt).multiplyScalar(u).add(qt),d}intersectSphere(e,t){Wt.subVectors(e.center,this.origin);const n=Wt.dot(this.direction),i=Wt.dot(Wt)-n*n,s=e.radius*e.radius;if(i>s)return null;const r=Math.sqrt(s-i),o=n-r,a=n+r;return o<0&&a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,r,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(s=(e.min.y-u.y)*c,r=(e.max.y-u.y)*c):(s=(e.max.y-u.y)*c,r=(e.min.y-u.y)*c),n>r||s>i?null:((s>n||n!=n)&&(n=s),(r=0?(o=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Wt)}intersectTriangle(e,t,n,i,s){Kt.subVectors(t,e),Jt.subVectors(n,e),Zt.crossVectors(Kt,Jt);let r,o=this.direction.dot(Zt);if(o>0){if(i)return null;r=1}else{if(!(o<0))return null;r=-1,o=-o}Yt.subVectors(this.origin,e);const a=r*this.direction.dot(Jt.crossVectors(Yt,Jt));if(a<0)return null;const l=r*this.direction.dot(Kt.cross(Yt));if(l<0)return null;if(a+l>o)return null;const c=-r*Yt.dot(Zt);return c<0?null:this.at(c/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class en{constructor(e,t,n=0,i=1/0){this.ray=new Qt(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new et,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return nn(e,this,n,t),n.sort(tn),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){ln.subVectors(e,this.center);const t=ln.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(ln.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?an.set(0,0,1).multiplyScalar(e.radius):an.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(on.copy(e.center).add(an)),this.expandByPoint(on.copy(e.center).sub(an)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const hn=new Ve,un=new Ve,dn=new Ve,pn=new Ve,mn=new Ve,fn=new Ve,gn=new Ve,vn=new Ve,yn=new Ve,bn=new Ve;class xn{constructor(e=new Ve,t=new Ve,n=new Ve){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),hn.subVectors(e,t),i.cross(hn);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){hn.subVectors(i,t),un.subVectors(n,t),dn.subVectors(e,t);const r=hn.dot(hn),o=hn.dot(un),a=hn.dot(dn),l=un.dot(un),c=un.dot(dn),h=r*l-o*o;if(0===h)return s.set(-2,-1,-1);const u=1/h,d=(l*a-o*c)*u,p=(r*c-o*a)*u;return s.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,pn),pn.x>=0&&pn.y>=0&&pn.x+pn.y<=1}static getUV(e,t,n,i,s,r,o,a){return this.getBarycoord(e,t,n,i,pn),a.set(0,0),a.addScaledVector(s,pn.x),a.addScaledVector(r,pn.y),a.addScaledVector(o,pn.z),a}static isFrontFacing(e,t,n,i){return hn.subVectors(n,t),un.subVectors(e,t),hn.cross(un).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return hn.subVectors(this.c,this.b),un.subVectors(this.a,this.b),.5*hn.cross(un).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return xn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return xn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return xn.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return xn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return xn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let r,o;mn.subVectors(i,n),fn.subVectors(s,n),vn.subVectors(e,n);const a=mn.dot(vn),l=fn.dot(vn);if(a<=0&&l<=0)return t.copy(n);yn.subVectors(e,i);const c=mn.dot(yn),h=fn.dot(yn);if(c>=0&&h<=c)return t.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return r=a/(a-c),t.copy(n).addScaledVector(mn,r);bn.subVectors(e,s);const d=mn.dot(bn),p=fn.dot(bn);if(p>=0&&d<=p)return t.copy(s);const m=d*l-a*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(fn,o);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return gn.subVectors(s,i),o=(h-c)/(h-c+(d-p)),t.copy(i).addScaledVector(gn,o);const g=1/(f+m+u);return r=m*g,o=u*g,t.copy(n).addScaledVector(mn,r).addScaledVector(fn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let _n=0;class wn extends Qe{constructor(){super(),Object.defineProperty(this,"id",{value:_n++}),this.uuid=Ne(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=H,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_e,this.stencilZFail=_e,this.stencilZPass=_e,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),s=i(e.images);t.length>0&&(n.textures=t),s.length>0&&(n.images=s)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}wn.prototype.isMaterial=!0;const Sn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Mn={h:0,s:0,l:0},En={h:0,s:0,l:0};function Tn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Cn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function An(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class Pn{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Oe(e,1),t=De(t,0,1),n=De(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,s=2*n-i;this.r=Tn(s,i,e+1/3),this.g=Tn(s,i,e),this.b=Tn(s,i,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const i=n[1],s=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const n=parseFloat(e[1])/360,i=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,i,s)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===t)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Sn[e.toLowerCase()];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Cn(e.r),this.g=Cn(e.g),this.b=Cn(e.b),this}copyLinearToSRGB(e){return this.r=An(e.r),this.g=An(e.g),this.b=An(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,s=Math.max(t,n,i),r=Math.min(t,n,i);let o,a;const l=(r+s)/2;if(r===s)o=0,a=0;else{const e=s-r;switch(a=l<=.5?e/(s+r):e/(2-s-r),s){case t:o=(n-i)/e+(na&&e>v?ev?a=0;--t)if(e[t]>65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function Vn(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}let Fn=0;const Bn=new je,jn=new ft,$n=new Ve,Hn=new Lt,Gn=new Lt,Wn=new Ve;class qn extends Qe{constructor(){super(),Object.defineProperty(this,"id",{value:Fn++}),this.uuid=Ne(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Un(e)?kn:In)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new tt).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return Bn.makeRotationFromQuaternion(e),this.applyMatrix4(Bn),this}rotateX(e){return Bn.makeRotationX(e),this.applyMatrix4(Bn),this}rotateY(e){return Bn.makeRotationY(e),this.applyMatrix4(Bn),this}rotateZ(e){return Bn.makeRotationZ(e),this.applyMatrix4(Bn),this}translate(e,t,n){return Bn.makeTranslation(e,t,n),this.applyMatrix4(Bn),this}scale(e,t,n){return Bn.makeScale(e,t,n),this.applyMatrix4(Bn),this}lookAt(e){return jn.lookAt(e),jn.updateMatrix(),this.applyMatrix4(jn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter($n).negate(),this.translate($n.x,$n.y,$n.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let s=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],r=[];for(let t=0,i=n.length;t0&&(i[t]=r,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const s=e.morphAttributes;for(const e in s){const n=[],i=s[e];for(let e=0,s=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Kn.copy(n.boundingSphere),Kn.applyMatrix4(s),!1===e.ray.intersectsSphere(Kn))return;if(Xn.copy(s).invert(),Yn.copy(e.ray).applyMatrix4(Xn),null!==n.boundingBox&&!1===Yn.intersectsBox(n.boundingBox))return;let r;if(n.isBufferGeometry){const s=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==s)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:hi.clone(),object:e}}(e,t,n,i,Jn,Zn,Qn,ci);if(p){a&&(oi.fromBufferAttribute(a,c),ai.fromBufferAttribute(a,h),li.fromBufferAttribute(a,u),p.uv=xn.getUV(ci,Jn,Zn,Qn,oi,ai,li,new sn)),l&&(oi.fromBufferAttribute(l,c),ai.fromBufferAttribute(l,h),li.fromBufferAttribute(l,u),p.uv2=xn.getUV(ci,Jn,Zn,Qn,oi,ai,li,new sn));const e={a:c,b:h,c:u,normal:new Ve,materialIndex:0};xn.getNormal(Jn,Zn,Qn,e.normal),p.face=e}return p}ui.prototype.isMesh=!0;class pi extends qn{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,r=t/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=e/o,u=t/a,d=[],p=[],m=[],f=[];for(let e=0;e0)){l=i;break}l=i-1}if(i=l,n[i]===r)return i/(s-1);const c=n[i];return(i+(r-c)/(n[i+1]-c))/(s-1)}getTangent(e,t){const n=1e-4;let i=e-n,s=e+n;i<0&&(i=0),s>1&&(s=1);const r=this.getPoint(i),o=this.getPoint(s),a=t||(r.isVector2?new sn:new Ve);return a.copy(o).sub(r).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Ve,i=[],s=[],r=[],o=new Ve,a=new je;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Ve)}s[0]=new Ve,r[0]=new Ve;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),r[0].crossVectors(i[0],s[0]);for(let t=1;t<=e;t++){if(s[t]=s[t-1].clone(),r[t]=r[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(De(i[t-1].dot(i[t]),-1,1));s[t].applyMatrix4(a.makeRotationAxis(o,e))}r[t].crossVectors(i[t],s[t])}if(!0===t){let t=Math.acos(De(s[0].dot(s[e]),-1,1));t/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(t=-t);for(let n=1;n<=e;n++)s[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),r[n].crossVectors(i[n],s[n])}return{tangents:i,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class fi extends mi{constructor(e=0,t=0,n=1,i=1,s=0,r=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=o,this.aRotation=a}getPoint(e,t){const n=t||new sn,i=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(l)/s)+1)*s:0===c&&l===s-1&&(l=s-2,c=1),this.closed||l>0?o=i[(l-1)%s]:(yi.subVectors(i[0],i[1]).add(i[0]),o=yi);const h=i[l%s],u=i[(l+1)%s];if(this.closed||l+2i.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2];return n.set(Si(o,a.x,l.x,c.x,h.x),Si(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[s]-n,r=this.curves[s],o=r.getLength(),a=0===o?0:1-e/o;return r.getPointAt(a,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ii extends Oi{constructor(e){super(e),this.uuid=Ne(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*n){a=c=e[0],l=h=e[1];for(let t=n;tc&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return Vi(r,o,n,a,l,p),o};function zi(e,t,n,i,s){let r,o;if(s===function(e,t,n,i){let s=0;for(let r=t,o=n-i;r0)for(r=t;r=t;r-=i)o=ss(r,e[r],e[r+1],o);return o&&Zi(o,o.next)&&(rs(o),o=o.next),o}function Ui(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Zi(i,i.next)&&0!==Ji(i.prev,i,i.next))i=i.next;else{if(rs(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Vi(e,t,n,i,s,r,o){if(!e)return;!o&&r&&function(e,t,n,i){let s=e;do{null===s.z&&(s.z=qi(s.x,s.y,t,n,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,function(e){let t,n,i,s,r,o,a,l,c=1;do{for(n=e,e=null,r=null,o=0;n;){for(o++,i=n,a=0,t=0;t0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(s=n,n=n.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:e=s,s.prevZ=r,r=s;n=i}r.nextZ=null,c*=2}while(o>1)}(s)}(e,i,s,r);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,r?Bi(e,i,s,r):Fi(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),rs(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Vi(e=ji(Ui(e),t,n),t,n,i,s,r,2):2===o&&$i(e,t,n,i,s,r):Vi(Ui(e),t,n,i,s,r,1);break}}function Fi(e){const t=e.prev,n=e,i=e.next;if(Ji(t,n,i)>=0)return!1;let s=e.next.next;for(;s!==e.prev;){if(Yi(t.x,t.y,n.x,n.y,i.x,i.y,s.x,s.y)&&Ji(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function Bi(e,t,n,i){const s=e.prev,r=e,o=e.next;if(Ji(s,r,o)>=0)return!1;const a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,h=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,u=qi(a,l,t,n,i),d=qi(c,h,t,n,i);let p=e.prevZ,m=e.nextZ;for(;p&&p.z>=u&&m&&m.z<=d;){if(p!==e.prev&&p!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&Ji(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==e.prev&&m!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&Ji(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&Ji(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==e.prev&&m!==e.next&&Yi(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&Ji(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function ji(e,t,n){let i=e;do{const s=i.prev,r=i.next.next;!Zi(s,r)&&Qi(s,i,i.next,r)&&ns(s,r)&&ns(r,s)&&(t.push(s.i/n),t.push(i.i/n),t.push(r.i/n),rs(i),rs(i.next),i=e=r),i=i.next}while(i!==e);return Ui(i)}function $i(e,t,n,i,s,r){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Ki(o,e)){let a=is(o,e);return o=Ui(o,o.next),a=Ui(a,a.next),Vi(o,t,n,i,s,r),void Vi(a,t,n,i,s,r)}e=e.next}o=o.next}while(o!==e)}function Hi(e,t){return e.x-t.x}function Gi(e,t){if(t=function(e,t){let n=t;const i=e.x,s=e.y;let r,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const e=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>o){if(o=e,e===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x=n.x&&n.x>=l&&i!==n.x&&Yi(sr.x||n.x===r.x&&Wi(r,n)))&&(r=n,u=h)),n=n.next}while(n!==a);return r}(e,t),t){const n=is(t,e);Ui(t,t.next),Ui(n,n.next)}}function Wi(e,t){return Ji(e.prev,e,t.prev)<0&&Ji(t.next,e,e.next)<0}function qi(e,t,n,i,s){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Xi(e){let t=e,n=e;do{(t.x=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(r-a)-(s-o)*(i-a)>=0}function Ki(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Qi(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(ns(e,t)&&ns(t,e)&&function(e,t){let n=e,i=!1;const s=(e.x+t.x)/2,r=(e.y+t.y)/2;do{n.y>r!=n.next.y>r&&n.next.y!==n.y&&s<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Ji(e.prev,e,t.prev)||Ji(e,t.prev,t))||Zi(e,t)&&Ji(e.prev,e,e.next)>0&&Ji(t.prev,t,t.next)>0)}function Ji(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Zi(e,t){return e.x===t.x&&e.y===t.y}function Qi(e,t,n,i){const s=ts(Ji(e,t,n)),r=ts(Ji(e,t,i)),o=ts(Ji(n,i,e)),a=ts(Ji(n,i,t));return s!==r&&o!==a||(!(0!==s||!es(e,n,t))||(!(0!==r||!es(e,i,t))||(!(0!==o||!es(n,e,i))||!(0!==a||!es(n,t,i)))))}function es(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ts(e){return e>0?1:e<0?-1:0}function ns(e,t){return Ji(e.prev,e,e.next)<0?Ji(e,t,e.next)>=0&&Ji(e,e.prev,t)>=0:Ji(e,t,e.prev)<0||Ji(e,e.next,t)<0}function is(e,t){const n=new os(e.i,e.x,e.y),i=new os(t.i,t.x,t.y),s=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function ss(e,t,n,i){const s=new os(e,t,n);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function rs(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function os(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class as{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s2&&e[t-1].equals(e[0])&&e.pop()}function cs(e,t){for(let n=0;n{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t})(),ps=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,ms=(()=>{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))})(),fs=(/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent));var gs,vs,ys;!function(e){e[e.mm=0]="mm",e[e.cm=1]="cm",e[e.m=2]="m",e[e.km=3]="km",e[e.in=4]="in",e[e.ft=5]="ft",e[e.yd=6]="yd",e[e.mi=7]="mi"}(gs||(gs={})),function(e){e[e.EN=0]="EN",e[e.ES=1]="ES",e[e.DE=2]="DE"}(vs||(vs={})),function(e){e.EN="English",e.ES="Spanish (Español)",e.DE="German (Deutsche)"}(ys||(ys={}));const bs=new Ve,xs=new Ve,_s=new je,ws=new Ue,Ss=new Ze;class Ms extends Rt{get settingProperties(){return[this.ins.position,this.ins.rotation,this.ins.scale]}get snapshotProperties(){return[this.ins.position,this.ins.rotation,this.ins.scale]}fromData(e){const{position:t,rotation:n,order:i,scale:s}=this.ins,r=Pt[i.getValidatedValue()];e.matrix?(_s.fromArray(e.matrix),_s.decompose(bs,ws,xs),bs.toArray(t.value),Ss.setFromQuaternion(ws,r),Ss.toVector3(bs).multiplyScalar(Le).toArray(n.value),xs.toArray(s.value),t.set(),n.set(),s.set()):(e.translation&&t.setValue(e.translation.slice()),e.rotation&&(ws.fromArray(e.rotation),Ss.setFromQuaternion(ws,r),Ss.toVector3(bs).multiplyScalar(Le).toArray(n.value),n.set()),e.scale&&s.setValue(e.scale.slice()),this.transform.changed=!0)}toData(){this.object3D.matrix.decompose(bs,ws,xs);const e={};return 0===bs.x&&0===bs.y&&0===bs.z||(e.translation=bs.toArray()),0===ws.x&&0===ws.y&&0===ws.z&&1===ws.w||(e.rotation=ws.toArray()),1===xs.x&&1===xs.y&&1===xs.z||(e.scale=xs.toArray()),e}}Ms.typeName="CVNode",Ms.text="Transform",Ms.icon="";class Es extends ft{constructor(){super(),this.type="Group"}}Es.prototype.isGroup=!0;class Ts extends wn{constructor(e){super(),this.type="LineBasicMaterial",this.color=new Pn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}Ts.prototype.isLineBasicMaterial=!0;const Cs=new Ve,As=new Ve,Ps=new je,Rs=new Qt,Ls=new cn;class Ns extends ft{constructor(e=new qn,t=new Ts){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;ea)continue;u.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(u);de.far||t.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,r.start),i=Math.min(s.count,r.start+r.count)-1;na)continue;u.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ns.prototype.isLine=!0;const Ds=new Ve,Os=new Ve;class Is extends Ns{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}},Vs=`{{lit-${String(Math.random()).slice(2)}}}`,Fs=`\x3c!--${Vs}--\x3e`,Bs=new RegExp(`${Vs}|${Fs}`),js="$lit$";class $s{constructor(e,t){this.parts=[],this.element=t;const n=[],i=[],s=document.createTreeWalker(t.content,133,null,!1);let r=0,o=-1,a=0;const{strings:l,values:{length:c}}=e;for(;a0;){const t=l[a],n=qs.exec(t)[2],i=n.toLowerCase()+js,s=e.getAttribute(i);e.removeAttribute(i);const r=s.split(Bs);this.parts.push({type:"attribute",index:o,name:n,strings:r}),a+=r.length-1}}"TEMPLATE"===e.tagName&&(i.push(e),s.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(Vs)>=0){const i=e.parentNode,s=t.split(Bs),r=s.length-1;for(let t=0;t{const n=e.length-t.length;return n>=0&&e.slice(n)===t},Gs=e=>-1!==e.index,Ws=()=>document.createComment(""),qs=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Xs(e,t){const{element:{content:n},parts:i}=e,s=document.createTreeWalker(n,133,null,!1);let r=Ks(i),o=i[r],a=-1,l=0;const c=[];let h=null;for(;s.nextNode();){a++;const e=s.currentNode;for(e.previousSibling===h&&(h=null),t.has(e)&&(c.push(e),null===h&&(h=e)),null!==h&&l++;void 0!==o&&o.index===a;)o.index=null!==h?-1:o.index-l,r=Ks(i,r),o=i[r]}c.forEach((e=>e.parentNode.removeChild(e)))}const Ys=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},Ks=(e,t=-1)=>{for(let n=t+1;n"function"==typeof e&&Js.has(e),Qs={},er={};class tr{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=zs?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let s,r=0,o=0,a=i.nextNode();for(;re}),ir=` ${Vs} `;class sr{constructor(e,t,n,i){this.strings=e,this.values=t,this.type=n,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let i=0;i-1||n)&&-1===e.indexOf("--\x3e",s+1);const r=qs.exec(e);t+=null===r?e+(n?ir:Fs):e.substr(0,r.index)+r[1]+r[2]+js+r[3]+Vs}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==nr&&(t=nr.createHTML(t)),e.innerHTML=t,e}}const rr=e=>null===e||!("object"==typeof e||"function"==typeof e),or=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class ar{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e{try{const e={get capture(){return pr=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class mr{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;Zs(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Qs,e(this)}if(this.__pendingValue===Qs)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=fr(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=Qs}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const fr=e=>e&&(pr?{capture:e.capture,passive:e.passive,once:e.once}:e.capture);function gr(e){let t=vr.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},vr.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const i=e.strings.join(Vs);return n=t.keyString.get(i),void 0===n&&(n=new $s(e,e.getTemplateElement()),t.keyString.set(i,n)),t.stringsArray.set(e.strings,n),n}const vr=new Map,yr=new WeakMap,br=(e,t,n)=>{let i=yr.get(t);void 0===i&&(Us(t,t.firstChild),yr.set(t,i=new cr(Object.assign({templateFactory:gr},n))),i.appendInto(t)),i.setValue(e),i.commit()};const xr=new class{handleAttributeExpressions(e,t,n,i){const s=t[0];if("."===s){return new ur(e,t.slice(1),n).parts}if("@"===s)return[new mr(e,t.slice(1),i.eventContext)];if("?"===s)return[new hr(e,t.slice(1),n)];return new ar(e,t,n).parts}handleTextExpression(e){return new cr(e)}};"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const _r=(e,...t)=>new sr(e,t,"html",xr),wr=(e,t)=>`${e}--${t}`;let Sr=!0;void 0===window.ShadyCSS?Sr=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Sr=!1);const Mr=e=>t=>{const n=wr(t.type,e);let i=vr.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},vr.set(n,i));let s=i.stringsArray.get(t.strings);if(void 0!==s)return s;const r=t.strings.join(Vs);if(s=i.keyString.get(r),void 0===s){const n=t.getTemplateElement();Sr&&window.ShadyCSS.prepareTemplateDom(n,e),s=new $s(t,n),i.keyString.set(r,s)}return i.stringsArray.set(t.strings,s),s},Er=["html","svg"],Tr=new Set,Cr=(e,t,n)=>{Tr.add(e);const i=n?n.element:document.createElement("template"),s=t.querySelectorAll("style"),{length:r}=s;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(i,e);const o=document.createElement("style");for(let e=0;e{Er.forEach((t=>{const n=vr.get(wr(t,e));void 0!==n&&n.keyString.forEach((e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{n.add(e)})),Xs(e,n)}))}))})(e);const a=i.content;n?function(e,t,n=null){const{element:{content:i},parts:s}=e;if(null==n)return void i.appendChild(t);const r=document.createTreeWalker(i,133,null,!1);let o=Ks(s),a=0,l=-1;for(;r.nextNode();)for(l++,r.currentNode===n&&(a=Ys(t),n.parentNode.insertBefore(t,n));-1!==o&&s[o].index===l;){if(a>0){for(;-1!==o;)s[o].index+=a,o=Ks(s,o);return}o=Ks(s,o)}}(n,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(n){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),Xs(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const Ar={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Pr=(e,t)=>t!==e&&(t==t||e==e),Rr={attribute:!0,type:String,converter:Ar,reflect:!1,hasChanged:Pr},Lr="finalized";class Nr extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,n)=>{const i=this._attributeNameForProperty(n,t);void 0!==i&&(this._attributeToPropertyMap.set(i,n),e.push(i))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=Rr){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this.requestUpdateInternal(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Rr}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Lr)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=Pr){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,i=t.converter||Ar,s="function"==typeof i?i:i.fromAttribute;return s?s(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,i=t.converter;return(i&&i.toAttribute||Ar.toAttribute)(e,n)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=Rr){const i=this.constructor,s=i._attributeNameForProperty(e,n);if(void 0!==s){const e=i._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(s):this.setAttribute(s,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){const e=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,n){let i=!0;if(void 0!==e){const s=this.constructor;n=n||s.getPropertyOptions(e),s._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}Nr.finalized=!0;const Dr=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(n){n.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(n){n.createProperty(t.key,e)}};function Or(e){return(t,n)=>void 0!==n?((e,t,n)=>{t.constructor.createProperty(n,e)})(e,t,n):Dr(e,t)}const Ir=Element.prototype;Ir.msMatchesSelector||Ir.webkitMatchesSelector;const kr=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zr=Symbol();class Ur{constructor(e,t){if(t!==zr)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(kr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const Vr={};class Fr extends Nr{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight(((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e)),n),n=t(e,new Set),i=[];n.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!kr){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new Ur(String(t),zr)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?kr?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==Vr&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return Vr}}Fr.finalized=!0,Fr.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const i=n.scopeName,s=yr.has(t),r=Sr&&11===t.nodeType&&!!t.host,o=r&&!Tr.has(i),a=o?document.createDocumentFragment():t;if(br(e,a,Object.assign({templateFactory:Mr(i)},n)),o){const e=yr.get(a);yr.delete(a);const n=e.value instanceof tr?e.value.template:void 0;Cr(i,a,n),Us(t,t.firstChild),t.appendChild(a),yr.set(t,e)}!s&&r&&window.ShadyCSS.styleElement(t.host)},Fr.shadowRootOptions={mode:"open"};const Br=(e,t)=>{const n=e.startNode.parentNode,i=void 0===t?e.endNode:t.startNode,s=n.insertBefore(Ws(),i);n.insertBefore(Ws(),i);const r=new cr(e.options);return r.insertAfterNode(s),r},jr=(e,t)=>(e.setValue(t),e.commit(),e),$r=(e,t,n)=>{const i=e.startNode.parentNode,s=n?n.startNode:e.endNode,r=t.endNode.nextSibling;r!==s&&((e,t,n=null,i=null)=>{for(;t!==n;){const n=t.nextSibling;e.insertBefore(t,i),t=n}})(i,t.startNode,r,s)},Hr=e=>{Us(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},Gr=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Wr=new WeakMap,qr=new WeakMap;Xr=(e,t,n)=>{let i;return void 0===n?n=t:void 0!==t&&(i=t),t=>{if(!(t instanceof cr))throw new Error("repeat can only be used in text bindings");const s=Wr.get(t)||[],r=qr.get(t)||[],o=[],a=[],l=[];let c,h,u=0;for(const t of e)l[u]=i?i(t,u):u,a[u]=n(t,u),u++;let d=0,p=s.length-1,m=0,f=a.length-1;for(;d<=p&&m<=f;)if(null===s[d])d++;else if(null===s[p])p--;else if(r[d]===l[m])o[m]=jr(s[d],a[m]),d++,m++;else if(r[p]===l[f])o[f]=jr(s[p],a[f]),p--,f--;else if(r[d]===l[f])o[f]=jr(s[d],a[f]),$r(t,s[d],o[f+1]),d++,f--;else if(r[p]===l[m])o[m]=jr(s[p],a[m]),$r(t,s[p],s[d]),p--,m++;else if(void 0===c&&(c=Gr(l,m,f),h=Gr(r,d,p)),c.has(r[d]))if(c.has(r[p])){const e=h.get(l[m]),n=void 0!==e?s[e]:null;if(null===n){const e=Br(t,s[d]);jr(e,a[m]),o[m]=e}else o[m]=jr(n,a[m]),$r(t,n,s[d]),s[e]=null;m++}else Hr(s[p]),p--;else Hr(s[d]),d++;for(;m<=f;){const e=Br(t,o[f+1]);jr(e,a[m]),o[m++]=e}for(;d<=p;){const e=s[d++];null!==e&&Hr(e)}Wr.set(t,o),qr.set(t,l)}};var Xr,Yr,Kr=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Jr=Yr=class extends Fr{constructor(){super(...arguments),this._isFirstConnected=!1}static setStyle(e,t){Object.assign(e.style,t)}static setAttribs(e,t){for(let n in t)e.setAttribute(n,t[n])}get shady(){return this.constructor.shady}appendTo(e){return e.appendChild(this),this}removeChildren(){for(;this.firstChild;)this.removeChild(this.firstChild)}getChildrenArray(){return Array.from(this.children)}appendElement(e,t){return this.createElement(e,t,this)}createElement(e,t,n){let i;return i="string"==typeof e?document.createElement(e):e instanceof HTMLElement?e:new e,t&&Object.assign(i.style,t),n&&n.appendChild(i),i}setStyle(e){return Yr.setStyle(this,e),this}setAttribute(e,t){return super.setAttribute(e,t),this}setAttributes(e){return Yr.setAttribs(this,e),this}addClass(...e){return e.forEach((e=>this.classList.add(e))),this}removeClass(...e){return e.forEach((e=>this.classList.remove(e))),this}setClass(e,t){return t?this.classList.add(e):this.classList.remove(e),this}hasFocus(){return document.activeElement===this}on(e,t,n){return this.addEventListener(e,t,n),this}off(e,t,n){return this.removeEventListener(e,t,n),this}connectedCallback(){this._isFirstConnected||(this._isFirstConnected=!0,this.firstConnected()),this.connected(),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.disconnected()}createRenderRoot(){return this.shady?super.createRenderRoot():this}firstConnected(){}connected(){}disconnected(){}onUpdate(){this.requestUpdate()}};Jr.tagName="ff-custom-element",Jr.shady=!1,Jr=Yr=Kr([Qr("ff-custom-element")],Jr);const Zr=Jr;function Qr(e){return t=>(t.tagName=e,customElements.define(t.tagName,t),t)}var eo,to=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let no=eo=class extends Zr{constructor(e){super(),this.template=null,this.name=e||""}static add(e,t){if(eo.templates[e])throw new Error(`icon already registered: '${e}'`);eo.templates[e]=t}static getTemplateNames(){return Object.keys(eo.templates)}firstConnected(){this.classList.add("ff-icon")}render(){if(this.name){const e=this.constructor.templates[this.name];return e||console.warn(`icon not found: '${this.name}'`),e}return this.template?this.template:_r`[icon undefined]`}};no.templates={},to([Or({attribute:!1})],no.prototype,"template",void 0),to([Or({type:String})],no.prototype,"name",void 0),no=eo=to([Qr("ff-icon")],no);const io=no;no.add("empty",_r``),no.add("check",_r``),no.add("close",_r``),no.add("grip",_r``),no.add("up",_r``),no.add("down",_r``),no.add("caret-up",_r``),no.add("caret-down",_r``),no.add("folder",_r``),no.add("file",_r``),no.add("info",_r``),no.add("warning",_r``),no.add("error",_r``),no.add("prompt",_r``);var so,ro=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const oo={info:"ff-info",success:"ff-success",warning:"ff-warning",error:"ff-error"},ao={info:"info",success:"check",warning:"warning",error:"error"},lo={info:2e3,success:2e3,warning:5e3,error:0};let co=so=class extends Zr{constructor(e,t,n){super(),this._handler=0,this.on("transitionend",this.remove.bind(this)),this.message=e||"",this.level=t||"info",this.timeout=void 0!==n?n:lo[this.level];const i=(so.shadowRootNode||document).getElementById(so.stackId);i?i.appendChild(this):console.warn(`element '#${so.stackId}' not found`)}static show(e,t,n){new so(e,t,n)}close(){this._handler>0&&(window.clearTimeout(this._handler),this._handler=0),this.classList.add("ff-out")}firstUpdated(){this.classList.add("ff-notification",oo[this.level]),this.timeout>0&&(this._handler=window.setTimeout((()=>this.close()),this.timeout))}render(){const e=ao[this.level];return _r` -
${this.message}
- `}onClose(e){e.stopPropagation(),this.close()}};co.stackId="ff-notification-stack",co.shadowRootNode=null,ro([Or({type:String})],co.prototype,"message",void 0),ro([Or({type:String})],co.prototype,"level",void 0),ro([Or({type:Number})],co.prototype,"timeout",void 0),co=so=ro([Qr("ff-notification")],co);const ho=co;let uo;class po{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===uo&&(uo=Vn("canvas")),uo.width=e.width,uo.height=e.height;const n=uo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=uo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Vn("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let e=0;e1)switch(this.wrapS){case Y:e.x=e.x-Math.floor(e.x);break;case K:e.x=e.x<0?0:1;break;case J:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Y:e.y=e.y-Math.floor(e.y);break;case K:e.y=e.y<0?0:1;break;case J:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function go(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?po.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}fo.DEFAULT_IMAGE=void 0,fo.DEFAULT_MAPPING=300,fo.prototype.isTexture=!0;class vo extends Qe{constructor(e,t,n={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new Ln(0,0,e,t),this.scissorTest=!1,this.viewport=new Ln(0,0,e,t),this.texture=new fo(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:te,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=Object.assign({},e.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}function yo(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const s=e[n][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?t[n][i]=s.clone():Array.isArray(s)?t[n][i]=s.slice():t[n][i]=s}}return t}function bo(e){const t={};for(let n=0;n0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}_o.prototype.isShaderMaterial=!0;class wo extends _o{constructor(){super(...arguments),this.isIndexShader=!0,this.uniformsNeedUpdate=!1,this.lights=!1,this.uniforms={index:{value:[0,0,0]}},this.vertexShader=["void main() {"," #include "," #include ","}"].join("\n"),this.fragmentShader=["uniform vec3 index;","void main() {"," gl_FragColor = vec4(index, 1.0);","}"].join("\n")}static indexFromPixel(e){return e[0]+e[1]<<8+e[2]<<16}static zoneFromPixel(e){return e[3]}setIndex(e){const t=e>>16,n=(e>>8)-(t<<8),i=e-(t<<16)-(n<<8),s=this.uniforms.index.value;s[0]=i/255,s[1]=n/255,s[2]=t/255,this.uniformsNeedUpdate=!0}}class So extends _o{constructor(){super(...arguments),this.isPositionShader=!0,this.uniforms={index:{value:0},range:{value:[-1,1]}},this.vertexShader=["varying vec3 vLocalPosition;","void main() {"," #include "," #include "," vLocalPosition = vec3(position);","}"].join("\n"),this.fragmentShader=["uniform float index;","uniform vec2 range;","varying vec3 vLocalPosition;","vec4 toVec4(float v) {"," float vn = (v - range.x) / (range.y - range.x);"," float b0 = floor(vn * 255.0) / 255.0; vn = (vn - b0) * 256.0;"," float b1 = floor(vn * 255.0) / 255.0; vn = (vn - b1) * 256.0;"," float b2 = floor(vn * 255.0) / 255.0; vn = (vn - b2) * 256.0;"," float b3 = floor(vn * 255.0) / 255.0;"," return vec4(clamp(b0, 0.0, 1.0), clamp(b1, 0.0, 1.0), clamp(b2, 0.0, 1.0), clamp(b3, 0.0, 1.0));","}","void main() {"," gl_FragColor = (index == 0.0 ? toVec4(vLocalPosition.x)"," : (index == 1.0 ? toVec4(vLocalPosition.y) : toVec4(vLocalPosition.z)));","}"].join("\n")}}class Mo extends _o{constructor(){super(...arguments),this.isNormalShader=!0,this.uniforms={index:{value:0}},this.vertexShader=["varying vec3 vLocalNormal;","void main() {"," #include "," #include "," #include "," vLocalNormal = vec3(normal);","}"].join("\n"),this.fragmentShader=["uniform vec3 index;","varying vec3 vLocalNormal;","void main() {"," vec3 normal = normalize(vLocalNormal);"," gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);","}"].join("\n")}}const Eo=new Ve,To=new Pn,Co=1e4,Ao=new Lt(new Ve(-1e4,-1e4,-1e4),new Ve(Co,Co,Co));class Po{constructor(e){this.renderer=e,this.pickTextures=[];for(let e=0;e<3;++e)this.pickTextures[e]=new vo(1,1,{stencilBuffer:!1});this.pickBuffer=new Uint8Array(4),this.indexShader=new wo,this.positionShader=new So,this.normalShader=new Mo}static add(e,t){const n=e=>{e.material&&(e.onBeforeRender=function(t,n,i,s,r){r.isIndexShader&&r.setIndex(e.id)})};t?e.traverse((e=>n(e))):n(e)}static remove(e,t){const n=e=>{e.material&&(e.onBeforeRender=null)};t?e.traverse((e=>n(e))):n(e)}pickObject(e,t,n){const i=this.pickIndex(e,t,n);if(i>0)return e.getObjectById(i)}pickIndex(e,t,n){const i=n.viewport;(t=i.updateCamera(t)).layers.disable(1);const s=e.overrideMaterial;e.overrideMaterial=this.indexShader;const r=this.renderer,o=this.pickTextures[0];r.getClearColor(To),i.applyPickViewport(o,n),r.setRenderTarget(o),r.setClearColor(0);const a=r.xr.enabled;r.xr.enabled=!1,r.clear(),r.render(e,t),r.xr.enabled=a,r.setRenderTarget(null),r.setClearColor(To),e.overrideMaterial=s,t.layers.enable(1);const l=this.pickBuffer;return r.readRenderTargetPixels(o,0,0,1,1,l),l[0]+256*l[1]+65536*l[2]}pickPosition(e,t,n,i,s){i=i||Ao,s=s||new Ve;const r=n.viewport;(t=r.updateCamera(t)).layers.disable(1);const o=e.overrideMaterial,a=e.overrideMaterial=this.positionShader,l=this.renderer,c=this.pickTextures;l.getClearColor(To),l.setClearColor(0);for(let s=0;s<3;++s)a.uniforms.index.value=s,a.uniforms.range.value[0]=i.min.getComponent(s),a.uniforms.range.value[1]=i.max.getComponent(s),r.applyPickViewport(c[s],n),l.setRenderTarget(c[s]),l.clear(),l.render(e,t);l.setRenderTarget(null),l.setClearColor(To),e.overrideMaterial=o,t.layers.enable(1);const h=this.pickBuffer;for(let e=0;e<3;++e)l.readRenderTargetPixels(c[e],0,0,1,1,h),s.setComponent(e,2.337437050015319e-10*h[3]+5.983838848039216e-8*h[2]+1531862745098039e-20*h[1]+.003921568627451*h[0]);return i.getSize(Eo),s.multiply(Eo).add(i.min)}pickNormal(e,t,n,i){i=i||new Ve;const s=n.viewport;(t=s.updateCamera(t)).layers.disable(1);const r=e.overrideMaterial;e.overrideMaterial=this.normalShader;const o=this.renderer,a=this.pickTextures[0];o.getClearColor(To),s.applyPickViewport(a,n),o.setRenderTarget(a),o.setClearColor(0),o.clear(),o.render(e,t),o.setRenderTarget(null),o.setClearColor(To),e.overrideMaterial=r,t.layers.enable(1);const l=this.pickBuffer;return o.readRenderTargetPixels(a,0,0,1,1,l),i.set(l[0]/255*2-1,l[1]/255*2-1,l[2]/255*2-1).normalize()}}class Ro extends ft{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}Ro.prototype.isScene=!0;const Lo={view:null,viewport:null,renderer:null,scene:null,camera:null},No={type:"before-render",component:null,context:Lo},Do={type:"after-render",component:null,context:Lo},Oo={activate:D("Scene.Activate")};class Io extends Rt{constructor(e,t){super(e,t),this._activeCameraComponent=null,this._preRenderList=[],this._postRenderList=[],this._renderListsNeedUpdate=!0,this.ins=this.addInputs(Oo,0),this.addEvents("before-render","after-render","active-camera")}get scene(){return this.object3D}get activeCameraComponent(){return this._activeCameraComponent}set activeCameraComponent(e){if(e!==this._activeCameraComponent){const t=this._activeCameraComponent;this._activeCameraComponent=e;const n={type:"active-camera",previous:t,next:e};this.emit(n)}}get activeCamera(){return this._activeCameraComponent?this._activeCameraComponent.camera:null}get renderer(){return this.getMainComponent(Ae)}create(){super.create(),this.on("hierarchy",this.shouldUpdateRenderLists,this),this.on("child",this.shouldUpdateRenderLists,this);const e=this.renderer;e&&!e.activeSceneComponent&&(e.activeSceneComponent=this)}update(e){if(super.update(e),this.ins.activate.changed){const e=this.renderer;e&&(e.activeSceneComponent=this)}return!0}tick(e){return this._renderListsNeedUpdate&&(this.updateRenderLists(),this._renderListsNeedUpdate=!1),!1}dispose(){const e=this.renderer;e&&e.activeSceneComponent===this&&(e.activeSceneComponent=null),this.off("hierarchy",this.shouldUpdateRenderLists,this),this.off("child",this.shouldUpdateRenderLists,this),super.dispose()}preRender(e){const t=this._preRenderList;for(let n=0,i=t.length;n(e.preRender&&this._preRenderList.push(e),e.postRender&&this._postRenderList.push(e),!1))),this.changed=!0}_onBeforeRender(e,t,n){Lo.view=e.__view,Lo.viewport=e.__viewport,Lo.renderer=e,Lo.scene=t,Lo.camera=n,this.preRender(Lo),No.component=this,this.emit(No)}_onAfterRender(e,t,n){Lo.view=e.__view,Lo.viewport=e.__viewport,Lo.renderer=e,Lo.scene=t,Lo.camera=n,this.postRender(Lo),Do.component=this,this.emit(Do)}}Io.typeName="CScene",Io.isGraphSingleton=!0;const ko=new Ve;class zo extends j{constructor(e,t){super(e,t),this.ins=this.addInputs(zo.object3DIns),this.outs=this.addOutputs(zo.object3DOuts),this._object3D=null,this._isPickable=!1,this.addEvent("object"),this.node.components.on(this.parentComponentClass,this._onParent,this)}get parentComponentClass(){return this.constructor.parentComponentClass}get parentComponent(){return this.node.components.get(this.parentComponentClass,!0)}get transform(){return this.node.components.get(Rt,!0)}get scene(){const e=this.transform;return e?e.getParentComponent(Io,!0):void 0}get object3D(){return this._object3D}set object3D(e){const t=this._object3D;if(t&&(t.userData.component=null,this.unregisterPickableObject3D(t,!0),t.parent&&this.onRemoveFromParent(t.parent)),this.emit({type:"object",current:t,next:e}),this._object3D=e,e){e.userData.component=this,e.matrixAutoUpdate=!1,e.visible=this.ins.visible.value,this.registerPickableObject3D(e,!0);const t=this.parentComponent;t&&this.onAddToParent(t.object3D)}}update(e){const{visible:t,pickable:n}=this.ins;return t.changed&&this._object3D&&(this._object3D.visible=t.value),n.changed&&n.value!==this._isPickable&&(this._isPickable=n.value,n.value?this.enablePointerEvents():this.disablePointerEvents()),!0}dispose(){this.object3D=null,this.ins.pickable.value&&this.disablePointerEvents(),this.node.components.off(this.parentComponentClass,this._onParent,this),super.dispose()}preRender(e){}postRender(e){}toString(){return super.toString()+(this._object3D?` - type: ${this._object3D.type}`:" - (null)")}onPointer(e){const t=this.outs;"pointer-down"===e.type?(t.pointerDown.set(),t.pointerActive.setValue(!0)):"pointer-up"===e.type&&(t.pointerUp.set(),t.pointerActive.setValue(!1)),e.stopPropagation=!0}enablePointerEvents(){this.on("pointer-down",this.onPointer,this),this.on("pointer-up",this.onPointer,this)}disablePointerEvents(){this.off("pointer-down",this.onPointer,this),this.off("pointer-up",this.onPointer,this);const e=this.outs;e.pointerActive.value&&(e.pointerUp.set(),e.pointerActive.setValue(!1))}updateTransform(){const e=this._object3D;if(!e)return;const{position:t,rotation:n,order:i,scale:s}=this.ins;if(t.changed||n.changed||i.changed||s.changed){e.position.fromArray(t.value),ko.fromArray(n.value).multiplyScalar(Re);const r=i.getOptionText();e.rotation.setFromVector3(ko,r),e.scale.fromArray(s.value),e.updateMatrix()}return!0}onAddToParent(e){e.add(this._object3D)}onRemoveFromParent(e){e.remove(this._object3D)}addObject3D(e){this._object3D.add(e),this.registerPickableObject3D(e,!0)}removeObject3D(e){this.unregisterPickableObject3D(e,!0),this._object3D.remove(e)}registerPickableObject3D(e,t){Po.add(e,t)}unregisterPickableObject3D(e,t){Po.remove(e,t)}_onParent(e){this._object3D&&!this._object3D.parent&&e.add&&this.onAddToParent(e.object.object3D)}}zo.typeName="CObject3D",zo.parentComponentClass=Rt,zo.object3DIns={visible:C("Object.Visible",!0),pickable:C("Object.Pickable")},zo.object3DOuts={pointerDown:D("Pointer.Down"),pointerUp:D("Pointer.Up"),pointerActive:C("Pointer.Active")},zo.transformIns=Rt.transformIns,zo.prototype.preRender=null,zo.prototype.postRender=null;const Uo=new Ve,Vo=new je,Fo=new Ze;new Ue;function Bo(e,t,n){const i=n||new Ue;return Uo.fromArray(e).multiplyScalar(Re),Fo.setFromVector3(Uo,t),i.setFromEuler(Fo),i}function jo(e,t,n){const i=n||[0,0,0];return Fo.setFromQuaternion(e,t),Fo.toVector3(Uo),Uo.multiplyScalar(Le).toArray(i),i}function $o(e){const t=new Map,n=new Map,i=new Map;e.traverse((e=>{const s=e;if(s.isMesh){const e=s.geometry;e&&t.set(e.uuid,e);const r=s.material;if(r){n.set(r.uuid,r);for(let e in r){const t=r[e];t&&t.isTexture&&i.set(t.uuid,t)}}}}));for(let e of i)e[1].dispose();for(let e of n)e[1].dispose();for(let e of t)e[1].dispose()}function Ho(e,t,n){n||(n=e);const i=e.geometry;if(i&&e.visible){let s=e;for(Vo.identity();s&&s!==n;)Vo.premultiply(s.matrix),s=s.parent;if(i.isGeometry){const e=i.vertices;for(let n=0,i=e.length;n 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\n\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\n\t// project rect onto sphere\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\n\t// calculate vector form factor\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n',bumpmap_pars_fragment:"\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",clipping_planes_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\tbool clipped = true;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\tif ( clipped ) discard;\n\n\t#endif\n\n#endif\n",clipping_planes_pars_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n",clipping_planes_pars_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n",clipping_planes_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n",color_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tdiffuseColor *= vColor;\n\n#elif defined( USE_COLOR )\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif\n",color_pars_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_pars_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvColor = vec4( 1.0 );\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvColor = vec3( 1.0 );\n\n#endif\n\n#ifdef USE_COLOR\n\n\tvColor *= color;\n\n#endif\n\n#ifdef USE_INSTANCING_COLOR\n\n\tvColor.xyz *= instanceColor.xyz;\n\n#endif\n",common:"\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n\treturn fract( sin( sn ) * c );\n\n}\n\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t// dir can be either a direction vector or a normal vector\n\t// upper-left 3x3 of matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nmat3 transposeMat3( const in mat3 m ) {\n\n\tmat3 tmp;\n\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\n\treturn tmp;\n\n}\n\n// https://en.wikipedia.org/wiki/Relative_luminance\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\n\treturn dot( weights, color.rgb );\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n\treturn m[ 2 ][ 3 ] == - 1.0;\n\n}\n\nvec2 equirectUv( in vec3 dir ) {\n\n\t// dir is assumed to be unit length\n\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\treturn vec2( u, v );\n\n}\n",cube_uv_reflection_fragment:"\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\n\t// These shader functions convert between the UV coordinates of a single face of\n\t// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n\t// sampling a textureCube (not generally normalized ).\n\n\tfloat getFace( vec3 direction ) {\n\n\t\tvec3 absDirection = abs( direction );\n\n\t\tfloat face = - 1.0;\n\n\t\tif ( absDirection.x > absDirection.z ) {\n\n\t\t\tif ( absDirection.x > absDirection.y )\n\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t} else {\n\n\t\t\tif ( absDirection.z > absDirection.y )\n\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t}\n\n\t\treturn face;\n\n\t}\n\n\t// RH coordinate system; PMREM face-indexing convention\n\tvec2 getUV( vec3 direction, float face ) {\n\n\t\tvec2 uv;\n\n\t\tif ( face == 0.0 ) {\n\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n\n\t\t} else if ( face == 1.0 ) {\n\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n\n\t\t} else if ( face == 2.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n\n\t\t} else if ( face == 3.0 ) {\n\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n\n\t\t} else if ( face == 4.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n\n\t\t} else {\n\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n\n\t\t}\n\n\t\treturn 0.5 * ( uv + 1.0 );\n\n\t}\n\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\n\t\tfloat face = getFace( direction );\n\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\n\t\tfloat faceSize = exp2( mipInt );\n\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\n\t\tif ( face > 2.0 ) {\n\n\t\t\tuv.y += faceSize;\n\n\t\t\tface -= 3.0;\n\n\t\t}\n\n\t\tuv.x += face * faceSize;\n\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\n\t\t}\n\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\n\t\tuv *= texelSize;\n\n\t\treturn texture2D( envMap, uv ).rgb;\n\n\t}\n\n\t// These defines must match with PMREMGenerator\n\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\n\tfloat roughnessToMip( float roughness ) {\n\n\t\tfloat mip = 0.0;\n\n\t\tif ( roughness >= r1 ) {\n\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\n\t\t} else if ( roughness >= r4 ) {\n\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\n\t\t} else if ( roughness >= r5 ) {\n\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\n\t\t} else if ( roughness >= r6 ) {\n\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\n\t\t} else {\n\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25\n\t\t}\n\n\t\treturn mip;\n\n\t}\n\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\n\t\tfloat mipF = fract( mip );\n\n\t\tfloat mipInt = floor( mip );\n\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\n\t\tif ( mipF == 0.0 ) {\n\n\t\t\treturn vec4( color0, 1.0 );\n\n\t\t} else {\n\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\n\t\t}\n\n\t}\n\n#endif\n",defaultnormal_vertex:"\nvec3 transformedNormal = objectNormal;\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// shear transforms in the instance matrix are not supported\n\n\tmat3 m = mat3( instanceMatrix );\n\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\n\ttransformedNormal = m * transformedNormal;\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#ifdef FLIP_SIDED\n\n\t\ttransformedTangent = - transformedTangent;\n\n\t#endif\n\n#endif\n",displacementmap_pars_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",displacementmap_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n\n#endif\n",emissivemap_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n",emissivemap_pars_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",encodings_fragment:"\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\n\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\n\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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 );\n}\n\n",envmap_fragment:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",envmap_common_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif\n",envmap_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n",envmap_pars_vertex:"\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n",envmap_physical_pars_fragment:"\n#if defined( USE_ENVMAP )\n\n\t#ifdef ENVMAP_MODE_REFRACTION\n\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 reflectVec;\n\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\n\t\t\t\t// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t\t#else\n\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\n\t\t\t#endif\n\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n#endif\n",envmap_vertex:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\n\n\tvFogDepth = - mvPosition.z;\n\n#endif\n",fog_pars_vertex:"\n#ifdef USE_FOG\n\n\tvarying float vFogDepth;\n\n#endif\n",fog_fragment:"\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",fog_pars_fragment:"\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n",gradientmap_pars_fragment:"\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\n\t#else\n\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\n\t#endif\n\n}\n",lightmap_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tlightMapIrradiance *= PI;\n\n\t#endif\n\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n\n#endif\n",lightmap_pars_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n",lights_lambert_vertex:"\nvec3 diffuse = vec3( 1.0 );\n\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\n\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\n\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\n\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n#ifdef DOUBLE_SIDED\n\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n\n#endif\n\n#if NUM_POINT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_SPOT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_DIR_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_HEMI_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n",lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\treturn irradiance;\n\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\n\t\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t\t// page 32, equation 26: E[window1]\n\t\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\t\tif ( cutoffDistance > 0.0 ) {\n\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t\t}\n\n\t\treturn distanceFalloff;\n\n\t#else\n\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t\t}\n\n\t\treturn 1.0;\n\n\t#endif\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",lights_toon_fragment:"\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\n",lights_toon_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct ToonMaterial {\n\n\tvec3 diffuseColor;\n\n};\n\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_phong_fragment:"\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\n\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n\n#ifdef IOR\n\n\t#ifdef SPECULAR\n\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\n\t\t#endif\n\n\t\t#ifdef USE_SPECULARCOLORMAP\n\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\n\t\t#endif\n\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\n\t#else\n\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\n\t#endif\n\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheenColor;\n\n\t#ifdef USE_SHEENCOLORMAP\n\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\n\t#endif\n\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\n\t#ifdef USE_SHEENROUGHNESSMAP\n\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\n\t#endif\n\n#endif\n",lights_physical_pars_fragment:'\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\n\n// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from \n// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found\n// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\n\treturn saturate( DG * RECIPROCAL_PI );\n\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\n\treturn fab;\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid 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 ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\n\t#endif\n\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\n\t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n',lights_fragment_begin:"\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tlightMapIrradiance *= PI;\n\n\t\t#endif\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\n\t#endif\n\n#endif\n",lights_fragment_end:"\n#if defined( RE_IndirectDiffuse )\n\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n\n#endif\n",logdepthbuf_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n",logdepthbuf_pars_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_pars_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\n\t#else\n\n\t\tuniform float logDepthBufFC;\n\n\t#endif\n\n#endif\n",logdepthbuf_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n\t#else\n\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\n\t\t\tgl_Position.z *= gl_Position.w;\n\n\t\t}\n\n\t#endif\n\n#endif\n",map_fragment:"\n#ifdef USE_MAP\n\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved)\n\n\t\tsampledDiffuseColor = 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 );\n\n\t#endif\n\n\tdiffuseColor *= sampledDiffuseColor;\n\n#endif\n",map_pars_fragment:"\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",map_particle_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, uv );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n",map_particle_pars_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tuniform mat3 uvTransform;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n",metalnessmap_pars_fragment:"\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n",morphnormal_vertex:"\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\n\t\t}\n\n\t#else\n\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\n\t#endif\n\n#endif\n",morphtarget_pars_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\tuniform float morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\n\t\t}\n\n\t#else\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\n\t\t#else\n\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",morphtarget_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\n\t\t\t#endif\n\n\t\t}\n\n\t#else\n\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",normal_fragment_begin:"\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n\n\t// Workaround for Adreno GPUs not able to do dFdx( vViewPosition )\n\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\t#ifdef USE_TANGENT\n\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\n\t\t#endif\n\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 geometryNormal = normal;\n\n",normal_fragment_maps:"\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( TANGENTSPACE_NORMALMAP )\n\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tnormal = normalize( vTBN * mapN );\n\n\t#else\n\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\n\t#endif\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n\n#endif\n",normal_pars_fragment:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_pars_vertex:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_vertex:"\n#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n",normalmap_pars_fragment:"\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\n\t// Normal Mapping Without Precomputed Tangents\n\t// http://www.thetenthplanet.de/archives/1180\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 N = surf_norm; // normalized\n\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\n\t}\n\n#endif\n",clearcoat_normal_fragment_begin:"\n#ifdef USE_CLEARCOAT\n\n\tvec3 clearcoatNormal = geometryNormal;\n\n#endif\n",clearcoat_normal_fragment_maps:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\n\t#else\n\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\n\t#endif\n\n#endif\n",clearcoat_pars_fragment:"\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n",output_fragment:"\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n\n// https://github.com/mrdoob/three.js/pull/22425\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\n\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n",packing:"\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\n\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\n\nconst float ShiftRight8 = 1. / 256.;\n\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\n\treturn r * PackUpscale;\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\n\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\n\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"\n#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n",dithering_pars_fragment:"\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift acording to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n",roughnessmap_fragment:"\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n",roughnessmap_pars_fragment:"\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n",shadowmap_pars_fragment:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): create uniforms for area light shadows\n\n\t#endif\n\t*/\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n\t}\n\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n\t\tfloat occlusion = 1.0;\n\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\n\t\tfloat hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n\t\tif (hard_shadow != 1.0 ) {\n\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality\n\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n\t\t}\n\t\treturn occlusion;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#else // no percentage-closer filtering:\n\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn shadow;\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// dp = normalized distance from light to fragment position\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n\t\tdp += shadowBias;\n\n\t\t// bd3D = base direction 3D\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#else // no percentage-closer filtering\n\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t#endif\n\n\t}\n\n#endif\n",shadowmap_pars_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n",shadowmap_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n",shadowmask_pars_fragment:"\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n",skinbase_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif\n",skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",skinning_vertex:"\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",skinnormal_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",specularmap_fragment:"\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n",specularmap_pars_fragment:"\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n",tonemapping_fragment:"\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",tonemapping_pars_fragment:"\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nvec3 RRTAndODTFit( vec3 v ) {\n\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n\n}\n\n// this implementation of ACES is modified to accommodate a brighter viewing environment.\n// the scale factor of 1/0.6 is subjective. see discussion in #19621.\n\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\n\tcolor *= toneMappingExposure / 0.6;\n\n\tcolor = ACESInputMat * color;\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( color );\n\n\tcolor = ACESOutputMat * color;\n\n\t// Clamp to [0, 1]\n\treturn saturate( color );\n\n}\n\nvec3 CustomToneMapping( vec3 color ) { return color; }\n",transmission_fragment:"\n#ifdef USE_TRANSMISSION\n\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\n\t#endif\n\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif\n",transmission_pars_fragment:"\n#ifdef USE_TRANSMISSION\n\n\t// Transmission code is based on glTF-Sampler-Viewer\n\t// https://github.com/KhronosGroup/glTF-Sample-Viewer\n\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tuniform sampler2D transmissionMap;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tuniform sampler2D thicknessMap;\n\n\t#endif\n\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\n\tvarying vec3 vWorldPosition;\n\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\n\t\t// Direction of refracted light.\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\n\t\t// Compute rotation-independant scaling of the model matrix.\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t// The thickness is specified in local space.\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\n\t}\n\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\n\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\n\t}\n\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\n\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\n\t\t#else\n\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\n\t\t#endif\n\n\t}\n\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tif ( attenuationDistance == 0.0 ) {\n\n\t\t\t// Attenuation distance is +∞ (which we indicate by zero), i.e. the transmitted color is not attenuated at all.\n\t\t\treturn radiance;\n\n\t\t} else {\n\n\t\t\t// Compute light attenuation using Beer's law.\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law\n\t\t\treturn transmittance * radiance;\n\n\t\t}\n\n\t}\n\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\n\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\n\t\t// Get the specular component.\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\n\t}\n#endif\n",uv_pars_fragment:"\n#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\n\tvarying vec2 vUv;\n\n#endif\n",uv_pars_vertex:"\n#ifdef USE_UV\n\n\t#ifdef UVS_VERTEX_ONLY\n\n\t\tvec2 vUv;\n\n\t#else\n\n\t\tvarying vec2 vUv;\n\n\t#endif\n\n\tuniform mat3 uvTransform;\n\n#endif\n",uv_vertex:"\n#ifdef USE_UV\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n",uv2_pars_fragment:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif\n",uv2_pars_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n\tuniform mat3 uv2Transform;\n\n#endif\n",uv2_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n\n#endif\n",worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n",background_vert:"\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n",background_frag:"\nuniform sampler2D t2D;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tgl_FragColor = texture2D( t2D, vUv );\n\n\t#include \n\t#include \n\n}\n",cube_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",cube_frag:"\n#include \nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include \n\t#include \n\n}\n",depth_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n",depth_frag:"\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n",distanceRGBA_vert:"\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n",distanceRGBA_frag:"\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main () {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include \n\t#include \n\t#include \n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n",equirect_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n}\n",equirect_frag:"\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV = equirectUv( direction );\n\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t#include \n\t#include \n\n}\n",linedashed_vert:"\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",linedashed_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\n\t#endif\n\n\t#include \n\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\n\t#else\n\n\t\treflectedLight.directDiffuse = vLightFront;\n\n\t#endif\n\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\n\t// modulation\n\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshmatcap_vert:"\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n",meshmatcap_frag:"\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshnormal_vert:"\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n",meshnormal_frag:"\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\n\t#ifdef OPAQUE\n\n\t\tgl_FragColor.a = 1.0;\n\n\t#endif\n\n}\n",meshphong_vert:"\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphong_frag:"\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n",meshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_vert:"\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_frag:"\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_vert:"\nuniform float size;\nuniform float scale;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",shadow_vert:"\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",shadow_frag:"\nuniform vec3 color;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_vert:"\nuniform float rotation;\nuniform vec2 center;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"},ea={common:{diffuse:{value:new Pn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new tt},uv2Transform:{value:new tt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new sn(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tt}},sprite:{diffuse:{value:new Pn(16777215)},opacity:{value:1},center:{value:new sn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tt}}},ta={basic:{uniforms:bo([ea.common,ea.specularmap,ea.envmap,ea.aomap,ea.lightmap,ea.fog]),vertexShader:Qo.meshbasic_vert,fragmentShader:Qo.meshbasic_frag},lambert:{uniforms:bo([ea.common,ea.specularmap,ea.envmap,ea.aomap,ea.lightmap,ea.emissivemap,ea.fog,ea.lights,{emissive:{value:new Pn(0)}}]),vertexShader:Qo.meshlambert_vert,fragmentShader:Qo.meshlambert_frag},phong:{uniforms:bo([ea.common,ea.specularmap,ea.envmap,ea.aomap,ea.lightmap,ea.emissivemap,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.fog,ea.lights,{emissive:{value:new Pn(0)},specular:{value:new Pn(1118481)},shininess:{value:30}}]),vertexShader:Qo.meshphong_vert,fragmentShader:Qo.meshphong_frag},standard:{uniforms:bo([ea.common,ea.envmap,ea.aomap,ea.lightmap,ea.emissivemap,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.roughnessmap,ea.metalnessmap,ea.fog,ea.lights,{emissive:{value:new Pn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qo.meshphysical_vert,fragmentShader:Qo.meshphysical_frag},toon:{uniforms:bo([ea.common,ea.aomap,ea.lightmap,ea.emissivemap,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.gradientmap,ea.fog,ea.lights,{emissive:{value:new Pn(0)}}]),vertexShader:Qo.meshtoon_vert,fragmentShader:Qo.meshtoon_frag},matcap:{uniforms:bo([ea.common,ea.bumpmap,ea.normalmap,ea.displacementmap,ea.fog,{matcap:{value:null}}]),vertexShader:Qo.meshmatcap_vert,fragmentShader:Qo.meshmatcap_frag},points:{uniforms:bo([ea.points,ea.fog]),vertexShader:Qo.points_vert,fragmentShader:Qo.points_frag},dashed:{uniforms:bo([ea.common,ea.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qo.linedashed_vert,fragmentShader:Qo.linedashed_frag},depth:{uniforms:bo([ea.common,ea.displacementmap]),vertexShader:Qo.depth_vert,fragmentShader:Qo.depth_frag},normal:{uniforms:bo([ea.common,ea.bumpmap,ea.normalmap,ea.displacementmap,{opacity:{value:1}}]),vertexShader:Qo.meshnormal_vert,fragmentShader:Qo.meshnormal_frag},sprite:{uniforms:bo([ea.sprite,ea.fog]),vertexShader:Qo.sprite_vert,fragmentShader:Qo.sprite_frag},background:{uniforms:{uvTransform:{value:new tt},t2D:{value:null}},vertexShader:Qo.background_vert,fragmentShader:Qo.background_frag},cube:{uniforms:bo([ea.envmap,{opacity:{value:1}}]),vertexShader:Qo.cube_vert,fragmentShader:Qo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qo.equirect_vert,fragmentShader:Qo.equirect_frag},distanceRGBA:{uniforms:bo([ea.common,ea.displacementmap,{referencePosition:{value:new Ve},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qo.distanceRGBA_vert,fragmentShader:Qo.distanceRGBA_frag},shadow:{uniforms:bo([ea.lights,ea.fog,{color:{value:new Pn(0)},opacity:{value:1}}]),vertexShader:Qo.shadow_vert,fragmentShader:Qo.shadow_frag}};var na,ia,sa,ra,oa;ta.physical={uniforms:bo([ta.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new sn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Pn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new sn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Pn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Pn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Qo.meshphysical_vert,fragmentShader:Qo.meshphysical_frag},function(e){e[e.Default=0]="Default",e[e.Clay=1]="Clay",e[e.XRay=2]="XRay",e[e.Normals=3]="Normals",e[e.Wireframe=4]="Wireframe"}(na||(na={})),function(e){e[e.Solid=0]="Solid",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient"}(ia||(ia={})),function(e){e[e.Orbit=0]="Orbit",e[e.Walk=1]="Walk"}(sa||(sa={})),function(e){e[e.Overlay=0]="Overlay",e[e.Left=1]="Left",e[e.Right=2]="Right"}(ra||(ra={})),function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(oa||(oa={}));const aa=n(8669).Z,la=n(9849).Z;class ca extends Zo{constructor(e){super(),this._clayColor=new Pn("#a67a6c"),this._wireColor=new Pn("#004966"),this._wireEmissiveColor=new Pn("#004966"),this._objectSpaceNormalMap=!1,this._paramCopy={},this._sideCopy=0,this.type="UberPBRMaterial",this.isUberPBRMaterial=!0,this.isMeshStandardMaterial=!0,this.isMeshPhysicalMaterial=!1,this.defines={STANDARD:!0,PHYSICAL:!1,OBJECTSPACE_NORMALMAP:!1,MODE_NORMALS:!1,MODE_XRAY:!1,CUT_PLANE:!1,USE_ZONEMAP:!1},this.uniforms=xo.merge([ta.standard.uniforms,{aoMapMix:{value:new Ve(.25,.25,.25)},cutPlaneDirection:{value:new Ln(0,0,-1,0)},cutPlaneColor:{value:new Ve(1,0,0)},zoneMap:{value:null}}]),this._aoMapMix=this.uniforms.aoMapMix.value,this._cutPlaneDirection=this.uniforms.cutPlaneDirection.value,this._cutPlaneColor=this.uniforms.cutPlaneColor.value,this._zoneMap=this.uniforms.zoneMap.value,this.vertexShader=la,this.fragmentShader=aa,this.color=new Pn(16777215),this.roughness=.7,this.metalness=0,e&&this.setValues(e)}set cutPlaneDirection(e){this._cutPlaneDirection.copy(e)}get cutPlaneDirection(){return this._cutPlaneDirection}set cutPlaneColor(e){this._cutPlaneColor.copy(e)}get cutPlaneColor(){return this._cutPlaneColor}set aoMapMix(e){this._aoMapMix.copy(e)}get aoMapMix(){return this._aoMapMix}set zoneMap(e){this._zoneMap=e,this.uniforms.zoneMap.value=e,this.needsUpdate=!0}get zoneMap(){return this._zoneMap}setShaderMode(e){switch(Object.assign(this,this._paramCopy),this.defines.MODE_NORMALS=!1,this.defines.MODE_XRAY=!1,this.defines.OBJECTSPACE_NORMALMAP=!(!this.normalMap||!this._objectSpaceNormalMap),this.side=this.defines.CUT_PLANE?2:this.side,this.needsUpdate=!0,e){case na.Clay:this._paramCopy={color:this.color,map:this.map,roughness:this.roughness,metalness:this.metalness,aoMapIntensity:this.aoMapIntensity,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.color=this._clayColor,this.map=null,this.roughness=1,this.metalness=0,this.aoMapIntensity*=1,this.blending=0,this.transparent=!1,this.depthWrite=!0;break;case na.Normals:this._paramCopy={blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_NORMALS=!0,this.blending=0,this.transparent=!1,this.depthWrite=!0;break;case na.XRay:this._paramCopy={side:this.side,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_XRAY=!0,this.side=2,this.blending=2,this.transparent=!0,this.depthWrite=!1;break;case na.Wireframe:this._paramCopy={color:this.color,emissive:this.emissive,roughness:this.roughness,metalness:this.metalness,wireframe:this.wireframe,map:this.map,aoMap:this.aoMap,emissiveMap:this.emissiveMap,normalMap:this.normalMap},this.color=this._wireColor,this.emissive=this._wireEmissiveColor,this.roughness=.8,this.metalness=.1,this.wireframe=!0,this.map=null,this.aoMap=null,this.emissiveMap=null,this.normalMap=null,this.defines.OBJECTSPACE_NORMALMAP=!1}}enableCutPlane(e){this.defines.CUT_PLANE=e,e?(this._sideCopy=this.side,this.side=2):this.side=this._sideCopy}enableObjectSpaceNormalMap(e){e!==this._objectSpaceNormalMap&&(this._objectSpaceNormalMap=e),this.normalMap&&(this.defines.OBJECTSPACE_NORMALMAP=e,this.needsUpdate=!0)}enableZoneMap(e){this.defines.USE_ZONEMAP=e}copyStandardMaterial(e){return this.color=e.color,this.opacity=e.opacity,this.transparent=e.opacity<1||!!e.alphaMap||e.transparent,this.alphaTest=e.alphaTest,this.roughness=e.roughness,this.roughnessMap=e.roughnessMap,this.metalness=e.metalness,this.metalnessMap=e.metalnessMap,this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.normalMap=e.normalMap,this.shadowSide=e.shadowSide,this.flatShading=e.flatShading,this}}class ha extends o{constructor(e){super(),this.addEvents("update","dispose"),e?this.fromJSON(e):this._data=this.init()}static generateId(){return I()}get id(){return this._data.id}get data(){return this._data}set(e,t){this._data[e]=t,this.update()}get(e){return this._data[e]}update(){this.emit({type:"update",document:this})}dispose(){this.emit({type:"dispose",document:this}),this._data=null}fromJSON(e){return this._data={},this.inflate(e,this._data),this.update(),this}toJSON(e){return e=e||{},this.deflate(this._data,e),e}init(){return{}}inflate(e,t){Object.assign(t,e)}deflate(e,t){t=t||{},Object.assign(t,this._data)}}class ua extends ha{setModel(e){this.data.uri=e,this.data.type=qo.Model,this.data.mimeType=this.guessAssetMimeType()}setGeometry(e){this.data.uri=e,this.data.type=qo.Geometry,this.data.mimeType=this.guessAssetMimeType()}setTexture(e,t){this.data.uri=e,this.data.type=qo.Image,this.data.mimeType=this.guessAssetMimeType(),this.data.mapType=t}isValid(){return!!this.data.uri&&void 0!==this.data.type}toString(){const e=this.data;return`Asset - type: '${qo[e.type]}', uri: '${e.uri}', mime type: '${e.mimeType||"(not set)"}'`}init(){return{uri:"",mimeType:"",type:void 0,mapType:void 0,byteSize:0,numFaces:0,numVertices:0,imageSize:0}}deflate(e,t){t.uri=e.uri,t.type=qo[e.type],e.mimeType&&(t.mimeType=e.mimeType),void 0!==e.mapType&&(t.mapType=Xo[e.mapType]),e.byteSize>0&&(t.byteSize=e.byteSize),e.type!==qo.Model&&e.type!==qo.Geometry||e.numFaces>0&&(t.numFaces=e.numFaces),e.type!==qo.Model&&e.type!==qo.Image&&e.type!==qo.Texture||e.imageSize>0&&(t.imageSize=e.imageSize)}inflate(e,t){t.uri=e.uri,t.mimeType=e.mimeType||"",t.type=qo[e.type],t.mapType=Xo[e.mapType],t.byteSize=e.byteSize||0,t.numFaces=e.numFaces||0,t.imageSize=e.imageSize||0,void 0===t.type&&(t.type=this.guessAssetType(),void 0===t.type&&console.warn(`failed to determine asset type from asset: ${t.uri}`))}guessAssetType(){const e=this.data;if(void 0!==e.type&&qo[e.type])return e.type;if(e.mimeType){if(e.mimeType===ua.mimeType.gltfJson||e.mimeType===ua.mimeType.gltfBinary)return qo.Model;if(e.mimeType===ua.mimeType.imageJpeg||e.mimeType===ua.mimeType.imagePng)return qo.Image}const t=e.uri.split(".").pop().toLowerCase();return"gltf"===t||"glb"===t?qo.Model:"obj"===t||"ply"===t?qo.Geometry:"jpg"===t||"png"===t?qo.Image:void 0}guessAssetMimeType(){const e=this.data;if(e.mimeType)return e.mimeType;const t=e.uri.split(".").pop().toLowerCase();return"gltf"===t?ua.mimeType.gltfJson:"glb"===t?ua.mimeType.gltfBinary:"jpg"===t?ua.mimeType.imageJpeg:"png"===t?ua.mimeType.imagePng:""}}ua.mimeType={gltfJson:"model/gltf+json",gltfBinary:"model/gltf-binary",imageJpeg:"image/jpeg",imagePng:"image/png"};class da extends ha{constructor(){super(...arguments),this.model=null}static fromJSON(e){return new da(e)}dispose(){this.unload(),super.dispose()}load(e){if(this.data.usage!==Go.Web3D)throw new Error("can't load, not a Web3D derivative");const t=this.findAsset(qo.Model);if(t)return e.getModel(t.data.uri).then((e=>(this.model&&$o(this.model),this.model=e,e)));const n=this.findAsset(qo.Geometry),i=this.findAssets(qo.Image);return n?e.getGeometry(n.data.uri).then((t=>(this.model=new ui(t,new ca),Promise.all(i.map((t=>e.getTexture(t.data.uri)))).catch((e=>(console.warn("failed to load texture files"),[])))))).then((e=>{const t=this.model.material;return this.assignTextures(i,e,t),t.map||(t.color.setScalar(.5),t.roughness=.8,t.metalness=0),this.model})):void 0}unload(){this.model&&($o(this.model),this.model=null)}createAsset(e,t){const n=new ua;return n.data.type=e,n.data.uri=t,this.addAsset(n),n}addAsset(e){if(!e.data.uri)throw new Error("uri must be specified");this.data.assets.push(e),this.update()}removeAsset(e){const t=this.data.assets.indexOf(e);t>=0&&this.data.assets.splice(t,1)}findAsset(e){return this.data.assets.find((t=>t.data.type===e))}findAssets(e){return this.data.assets.filter((t=>t.data.type===e))}toString(e=!1){const t=this.data;return e?`Derivative - usage: '${Go[t.usage]}', quality: '${Wo[t.quality]}'\n `+t.assets.map((e=>e.toString())).join("\n "):`Derivative - usage: '${Go[t.usage]}', quality: '${Wo[t.quality]}', #assets: ${t.assets.length})`}init(){return{usage:Go.Web3D,quality:Wo.Medium,assets:[]}}deflate(e,t){t.usage=Go[e.usage],t.quality=Wo[e.quality],t.assets=e.assets.map((e=>e.toJSON()))}inflate(e,t){if(t.usage=Go[e.usage],void 0===t.usage)throw new Error(`unknown derivative usage: ${e.usage}`);if(t.quality=Wo[e.quality],void 0===t.quality)throw new Error(`unknown derivative quality: ${e.quality}`);t.assets=e.assets.map((e=>new ua(e)))}assignTextures(e,t,n){for(let i=0;i=0;--t){const n=this.get(e,ma[t]);if(n)return console.warn(`derivative quality '${i}' not available, using lower quality`),n}return console.warn(`no suitable derivative found for quality '${i}' and usage '${n}'`),null}getByUsage(e){const t=Go[e];return(this.derivatives[t]||pa).sort(((e,t)=>e.data.qualityt.data.quality?1:0))}getByQuality(e){return this.getArray().filter((t=>t.data.quality===e))}getArray(){return Object.keys(this.derivatives).reduce(((e,t)=>e.concat(this.derivatives[t])),[])}get(e,t){const n=Go[e],i=this.derivatives[n];if(i)for(let e=0,n=i.length;e-1&&t.splice(i,1)}}createModelAsset(e,t){t="string"==typeof t?Wo[t]:t,t=isFinite(t)?t:Wo.Medium;const n=this.getOrCreate(Go.Web3D,t),i=new ua;return i.setModel(e),n.addAsset(i),n}createMeshAsset(e,t,n,i,s){s="string"==typeof s?Wo[s]:s,s=isFinite(s)?s:Wo.Medium;const r=this.getOrCreate(Go.Web3D,s),o=new ua;if(o.setGeometry(e),r.addAsset(o),t){const e=new ua;e.setTexture(t,Xo.Color),r.addAsset(e)}if(n){const e=new ua;e.setTexture(n,Xo.Occlusion),r.addAsset(e)}if(i){const e=new ua;e.setTexture(i,Xo.Normal),r.addAsset(e)}return r}clear(){for(let e in this.derivatives)this.derivatives[e].forEach((e=>e.dispose()));this.derivatives={}}toJSON(){const e=[];for(let t in this.derivatives)this.derivatives[t].forEach((t=>e.push(t.toJSON())));return e}fromJSON(e){this.clear(),e.forEach((e=>{this.getOrCreateBin(Go[e.usage]).push(new da(e))}))}toString(e=!1){const t=this.derivatives,n=Object.keys(t);return e?`Derivatives (${n.length}) \n `+n.map((e=>t[e].map((e=>e.toString(!0))).join("\n "))).join("\n "):`Derivatives (${n.length}) `+n.map((e=>`${e} (${t[e].length})`)).join(", ")}getOrCreateBin(e){const t=Go[e];return this.derivatives[t]||(this.derivatives[t]=[])}}var va=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const ya=new Ve,ba=new Ve,xa=new Ve,_a=new Ve,wa=new sn,Sa=new sn;var Ma;!function(e){e[e.TopRight=0]="TopRight",e[e.TopLeft=1]="TopLeft",e[e.BottomLeft=2]="BottomLeft",e[e.BottomRight=3]="BottomRight"}(Ma||(Ma={}));class Ea extends ft{constructor(){super(),this.isHTMLSprite=!0,this.viewAngle=0,this.orientationAngle=0,this.orientationQuadrant=Ma.TopLeft,this._elements=new Map,this._visible=!0,this.frustumCulled=!1}getVisible(){return this._visible}setVisible(e){e!==this._visible&&this._elements&&(this._visible=e,this._elements.forEach((t=>{t&&t.setVisible(e)})))}dispose(){this._elements.forEach(((e,t)=>{e&&t.removeChild(e)})),this._elements.clear()}disposeHTMLElement(e){const t=this._elements.get(e);t&&(this._elements.delete(e),e.removeChild(t))}update(){this._elements.forEach((e=>{e&&this.updateHTMLElement(e)}))}renderHTMLElement(e,t,n,i,s){i=i||this,ya.set(0,0,0),ya.applyMatrix4(i.modelViewMatrix),s?ba.copy(s):ba.set(0,1,0),ba.applyMatrix4(i.modelViewMatrix),xa.copy(ba).sub(ya).normalize(),_a.set(0,0,1),this.viewAngle=xa.angleTo(_a),ya.applyMatrix4(n.projectionMatrix),ba.applyMatrix4(n.projectionMatrix),Sa.set(ba.x,ba.y),wa.set(ya.x,ya.y),Sa.sub(wa);const r=.5*(ba.x+1)*t.clientWidth,o=.5*(1-ba.y)*t.clientHeight;e.setPosition(r,o);const a=this.orientationAngle=Sa.angle();this.orientationQuadrant=Math.floor(2*a/Math.PI)}getHTMLElement(e){let t=this._elements.get(e);return t||(t=this.createHTMLElement(),t&&(t.setVisible(this._visible),e.appendChild(t),this._elements.set(e,t))),t}createHTMLElement(){return null}updateHTMLElement(e){e.requestUpdate()}}let Ta=class extends Zr{setVisible(e){this.style.display=e?"block":"none"}setOpacity(e){this.style.opacity=e.toString(),this.style.visibility=e>0?"visible":"hidden"}setPosition(e,t){this.style.left=e.toString()+"px",this.style.top=t.toString()+"px"}};Ta=va([Qr("ff-sprite-element")],Ta);class Ca extends ft{constructor(){super(...arguments),this.isHTMLSpriteGroup=!0,this._visible=!0}getVisible(){return this._visible}setVisible(e){if(e!==this._visible){this._visible=e;const t=this.children;for(let n=0,i=t.length;n{e.id&&(this._dict[e.id]=e)}))}get length(){return this._list.length}get ids(){return Object.keys(this._dict)}get items(){return this._list}set items(e){this._list=e,this._dict={},e.forEach((e=>{e.id&&(this._dict[e.id]=e)})),this.emit({type:"update",item:null,what:"update"})}append(e){this._list.push(e),e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"add"})}insertBefore(e,t){const n=this._list.indexOf(t);n>=0&&this.insertAt(e,n)}insertAt(e,t){this._list.splice(t,0,e),e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"add"})}replaceItem(e,t){const n=this._list.indexOf(t);n>=0&&this.replaceAt(e,n)}replaceAt(e,t){const n=this._list[t];n.id&&delete this._dict[n.id],this._list[t]=e,e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"replace"})}moveItem(e,t){const n=this._list.indexOf(e);this.moveAt(n,t)}moveAt(e,t){const n=this._list;if(e+t<0||e+t>=n.length)return;const i=n[e];if(t>0){for(let i=0;it;--i)n[e+i]=n[e+i-1];n[e+t]=i}this.emit({type:"update",item:i,what:"move"})}removeById(e){const t=this._dict[e];return t&&this.removeItem(t),t}removeItem(e){const t=this._list.indexOf(e);return this.removeAt(t),t}removeAt(e){const t=this._list;if(e<0||e>=t.length)return;const n=t[e];return t.splice(e,1),n.id&&delete this._dict[n.id],this.emit({type:"update",item:n,what:"remove"}),n}getAt(e){return this._list[e]}getById(e){return this._dict[e]}getIndexOf(e){return this._list.indexOf(e)}copy(e){this.items=e.slice()}clone(){return this._list.slice()}}Aa.prototype[Symbol.iterator]=function(){return{index:0,list:this._list,next:function(){return this.index{e.id&&(this._dict[e.id]=e)}))}get length(){return this.ids.length}get items(){return this.ids.map((e=>this._dict[e]))}set items(e){e.forEach((e=>{e.id&&(this._dict[e.id]=e)})),this.emit({type:"update",item:null,what:"update"})}get ids(){return Object.keys(this._dict)}get dictionary(){return this._dict}set dictionary(e){this._dict=e,this.emit({type:"update",item:null,what:"update"})}insert(e,t){if(!(t=t||e.id))throw new Error("can't insert, missing id");this._dict[t]=e,this.emit({type:"update",item:e,what:"insert"})}remove(e){const t="string"==typeof e?e:e.id,n=this._dict[t];void 0!==n&&(delete this._dict[t],this.emit({type:"update",item:n,what:"remove"}))}get(e){return this._dict[e]}getOrCreate(e,t){let n=this._dict[e];return n||(n=this._dict[e]=t,this.emit({type:"update",item:n,what:"insert"})),n}copy(e){this.dictionary=Object.assign({},e)}clone(){return Object.assign({},this._dict)}}class Ra extends ha{constructor(){super(...arguments),this._language=vs.EN}static fromJSON(e){return new Ra(e)}toString(){return this.title}get title(){return 0===Object.keys(this.data.titles).length&&(this.data.titles.EN=this.data.title),this.data.titles[vs[this.language]]||"undefined"}set title(e){this.data.titles[vs[this.language]]=e,this.update()}get defaultTitle(){return 0===Object.keys(this.data.titles).length&&(this.data.titles.EN=this.data.title),this.data.titles.EN||"undefined"}get uri(){return 0===Object.keys(this.data.uris).length&&(this.data.uris.EN=this.data.uri),this.data.uris[vs[this.language]]}set uri(e){this.data.uris[vs[this.language]]=e,this.update()}get lead(){return 0===Object.keys(this.data.leads).length&&(this.data.leads.EN=this.data.lead),this.data.leads[vs[this.language]]||""}set lead(e){this.data.leads[vs[this.language]]=e,this.update()}get tags(){return 0===Object.keys(this.data.taglist).length&&this.data.tags.length>0&&(this.data.taglist.EN=this.data.tags),this.data.taglist[vs[this.language]]||[]}set tags(e){this.data.taglist[vs[this.language]]=e,this.update()}get language(){return this._language}set language(e){this._language=e}init(){return{id:ha.generateId(),title:"New Article",titles:{},lead:"",leads:{},tags:[],taglist:{},uri:"",uris:{},mimeType:"",thumbnailUri:""}}deflate(e,t){t.id=e.id,Object.keys(this.data.uris).length>0?(t.uris={},Object.keys(this.data.uris).forEach((n=>{t.uris[n]=e.uris[n]}))):e.uri&&(t.uri=e.uri),Object.keys(this.data.titles).length>0?(t.titles={},Object.keys(this.data.titles).forEach((n=>{t.titles[n]=e.titles[n]}))):e.title&&(t.title=e.title),Object.keys(this.data.leads).length>0?(t.leads={},Object.keys(this.data.leads).forEach((n=>{t.leads[n]=e.leads[n]}))):e.lead&&(t.lead=e.lead),Object.keys(this.data.taglist).length>0?(t.taglist={},Object.keys(this.data.taglist).forEach((n=>{t.taglist[n]=e.taglist[n].slice()}))):e.tags.length>0&&(t.tags=e.tags.slice()),e.mimeType&&(t.mimeType=e.mimeType),e.thumbnailUri&&(t.thumbnailUri=e.thumbnailUri)}inflate(e,t){t.id=e.id,t.uri=e.uri||"",t.uris=e.uris||{},t.title=e.title||"",t.titles=e.titles||{},t.lead=e.lead||"",t.leads=e.leads||{},t.tags=e.tags||[],t.taglist=e.taglist||{},t.mimeType=e.mimeType||"",t.thumbnailUri=e.thumbnailUri||""}}const La=async function(e,t,n){return fetch(e,{headers:{Accept:"text/plain, *","Content-Type":"text/plain"},method:t,credentials:"same-origin",body:n}).then((e=>{if(!e.ok)throw new Error(`status: ${e.status}`);return e.text()})).catch((n=>{throw console.warn(`fetch.text (${t} at '${e}'), error: ${n.message}`),n}))};class Na{constructor(e){this._loadingManager=e}async get(e){return this._loadingManager.itemStart(e),fetch(e,{headers:{Accept:"application/json,*"}}).then((t=>{if(!t.ok)throw this._loadingManager.itemError(e),this._loadingManager.itemEnd(e),new Error(`failed to fetch from '${e}', status: ${t.status} ${t.statusText}`);return this._loadingManager.itemEnd(e),t.json()}))}}class Da{constructor(e,t,n){const i=this;let s,r=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===r&&void 0!==i.onStart&&i.onStart(e,o,a),r=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t{t&&t(s),this.manager.itemEnd(e)}),0),s;if(void 0!==za[e])return void za[e].push({onLoad:t,onProgress:n,onError:i});za[e]=[],za[e].push({onLoad:t,onProgress:n,onError:i});const r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(r).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const n=za[e],i=t.body.getReader(),s=t.headers.get("Content-Length"),r=s?parseInt(s):0,o=0!==r;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:s})=>{if(i)e.close();else{a+=s.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:r});for(let e=0,t=n.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{ka.add(e,t);const n=za[e];delete za[e];for(let e=0,i=n.length;e{const n=za[e];if(void 0===n)throw this.manager.itemError(e),t;delete za[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}const Va=new WeakMap;class Fa extends Ia{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,t,n,i){const s=new Ua(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(e=>{const n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(i)}),n,i)}decodeDracoFile(e,t,n,i){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const e in t.attributeTypes){const n=t.attributeTypes[e];void 0!==n.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=n.name)}const n=JSON.stringify(t);if(Va.has(e)){const t=Va.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,r=e.byteLength,o=this._getWorker(s,r).then((n=>(i=n,new Promise(((n,r)=>{i._callbacks[s]={resolve:n,reject:r},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&s&&this._releaseTask(i,s)})),Va.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new qn;e.index&&t.setIndex(new On(e.index.array,1));for(let n=0;n{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=Ba.toString(),s=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e{const t=e.draco,o=new t.Decoder,a=new t.DecoderBuffer;a.Init(new Int8Array(i),i.byteLength);try{const e=function(e,t,i,s){const r=s.attributeIDs,o=s.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeBufferToMesh(i,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeBufferToPointCloud(i,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in r){const l=self[o[i]];let c,u;if(s.useUniqueIDs)u=r[i],c=t.GetAttributeByUniqueId(a,u);else{if(u=t.GetAttributeId(a,e[r[i]]),-1===u)continue;c=t.GetAttribute(a,u)}h.attributes.push(n(e,t,a,i,l,c))}c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),s=4*i,r=e._malloc(s);t.GetTrianglesUInt32Array(n,s,r);const o=new Uint32Array(e.HEAPF32.buffer,r,i).slice();return e._free(r),{array:o,itemSize:1}}(e,t,a));return e.destroy(a),h}(t,o,a,r),i=e.attributes.map((e=>e.array.buffer));e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(a),t.destroy(o)}}))}}}class ja{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Wa.getNormalMatrix(e),i=this.coplanarPoint(Ha).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}qa.prototype.isPlane=!0;const Xa=new cn,Ya=new Ve;class Ka{constructor(e=new qa,t=new qa,n=new qa,i=new qa,s=new qa,r=new qa){this.planes=[e,t,n,i,s,r]}set(e,t,n,i,s,r){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(r),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],s=n[1],r=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],m=n[11],f=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(o-i,h-a,m-u,y-f).normalize(),t[1].setComponents(o+i,h+a,m+u,y+f).normalize(),t[2].setComponents(o+s,h+l,m+d,y+g).normalize(),t[3].setComponents(o-s,h-l,m-d,y-g).normalize(),t[4].setComponents(o-r,h-c,m-p,y-v).normalize(),t[5].setComponents(o+r,h+c,m+p,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Xa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Xa)}intersectsSprite(e){return Xa.center.set(0,0,0),Xa.radius=.7071067811865476,Xa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xa)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Ya.y=i.normal.y>0?e.max.y:e.min.y,Ya.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ya)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const Ja=new je,Za=new Ve,Qa=new Ve;class el{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new sn(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ka,this._frameExtents=new sn(1,1),this._viewportCount=1,this._viewports=[new Ln(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Za.setFromMatrixPosition(e.matrixWorld),t.position.copy(Za),Qa.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Qa),t.updateMatrixWorld(),Ja.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ja),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class tl extends ft{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new je,this.projectionMatrix=new je,this.projectionMatrixInverse=new je}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}tl.prototype.isCamera=!0;class nl extends tl{constructor(e=-1,t=1,n=1,i=-1,s=.1,r=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,r){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,r=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=e*this.view.offsetX,r=s+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(s,r,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}nl.prototype.isOrthographicCamera=!0;class il extends el{constructor(){super(new nl(-5,5,5,-5,.5,500))}}il.prototype.isDirectionalLightShadow=!0;class sl extends $a{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ft.DefaultUp),this.updateMatrix(),this.target=new ft,this.shadow=new il}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}sl.prototype.isDirectionalLight=!0;class rl extends tl{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Le*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Re*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Le*Math.atan(Math.tan(.5*Re*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,r){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Re*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const r=this.view;if(null!==this.view&&this.view.enabled){const e=r.fullWidth,o=r.fullHeight;s+=r.offsetX*i/e,t-=r.offsetY*n/o,i*=r.width/e,n*=r.height/o}const o=this.filmOffset;0!==o&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}rl.prototype.isPerspectiveCamera=!0;const ol=new je,al=new Ve,ll=new Ve;class cl extends el{constructor(){super(new rl(90,1,.5,500)),this._frameExtents=new sn(4,2),this._viewportCount=6,this._viewports=[new Ln(2,1,1,1),new Ln(0,1,1,1),new Ln(3,1,1,1),new Ln(1,1,1,1),new Ln(3,0,1,1),new Ln(1,0,1,1)],this._cubeDirections=[new Ve(1,0,0),new Ve(-1,0,0),new Ve(0,0,1),new Ve(0,0,-1),new Ve(0,1,0),new Ve(0,-1,0)],this._cubeUps=[new Ve(0,1,0),new Ve(0,1,0),new Ve(0,1,0),new Ve(0,1,0),new Ve(0,0,1),new Ve(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),al.setFromMatrixPosition(e.matrixWorld),n.position.copy(al),ll.copy(n.position),ll.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ll),n.updateMatrixWorld(),i.makeTranslation(-al.x,-al.y,-al.z),ol.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ol)}}cl.prototype.isPointLightShadow=!0;class hl extends $a{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new cl}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}hl.prototype.isPointLight=!0;class ul extends el{constructor(){super(new rl(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=2*Le*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;n===t.fov&&i===t.aspect&&s===t.far||(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}ul.prototype.isSpotLightShadow=!0;class dl extends $a{constructor(e,t,n=0,i=Math.PI/3,s=0,r=1){super(e,t),this.type="SpotLight",this.position.copy(ft.DefaultUp),this.updateMatrix(),this.target=new ft,this.distance=n,this.angle=i,this.penumbra=s,this.decay=r,this.shadow=new ul}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}dl.prototype.isSpotLight=!0;class pl extends Zo{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new sn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return De(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.sheenColor=new Pn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Pn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pn(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}pl.prototype.isMeshPhysicalMaterial=!0;class ml{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let r;n:{i:if(!(e=s)break e;{const o=t[1];e=s)break t}r=n,n=0}}for(;n>>1;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Gl(e,t,n,i,s,r,o){const a=Bl.distanceSqToPoint(e);if(as.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:o})}}Hl.prototype.isPoints=!0;class Wl extends ml{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,r=e+1,o=i[s],a=i[r];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:s=e,o=2*t-n;break;case 2402:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:r=e,a=2*n-t;break;case 2402:r=1,a=n+i[1]-i[0];break;default:r=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(a-n),this._offsetPrev=s*c,this._offsetNext=r*c}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),m=p*p,f=m*p,g=-u*f+2*u*m-u*p,v=(1+u)*f+(-1.5-2*u)*m+(-.5+u)*p+1,y=(-1-d)*f+(1.5+d)*m+.5*p,b=d*f-d*m;for(let e=0;e!==o;++e)s[e]=g*r[c+e]+v*r[l+e]+y*r[a+e]+b*r[h+e];return s}}class ql extends ml{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)s[e]=r[l+e]*h+r[a+e]*c;return s}}class Xl extends ml{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}const Yl={arraySlice:function(e,t,n){return Yl.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,s=new e.constructor(i);for(let r=0,o=0;o!==i;++r){const i=n[r]*t;for(let n=0;n!==t;++n)s[o++]=e[i+n]}return s},flattenJSON:function(e,t,n,i){let s=1,r=e[0];for(;void 0!==r&&void 0===r[i];)r=e[s++];if(void 0===r)return;let o=r[i];if(void 0!==o)if(Array.isArray(o))do{o=r[i],void 0!==o&&(t.push(r.time),n.push.apply(n,o)),r=e[s++]}while(void 0!==r);else if(void 0!==o.toArray)do{o=r[i],void 0!==o&&(t.push(r.time),o.toArray(n,n.length)),r=e[s++]}while(void 0!==r);else do{o=r[i],void 0!==o&&(t.push(r.time),n.push(o)),r=e[s++]}while(void 0!==r)},subclip:function(e,t,n,i,s=30){const r=e.clone();r.name=t;const o=[];for(let e=0;e=i)){l.push(t.times[e]);for(let n=0;nr.tracks[e].times[0]&&(a=r.tracks[e].times[0]);for(let e=0;e=i.times[u]){const e=u*l+a,t=e+l-a;d=Yl.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(r),d=Yl.arraySlice(e.resultBuffer,t,n)}if("quaternion"===s){(new Ue).fromArray(d).normalize().conjugate().toArray(d)}const p=o.times.length;for(let e=0;et;)--r;if(++r,0!==s||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);const e=this.getValueSize();this.times=Yl.arraySlice(n,s,r),this.values=Yl.arraySlice(this.values,s*e,r*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;0===s&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let t=0;t!==s;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==r&&r>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,r),e=!1;break}r=i}if(void 0!==i&&Yl.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=Yl.arraySlice(this.times),t=Yl.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===ye,s=e.length-1;let r=1;for(let o=1;o0){e[r]=e[s];for(let e=s*n,i=r*n,o=0;o!==n;++o)t[i+o]=t[e+o];++r}return r!==e.length?(this.times=Yl.arraySlice(e,0,r),this.values=Yl.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this}clone(){const e=Yl.arraySlice(this.times,0),t=Yl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Kl.prototype.TimeBufferType=Float32Array,Kl.prototype.ValueBufferType=Float32Array,Kl.prototype.DefaultInterpolation=ve;class Jl extends Kl{}Jl.prototype.ValueTypeName="number";class Zl extends ml{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Ue.slerpFlat(s,0,r,l-o,r,l,a);return s}}class Ql extends Kl{InterpolantFactoryMethodLinear(e){return new Zl(this.times,this.values,this.getValueSize(),e)}}Ql.prototype.ValueTypeName="quaternion",Ql.prototype.DefaultInterpolation=ve,Ql.prototype.InterpolantFactoryMethodSmooth=void 0;class ec extends Kl{}ec.prototype.ValueTypeName="vector";class tc extends Kl{}tc.prototype.ValueTypeName="bool",tc.prototype.ValueBufferType=Array,tc.prototype.DefaultInterpolation=ge,tc.prototype.InterpolantFactoryMethodLinear=void 0,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class nc extends Kl{}nc.prototype.ValueTypeName="color";class ic extends Kl{}ic.prototype.ValueTypeName="string",ic.prototype.ValueBufferType=Array,ic.prototype.DefaultInterpolation=ge,ic.prototype.InterpolantFactoryMethodLinear=void 0,ic.prototype.InterpolantFactoryMethodSmooth=void 0;class sc{constructor(e,t=-1,n,i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ne(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,s=n.length;e!==s;++e)t.push(rc(n[e]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(Kl.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,r=[];for(let e=0;e1){const e=r[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const r=[];for(const e in i)r.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return r}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,s){if(0!==n.length){const r=[],o=[];Yl.flattenJSON(n,r,o,i),0!==r.length&&s.push(new e(t,r,o))}},i=[],s=e.name||"default",r=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e=2.0 are supported.")));const l=new oh(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(r),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,s){n.parse(e,t,i,s)}))}}function dc(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const pc={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_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class mc{constructor(e){this.parser=e,this.name=pc.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r,o)}}class Sc{constructor(e){this.parser=e,this.name=pc.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const r=s.extensions[t],o=i.images[r.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(s){if(s)return n.loadTextureImage(e,o,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Mc{constructor(e){this.name=pc.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,s.ready]).then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,r=e.count,o=e.byteStride,a=new ArrayBuffer(r*o),l=new Uint8Array(t[0],n,i);return s.decodeGltfBuffer(new Uint8Array(a),r,o,l,e.mode,e.filter),a}))}return null}}const Ec="glTF",Tc=1313821514,Cc=5130562;class Ac{constructor(e){this.name=pc.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:ja.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ec)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-12,i=new DataView(e,12);let s=0;for(;s",t).replace("#include ",n).replace("#include ",i).replace("#include ",s).replace("#include ",r)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class Nc{constructor(){this.name=pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return Lc}extendParams(e,t,n){const i=t.extensions[this.name];e.color=new Pn(1,1,1),e.opacity=1;const s=[];if(Array.isArray(i.diffuseFactor)){const t=i.diffuseFactor;e.color.fromArray(t),e.opacity=t[3]}if(void 0!==i.diffuseTexture&&s.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new Pn(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Pn(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){const t=i.specularGlossinessTexture;s.push(n.assignTexture(e,"glossinessMap",t)),s.push(n.assignTexture(e,"specularMap",t))}return Promise.all(s)}createMaterial(e){const t=new Lc(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}class Dc{constructor(){this.name=pc.KHR_MESH_QUANTIZATION}}class Oc extends ml{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[s+e];return t}}Oc.prototype.beforeStart_=Oc.prototype.copySampleValue_,Oc.prototype.afterEnd_=Oc.prototype.copySampleValue_,Oc.prototype.interpolate_=function(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-t,h=(n-t)/c,u=h*h,d=u*h,p=e*l,m=p-l,f=-2*d+3*u,g=d-u,v=1-f,y=g-u+h;for(let e=0;e!==o;e++){const t=r[m+e+o],n=r[m+e+a]*c,i=r[p+e+o],l=r[p+e]*c;s[e]=v*t+y*n+f*i+g*l}return s};const Ic=new Ue;class kc extends Oc{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return Ic.fromArray(s).normalize().toArray(s),s}}const zc=0,Uc=1,Vc=2,Fc=3,Bc=4,jc=5,$c=6,Hc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Gc={9728:Z,9729:te,9984:Q,9985:1007,9986:ee,9987:ne},Wc={33071:K,33648:J,10497:Y},qc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Yc={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Kc={CUBICSPLINE:void 0,LINEAR:ve,STEP:ge},Jc="OPAQUE",Zc="MASK",Qc="BLEND";function eh(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function th(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function nh(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())s(i,t.children[n])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,h[e*r+1]),r>=3&&p.setZ(t,h[e*r+2]),r>=4&&p.setW(t,h[e*r+3]),r>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e],s=t.images[i.source];let r=this.textureLoader;if(s.uri){const e=n.manager.getHandler(s.uri);null!==e&&(r=e)}return this.loadTextureImage(e,s,r)}loadTextureImage(e,t,n){const i=this,s=this.json,r=this.options,o=s.textures[e],a=(t.uri||t.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];const l=self.URL||self.webkitURL;let c=t.uri||"",h=!1;if(void 0!==t.bufferView)c=i.getDependency("bufferView",t.bufferView).then((function(e){h=!0;const n=new Blob([e],{type:t.mimeType});return c=l.createObjectURL(n),c}));else if(void 0===t.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then((function(e){return new Promise((function(t,i){let s=t;!0===n.isImageBitmapLoader&&(s=function(e){const n=new fo(e);n.needsUpdate=!0,t(n)}),n.load(ja.resolveURL(e,r.path),s,void 0,i)}))})).then((function(t){!0===h&&l.revokeObjectURL(c),t.flipY=!1,o.name&&(t.name=o.name);const n=(s.samplers||{})[o.sampler]||{};return t.magFilter=Gc[n.magFilter]||te,t.minFilter=Gc[n.minFilter]||ne,t.wrapS=Wc[n.wrapS]||Y,t.wrapT=Wc[n.wrapT]||Y,i.associations.set(t,{textures:e}),t})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",c),null}));return this.textureCache[a]=u,u}assignTexture(e,t,n){const i=this;return this.getDependency("texture",n.index).then((function(s){if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[pc.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[pc.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=i.associations.get(s);s=i.extensions[pc.KHR_TEXTURE_TRANSFORM].extendTexture(s,e),i.associations.set(s,t)}}return e[t]=s,s}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,s=void 0!==t.attributes.color,r=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new _l,wn.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Ts,wn.prototype.copy.call(t,n),t.color.copy(n.color),this.cache.add(e,t)),n=t}if(i||s||r){let e="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(e+="specular-glossiness:"),i&&(e+="derivative-tangents:"),s&&(e+="vertex-colors:"),r&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),s&&(t.vertexColors=!0),r&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n}getMaterialType(){return Zo}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let r;const o={},a=s.extensions||{},l=[];if(a[pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const e=i[pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=e.getMaterialType(),l.push(e.extendParams(o,s,t))}else if(a[pc.KHR_MATERIALS_UNLIT]){const e=i[pc.KHR_MATERIALS_UNLIT];r=e.getMaterialType(),l.push(e.extendParams(o,s,t))}else{const n=s.pbrMetallicRoughness||{};if(o.color=new Pn(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.fromArray(e),o.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(t.assignTexture(o,"map",n.baseColorTexture)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),r=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),l.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===s.doubleSided&&(o.side=2);const c=s.alphaMode||Jc;if(c===Qc?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===Zc&&(o.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&r!==Rn&&(l.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new sn(1,1),void 0!==s.normalTexture.scale)){const e=s.normalTexture.scale;o.normalScale.set(e,e)}return void 0!==s.occlusionTexture&&r!==Rn&&(l.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(o.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&r!==Rn&&(o.emissive=(new Pn).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&r!==Rn&&l.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture)),Promise.all(l).then((function(){let n;return n=r===Lc?i[pc.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new r(o),s.name&&(n.name=s.name),n.map&&(n.map.encoding=xe),n.emissiveMap&&(n.emissiveMap.encoding=xe),th(n,s),t.associations.set(n,{materials:e}),s.extensions&&eh(i,n,s),n}))}createUniqueName(e){const t=Nl.sanitizeNodeName(e||"");let n=t;for(let e=1;this.nodeNamesUsed[n];++e)n=t+"_"+e;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(e){return n[pc.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return lh(n,e,t)}))}const r=[];for(let n=0,o=e.length;n0&&nh(u,s),u.name=t.createUniqueName(s.name||"mesh_"+e),th(u,s),h.extensions&&eh(i,u,h),t.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;n1?new Es:1===t.length?t[0]:new ft,o!==t[0])for(let e=0,n=t.length;e{const t=new Map;for(const[e,n]of s.associations)(e instanceof wn||e instanceof fo)&&t.set(e,n);return e.traverse((e=>{const n=s.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}}function ah(e,t,n,i){const s=n.nodes[e];return i.getDependency("node",e).then((function(e){if(void 0===s.skin)return e;let t;return i.getDependency("skin",s.skin).then((function(e){t=e;const n=[];for(let e=0,s=t.joints.length;e=0}isValidMimeType(e){return hh.mimeTypes.indexOf(e)>=0}get(e){return new Promise(((t,n)=>{this.gltfLoader.load(e,(e=>{t(this.createModelGroup(e))}),null,(i=>{null===this.gltfLoader||null===this.gltfLoader.dracoLoader?t(null):(console.error(`failed to load '${e}': ${i}`),n(new Error(i)))}))}))}createModelGroup(e){const t=e.scene;return t.traverse((e=>{if("Mesh"===e.type){const t=e;t.castShadow=!0;const n=t.material;n.map&&(n.map.encoding=xe),t.geometry.computeBoundingBox();const i=new ca;"MeshStandardMaterial"===n.type&&i.copyStandardMaterial(n),n.userData.objectSpaceNormals&&i.enableObjectSpaceNormalMap(!0),t.material=i}})),t}}hh.extensions=["gltf","glb"],hh.mimeTypes=["model/gltf+json","model/gltf-binary"];class uh extends wn{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new Pn(16777215),this.specular=new Pn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new sn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}uh.prototype.isMeshPhongMaterial=!0;const dh=/^[og]\s*(.+)?/,ph=/^mtllib /,mh=/^usemtl /,fh=/^usemap /,gh=new Ve,vh=new Ve,yh=new Ve,bh=new Ve,xh=new Ve;function _h(){const e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){const t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){const t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){const e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){const n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){const i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,s=this.object.geometry.normals;gh.fromArray(i,e),vh.fromArray(i,t),yh.fromArray(i,n),xh.subVectors(yh,vh),bh.subVectors(gh,vh),xh.cross(bh),xh.normalize(),s.push(xh.x,xh.y,xh.z),s.push(xh.x,xh.y,xh.z),s.push(xh.x,xh.y,xh.z)},addColor:function(e,t,n){const i=this.colors,s=this.object.geometry.colors;void 0!==i[e]&&s.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&s.push(i[t+0],i[t+1],i[t+2]),void 0!==i[n]&&s.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,s,r,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(e,c),u=this.parseVertexIndex(t,c),d=this.parseVertexIndex(n,c);if(this.addVertex(h,u,d),this.addColor(h,u,d),void 0!==o&&""!==o){const e=this.normals.length;h=this.parseNormalIndex(o,e),u=this.parseNormalIndex(a,e),d=this.parseNormalIndex(l,e),this.addNormal(h,u,d)}else this.addFaceNormal(h,u,d);if(void 0!==i&&""!==i){const e=this.uvs.length;h=this.parseUVIndex(i,e),u=this.parseUVIndex(s,e),d=this.parseUVIndex(r,e),this.addUV(h,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n=7?t.colors.push(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===s){const e=i.substr(1).trim().split(/\s+/),n=[];for(let t=0,i=e.length;t0){const e=i.split("/");n.push(e)}}const s=n[0];for(let e=1,i=n.length-1;e1){const e=o[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;const e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\0"===i)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+i+'"')}t.finalize();const l=new Es;l.materialLibraries=[].concat(t.materialLibraries);if(!0===!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length))for(let e=0,n=t.objects.length;e0&&c.setAttribute("normal",new zn(i.normals,3)),i.colors.length>0&&(a=!0,c.setAttribute("color",new zn(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new zn(i.uvs,2));const h=[];for(let e=0,n=s.length;e1){for(let e=0,t=s.length;e0){const e=new _l({size:1,sizeAttenuation:!1}),n=new qn;n.setAttribute("position",new zn(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new zn(t.colors,3)),e.vertexColors=!0);const i=new Hl(n,e);l.add(i)}return l}}class Sh extends Ia{constructor(e){super(e),this.propertyNameMapping={}}load(e,t,n,i){const s=this,r=new Ua(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,(function(n){try{t(s.parse(n))}catch(t){i?i(t):console.error(t),s.manager.itemError(e)}}),n,i)}setPropertyNameMapping(e){this.propertyNameMapping=e}parse(e){function t(e){let t="",n=0;const i=/^ply([\s\S]*)end_header\r?\n/.exec(e);null!==i&&(t=i[1],n=new Blob([i[0]]).size);const s={comments:[],elements:[],headerLength:n,objInfo:""},r=t.split("\n");let o;function a(e,t){const n={type:e[0]};return"list"===n.type?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t&&(n.name=t[n.name]),n}for(let e=0;e=t.elements[c].count&&(c++,h=0);const r=i(t.elements[c].properties,s);o(n,t.elements[c].name,r),h++}return r(n)}function r(e){let t=new qn;return e.indices.length>0&&t.setIndex(e.indices),t.setAttribute("position",new zn(e.vertices,3)),e.normals.length>0&&t.setAttribute("normal",new zn(e.normals,3)),e.uvs.length>0&&t.setAttribute("uv",new zn(e.uvs,2)),e.colors.length>0&&t.setAttribute("color",new zn(e.colors,3)),e.faceVertexUvs.length>0&&(t=t.toNonIndexed(),t.setAttribute("uv",new zn(e.faceVertexUvs,2))),t.computeBoundingSphere(),t}function o(e,t,n){function i(e){for(let t=0,i=e.length;t=0}get(e){const t=e.split(".").pop().toLowerCase();return new Promise(((n,i)=>{if("obj"===t)this.objLoader.load(e,(t=>{const s=t.children[0].geometry;return s&&"Geometry"===s.type||"BufferGeometry"===s.type?n(s):i(new Error(`Can't parse geometry from '${e}'`))}));else{if("ply"!==t)throw new Error(`Can't load geometry, unknown extension: '${t}' in '${e}'`);this.plyLoader.load(e,(t=>t&&"Geometry"===t.type||"BufferGeometry"===t.type?n(t):i(new Error(`Can't parse geometry from '${e}'`))))}}))}}Mh.extensions=["obj","ply"];class Eh{constructor(e){this.textureLoader=new vl(e)}isValid(e){const t=e.split(".").pop().toLowerCase();return Eh.extensions.indexOf(t)>=0}isValidMimeType(e){return Eh.mimeTypes.indexOf(e)>=0}get(e){return new Promise(((t,n)=>{this.textureLoader.load(e,(e=>{t(e)}),null,(e=>{console.error(e),n(new Error(e.message))}))}))}getImmediate(e){return this.textureLoader.load(e,null,null,(e=>{console.error(e)}))}}Eh.extensions=["jpg","png"],Eh.mimeTypes=["image/jpeg","image/png"];class Th{constructor(e){this._customFontPath=null,this._loadingManager=e,this._textureLoader=new vl(e),this._cache={}}set fontPath(e){this._customFontPath=e}get fontPath(){return this._customFontPath}get(e){return this._cache[e]}async load(e){if(this._cache[e])return Promise.resolve(this._cache[e]);this._loadingManager.itemStart(e);const t=this.fontPath,n=t?t+e+".json":Ph+e+".json",i=t?t+e+".png":Ph+e+".png",s=fetch(n,{headers:{Accept:"application/json"}}).then((t=>{if(!t.ok)throw this._loadingManager.itemError(e),new Error(`failed to load bitmap font descriptor: '${n}', status: ${t.status} ${t.statusText}`);return t.json()})),r=new Promise(((e,t)=>{this._textureLoader.load(i,(n=>n?e(n):t(new Error(`failed to load font texture from '${i}'`))))}));return Promise.all([s,r]).then((t=>{const n={descriptor:t[0],texture:t[1]};return this._cache[e]=n,this._loadingManager.itemEnd(e),n}))}}class Ch extends j{constructor(){super(...arguments),this.ins=this.addInputs(Ch.ins),this.outs=this.addOutputs(Ch.outs),this._loadingManager=new Ah(this),this._baseUrl=window.location.href,this._initialLoad=!1}get loadingManager(){return this._loadingManager}get baseUrl(){return this._baseUrl}set baseUrl(e){this._baseUrl=new URL(e,window.location.href).href}get initialLoad(){return this._initialLoad}set initialLoad(e){this._initialLoad=e}getAssetName(e){return e.split("/").pop()}getAssetUrl(e){const t=new URL(e,this._baseUrl).href;return this.loadingManager.resolveURL(t)}getAssetPath(e){const t=this._baseUrl,n=e.indexOf(t);return n>=0?e.substr(n+t.length):e}getAssetBasePath(e){const t=this.getAssetPath(e).split("/");t.pop();const n=t.join("/");return n?n+"/":n}getRelativeAssetPath(e,t){const n=this.getAssetUrl(e),i=this.getAssetUrl(t),s=n.indexOf(i);return s>=0?n.substr(s+i.length):this.getAssetPath(n)}create(){super.create()}update(){const{ins:e,outs:t}=this;if(e.busy.changed){const n=e.busy.value||this._loadingManager.isBusy;t.busy.setValue(n),n||t.completed.set()}return!0}}Ch.typeName="CVAssetManager",Ch.text="AssetManager",Ch.icon="",Ch.isSystemSingleton=!0,Ch.ins={busy:C("State.Busy"),baseUrlValid:C("Settings.BaseURLValid")},Ch.outs={busy:C("State.Busy"),completed:D("State.Completed")};class Ah extends Da{constructor(e){super(),this._manager=e,this._isBusy=!1,this.onStart=this.onLoadingStart.bind(this),this.onProgress=this.onLoadingProgress.bind(this),this.onLoad=this.onLoadingCompleted.bind(this),this.onError=this.onLoadingError.bind(this)}get isBusy(){return this._isBusy}onLoadingStart(){this._isBusy=!0,this._manager.ins.busy.set()}onLoadingProgress(e,t,n){0}onLoadingCompleted(){this._isBusy=!1,this._manager.ins.busy.set()}onLoadingError(){this._isBusy=!1,this._manager.ins.busy.set()}}const Ph="https://cdn.jsdelivr.net/gh/smithsonian/dpo-voyager@latest/assets/";class Rh extends j{constructor(e,t){super(e,t),this.systemAssetPath=null;const n=this.assetManager.loadingManager;this.jsonLoader=new Na(n),this.modelLoader=new hh(n),this.geometryLoader=new Mh(n),this.textureLoader=new Eh(n),this.fontReader=new Th(n)}dispose(){this.modelLoader.dispose(),super.dispose()}get assetManager(){return this.getMainComponent(Ch)}setDracoPath(e){this.modelLoader.dracoPath=e}setSystemAssetPath(e){this.fontReader.fontPath=e,this.systemAssetPath=e}getSystemAssetUrl(e){return(this.systemAssetPath||Ph)+e}async getJSON(e){const t=this.assetManager.getAssetUrl(e);return this.jsonLoader.get(t)}async getText(e){const t=this.assetManager.getAssetUrl(e);return La(t,"GET")}async getModel(e){const t=this.assetManager.getAssetUrl(e);return this.modelLoader.get(t)}async getGeometry(e){const t=this.assetManager.getAssetUrl(e);return this.geometryLoader.get(t)}async getTexture(e){const t=this.assetManager.getAssetUrl(e);return this.textureLoader.get(t)}async getFont(e){const t=this.assetManager.getAssetUrl(e);return this.fontReader.load(t)}async getSystemTexture(e){const t=this.getSystemAssetUrl(e);return this.textureLoader.get(t)}async getSystemJSON(e){const t=this.getSystemAssetUrl(e);return this.jsonLoader.get(t)}}Rh.typeName="CVAssetReader",Rh.text="AssetReader",Rh.icon="",Rh.isSystemSingleton=!0;class Lh extends j{constructor(){super(...arguments),this._activeLanguages=[],this._translations={},this.ins=this.addInputs(Lh.ins),this.outs=this.addOutputs(Lh.outs),this.updateLanguage=e=>{const{ins:t,outs:n}=this;n.language.setValue(e),this.emit({type:"tag-update"})}}get assetReader(){return this.getMainComponent(Rh)}get activeLanguages(){return this._activeLanguages}toString(){return ys[vs[this.ins.language.value]]}create(){super.create()}update(){const{ins:e,outs:t}=this;if(0==this.activeLanguages.length&&this.addLanguage(t.language.value),e.language.changed&&e.language.value!=t.language.value){const t=e.language.value;this.assetReader.getSystemJSON("language/string.resources."+vs[this.ins.language.value].toLowerCase()+".json").then((e=>{this._translations=e,this.updateLanguage(t)}))}return!0}fromData(e){const{ins:t,outs:n}=this,i=vs[(e=e||{}).language||"EN"];i!=n.language.value&&t.language.value===n.language.value&&(t.language.setValue(isFinite(i)?i:vs.EN),this.updateLanguage(i))}toData(){const e=this.ins;return{language:vs[e.language.getValidatedValue()]}}addLanguage(e){this._activeLanguages.find((t=>t.id===e))||this._activeLanguages.push({id:e,name:ys[vs[e]]})}getLocalizedString(e){const t=this._translations;return void 0===t?e:t[e]||e}}Lh.typeName="CVLanguageManager",Lh.text="Language",Lh.icon="",Lh.isSystemSingleton=!0,Lh.ins={enabled:C("Language.Enabled",!1),language:R("Interface.Language",vs,vs.EN)},Lh.outs={language:R("Interface.Language",vs,vs.EN)};class Nh extends j{constructor(){super(...arguments),this.collection=new Pa,this.process=new Pa,this.images=new Pa,this.articles=new Aa,this.leadArticle=null,this.notes=[],this.audio=new Pa}get language(){return this.getGraphComponent(Lh,!0)}fromDocument(e,t){if(!isFinite(t.meta))throw new Error("info property missing in node");const n=e.metas[t.meta];if(n.collection&&(this.collection.dictionary=n.collection),n.process&&(this.process.dictionary=n.process),n.images){const e={};n.images.forEach((t=>e[t.quality]=t)),this.images.dictionary=e}if(n.articles&&(this.articles.items=n.articles.map((e=>Ra.fromJSON(e))),void 0!==n.leadArticle&&(this.leadArticle=this.articles.getAt(n.leadArticle)),this.articles.items.forEach((e=>{Object.keys(e.data.titles).forEach((e=>{this.language.addLanguage(vs[e])}))}))),n.audio){const e={};n.audio.forEach((t=>e[t.id]=t)),this.audio.dictionary=e}return this.emit("load"),t.meta}toDocument(e,t){let n=null;if(this.collection.length>0&&(n={collection:this.collection.dictionary}),this.process.length>0&&(n=n||{},n.process=this.process.dictionary),this.images.length>0&&(n=n||{},n.images=this.images.items),this.articles.length>0){n=n||{};const e=this.articles.items;n.articles=e.map((e=>e.toJSON())),this.leadArticle&&(n.leadArticle=e.indexOf(this.leadArticle))}if(this.audio.length>0&&(n=n||{},n.audio=this.audio.items),n){e.metas=e.metas||[];const t=e.metas.length;return e.metas.push(n),t}}}Nh.typeName="CVMeta",Nh.text="Meta",Nh.icon="document";class Dh extends j{constructor(){super(...arguments),this._title="Untitled",this._timerStart=0}startTimer(){0===this._timerStart&&(this._timerStart=Date.now())}resetTimer(){this._timerStart=0}getTimerTime(){return this._timerStart>0?Date.now()-this._timerStart:0}setTitle(e){this._title=e}sendProperty(e,t){if("function"==typeof ga){const n=void 0!==t?t.toString():void 0;ga("send","event",this._title,e,n)}}}Dh.typeName="CVAnalytics",Dh.text="Analytics",Dh.icon="",Dh.isSystemSingleton=!0;class Oh extends j{constructor(){super(...arguments),this.ins=this.addInputs(Oh.ins),this.outs=this.addOutputs(Oh.outs)}get settingProperties(){return[this.ins.enabled,this.ins.position]}get snapshotProperties(){return[this.ins.enabled,this.ins.articleId]}get articles(){return Object.keys(this._articles).map((e=>this._articles[e]))}get activeArticle(){return this.outs.article.value}get assetManager(){return this.getMainComponent(Ch)}get assetReader(){return this.getMainComponent(Rh)}get analytics(){return this.getMainComponent(Dh)}get language(){return this.getGraphComponent(Lh)}create(){super.create(),this.getGraphComponents(Nh).forEach((e=>e.on("update",this.updateArticles,this))),this.graph.components.on(Nh,this.onMetaComponent,this),this.graph.components.on(Lh,this.onLanguageComponent,this),this.updateArticles()}dispose(){this.graph.components.off(Lh,this.onLanguageComponent,this),this.graph.components.off(Nh,this.onMetaComponent,this),this.getGraphComponents(Nh).forEach((e=>e.off("update",this.updateArticles,this))),super.dispose()}update(e){const t=this.ins,n=this.outs;if(t.enabled.changed,t.articleId.changed){const e=this._articles[t.articleId.value]||null,i=e&&e.article;n.article.setValue(i),n.content.setValue(""),i&&(this.readArticle(i),this.analytics.sendProperty("Reader.ArticleId",i.defaultTitle))}return!0}readArticle(e){const t=this.outs,n=e.uri;if(n)return this.assetReader.getText(n).then((e=>this.parseArticle(e,n))).then((e=>t.content.setValue(e))).catch((e=>t.content.setValue(`

Article not found at ${n}

`)));t.content.setValue("

Can't display article: no URI.

")}parseArticle(e,t){e=e.replace(/[\n\r]/g,"");const n=this.assetManager.getAssetBasePath(t);return e=e.replace(/(src=\")(.*?)(\")/g,((e,t,i,s)=>(i.startsWith("/")||i.startsWith("http")||(i=this.assetManager.getAssetUrl(n+i)),t+i+s))),Promise.resolve(e)}onMetaComponent(e){e.add&&e.object.articles.on("update",this.updateArticles,this),e.remove&&e.object.articles.off("update",this.updateArticles,this),this.updateArticles()}onLanguageComponent(e){e.add&&e.object.outs.language.on("value",this.updateLanguage,this),e.remove&&e.object.outs.language.off("value",this.updateLanguage,this)}updateArticles(){const e=this.getGraphComponents(Nh),t=this._articles={};e.forEach((e=>{const n=e.articles,i=e.node;n.items.forEach((e=>{t[e.id]={article:e,node:i}}))}));const n=e[0];n&&n.leadArticle?this.ins.articleId.setValue(n.leadArticle.id):this.ins.articleId.setValue("")}updateLanguage(){const e=this.ins;this.articles.forEach((e=>{e.article.language=this.language.outs.language.value})),e.articleId.set()}fromData(e){e=e||{},this.ins.setValues({enabled:!!e.enabled,position:ra[e.position]||ra.Overlay,articleId:e.articleId||""})}toData(){const e=this.ins,t={enabled:e.enabled.value,position:ra[e.position.value]||"Overlay"};return e.articleId.value&&(t.articleId=e.articleId.value),t}}Oh.typeName="CVReader",Oh.text="Reader",Oh.icon="",Oh.ins={enabled:C("Reader.Enabled"),closed:D("Reader.Closed"),position:R("Reader.Position",ra),articleId:A("Article.ID"),focus:C("Reader.Focus")},Oh.outs={article:N("Article.Active",Ra),content:A("Article.Content"),count:x("Article.Count")};class Ih{static registerType(e){if(this.types[e.typeName])throw new Error(`Annotation type '${e.typeName}' already registered.`);this.types[e.typeName]=e}static registerDefaultType(e){this.defaultType=e}static get typeNames(){return[this.defaultTypeName,...Object.keys(this.types).sort()]}static get defaultTypeName(){return this.defaultType.typeName}static getType(e){const t=this.types[e]||this.defaultType;if(!t)throw new Error(`type '${e}' not registered and no default type set.`);return t}static createInstance(e,t,n){return"Circle"===(t=t||e.data.style)?new(this.getType(t))(e,n):new(this.getType(t))(e)}}Ih.types={},Ih.defaultType=null;class kh extends ha{constructor(){super(...arguments),this._language=vs.EN}get title(){return 0===Object.keys(this.data.titles).length&&(this.data.titles.EN=this.data.title),this.data.titles[vs[this.language]]||"undefined"}set title(e){this.data.titles[vs[this.language]]=e,this.update()}get lead(){return 0===Object.keys(this.data.leads).length&&(this.data.leads.EN=this.data.lead),this.data.leads[vs[this.language]]||""}set lead(e){this.data.leads[vs[this.language]]=e,this.update()}get tags(){return 0===Object.keys(this.data.taglist).length&&this.data.tags.length>0&&(this.data.taglist.EN=this.data.tags),this.data.taglist[vs[this.language]]||[]}set tags(e){this.data.taglist[vs[this.language]]=e,this.update()}get language(){return this._language}set language(e){this._language=e}static fromJSON(e){return new kh(e)}init(){return{id:ha.generateId(),title:"New Annotation",titles:{},lead:"",leads:{},marker:"",tags:[],taglist:{},articleId:"",imageUri:"",style:Ih.defaultTypeName,visible:!0,expanded:!1,position:null,direction:null,scale:1,offset:0,tilt:0,azimuth:0,color:[0,.61,.87],zoneIndex:-1}}deflate(e,t){t.id=e.id,Object.keys(this.data.titles).length>0?(t.titles={},Object.keys(this.data.titles).forEach((n=>{t.titles[n]=e.titles[n]}))):e.title&&(t.title=e.title),Object.keys(this.data.leads).length>0?(t.leads={},Object.keys(this.data.leads).forEach((n=>{t.leads[n]=e.leads[n]}))):e.lead&&(t.lead=e.lead),e.marker&&(t.marker=e.marker),Object.keys(this.data.taglist).length>0?(t.taglist={},Object.keys(this.data.taglist).forEach((n=>{t.taglist[n]=e.taglist[n].slice()}))):e.tags.length>0&&(t.tags=e.tags),e.articleId&&(t.articleId=e.articleId),e.imageUri&&(t.imageUri=e.imageUri),e.style!==Ih.defaultTypeName&&(t.style=e.style),!1===e.visible&&(t.visible=e.visible),e.position&&(t.position=e.position.slice()),e.direction&&(t.direction=e.direction.slice()),1!==e.scale&&(t.scale=e.scale),0!==e.offset&&(t.offset=e.offset),0!==e.tilt&&(t.tilt=e.tilt),0!==e.azimuth&&(t.azimuth=e.azimuth);const n=e.color;return!n||1===n[0]&&1===n[1]&&1===n[2]||(t.color=n.slice()),e.zoneIndex>-1&&(t.zoneIndex=e.zoneIndex),e}inflate(e,t){t.id=e.id,t.title=e.title||"",t.titles=e.titles||{},t.lead=e.lead||"",t.leads=e.leads||{},t.marker=e.marker||"",t.tags=e.tags||[],t.taglist=e.taglist||{},t.articleId=e.articleId||"",t.imageUri=e.imageUri||"",t.style=e.style||Ih.defaultTypeName,t.visible=void 0===e.visible||e.visible,t.expanded=!1,t.position=e.position.slice(),t.direction=e.direction.slice(),t.scale=void 0!==e.scale?e.scale:1,t.offset=e.offset||0,t.tilt=e.tilt||0,t.azimuth=e.azimuth||0,t.color=e.color||kh.defaultColor.slice(),t.zoneIndex=void 0!==e.zoneIndex?e.zoneIndex:-1}}kh.defaultColor=[0,.61,.87];class zh{constructor(e,t){this.x=e||0,this.y=t||0}static makeZeros(){return new zh(0,0)}static makeOnes(){return new zh(1,1)}static makeUnitX(){return new zh(1,0)}static makeUnitY(){return new zh(0,1)}static makeCopy(e){return new zh(e.x,e.y)}static makeFromScalar(e){return new zh(e,e)}static makeFromArray(e){return new zh(e[0],e[1])}static toString(e){return`[${e.x}, ${e.y}]`}copy(e){return this.x=e.x,this.y=e.y,this}set(e,t){return this.x=e,this.y=t,this}setFromScalar(e){return this.x=e,this.y=e,this}setFromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}setZeros(){return this.x=0,this.y=0,this}setOnes(){return this.x=1,this.y=1,this}setUnitX(){return this.x=1,this.y=0,this}setUnitY(){return this.x=0,this.y=1,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}mul(e){return this.x*=e.x,this.y*=e.y,this}div(e){return this.x/=e.x,this.y/=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}subScalar(e){return this.x-=e,this.y-=e,this}mulScalar(e){return this.x*=e,this.y*=e,this}divScalar(e){return this.x/=e,this.y/=e,this}translate(e,t){return this.x+=e,this.y+=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.y;return this.x=t*i-n*s,this.y=n*i+t*s,this}scale(e,t){return this.x*=e,this.y*=t,this}invert(){return this.x=1/this.x,this.y=1/this.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y);return this.x*=e,this.y*=e,this}dot(e){return this.x*e.x+this.y*e.y}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}lengthSquared(){const e=this.x,t=this.y;return e*e+t*t}distanceTo(e){const t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)}angle(){return Math.atan2(this.y,this.x)}angleTo(e){const t=this.x,n=this.y,i=e.x,s=e.y;return Math.acos((t*i+n*s)/(Math.sqrt(t*t+n*n)+Math.sqrt(i*i+s*s)))}min(){return this.xthis.y?this.x:this.y}isZero(){return 0===this.x&&0===this.y}clone(){return new zh(this.x,this.y)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e):[this.x,this.y]}toString(){return zh.toString(this)}}zh.zeros=new zh(0,0),zh.ones=new zh(1,1),zh.unitX=new zh(1,0),zh.unitY=new zh(0,1);class Uh{constructor(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}static makeZeros(){return new Uh(0,0,0)}static makeOnes(){return new Uh(1,1,1)}static makeUnitX(){return new Uh(1,0,0)}static makeUnitY(){return new Uh(0,1,0)}static makeUnitZ(){return new Uh(0,0,1)}static makeCopy(e){return new Uh(e.x,e.y,e.z)}static makeFromScalar(e){return new Uh(e,e,e)}static makeFromArray(e){return new Uh(e[0],e[1],e[2])}static toString(e){return`[${e.x}, ${e.y}, ${e.z}]`}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}setFromScalar(e){return this.x=e,this.y=e,this.z=e,this}setFromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}setZeros(){return this.x=0,this.y=0,this.z=0,this}setOnes(){return this.x=1,this.y=1,this.z=1,this}setUnitX(){return this.x=1,this.y=0,this.z=0,this}setUnitY(){return this.x=0,this.y=1,this.z=0,this}setUnitZ(){return this.x=0,this.y=0,this.z=1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}mul(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}div(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}mulScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divScalar(e){return this.x/=e,this.y/=e,this.z/=e,this}translate(e,t,n){return this.x+=e,this.y+=t,this.z+=n,this}rotateX(e){const t=Math.cos(e),n=Math.sin(e),i=this.y,s=this.z;return this.y=t*i-n*s,this.z=n*i+t*s,this}rotateY(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.z;return this.x=t*i+n*s,this.z=-n*i+t*s,this}rotateZ(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.y;return this.x=t*i-n*s,this.y=n*i+t*s,this}scale(e,t,n){return this.x*=e,this.y*=t,this.z*=n,this}invert(){return this.x=1/this.x,this.y=1/this.y,this.z=1/this.z,this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x*=e,this.y*=e,this.z*=e,this}homogenize(){return this.x/=this.z,this.y/=this.z,this.z=1,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){const t=this.y*e.z-this.z*e.y,n=this.z*e.x-this.x*e.z,i=this.x*e.y-this.y*e.x;return this.x=t,this.y=n,this.z=i,this}length(){const e=this.x,t=this.y,n=this.z;return Math.sqrt(e*e+t*t+n*n)}lengthSquared(){const e=this.x,t=this.y,n=this.z;return e*e+t*t+n*n}distanceTo(e){const t=e.x-this.x,n=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+n*n+i*i)}min(){return this.xthis.y?this.x>this.z?this.x:this.z:this.y>this.z?this.y:this.z}isZero(){return 0===this.x&&0===this.y&&0===this.z}clone(){return new Uh(this.x,this.y,this.z)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e):[this.x,this.y,this.z]}toVector2(e){return e?(e.x=this.x,e.y=this.y,e):new zh(this.x,this.y)}toString(){return Uh.toString(this)}}Uh.zeros=new Uh(0,0,0),Uh.ones=new Uh(1,1,1),Uh.unitX=new Uh(1,0,0),Uh.unitY=new Uh(0,1,0),Uh.unitZ=new Uh(0,0,1);class Vh{constructor(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=i||0}static makeZeros(){return new Vh(0,0,0,0)}static makeOnes(){return new Vh(1,1,1,1)}static makeUnitX(){return new Vh(1,0,0,0)}static makeUnitY(){return new Vh(0,1,0,0)}static makeUnitZ(){return new Vh(0,0,1,0)}static makeUnitW(){return new Vh(0,0,0,1)}static makeCopy(e){return new Vh(e.x,e.y,e.z,e.w)}static makeFromScalar(e){return new Vh(e,e,e,e)}static makeFromArray(e){return new Vh(e[0],e[1],e[2],e[3])}static makeFromPosition(e){return new Vh(e.x,e.y,e.z,1)}static makeFromDirection(e){return new Vh(e.x,e.y,e.z,0)}static toString(e){return`[${e.x}, ${e.y}, ${e.z}, ${e.w}]`}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=void 0===i?1:i,this}setFromScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setFromArray(e,t=1){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}setPosition(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=1,this}setDirection(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=0,this}setZeros(){return this.x=0,this.y=0,this.z=0,this.w=0,this}setOnes(){return this.x=1,this.y=1,this.z=1,this.w=1,this}setUnitX(){return this.x=1,this.y=0,this.z=0,this.w=0,this}setUnitY(){return this.x=0,this.y=1,this.z=0,this.w=0,this}setUnitZ(){return this.x=0,this.y=0,this.z=1,this.w=0,this}setUnitW(){return this.x=0,this.y=0,this.z=0,this.w=1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}mul(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}div(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}homogenize(){return this.x/=this.w,this.y/=this.w,this.z/=this.w,this.w=1,this}project(e){const t=this.dot(e)/this.lengthSquared();return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}length(){const e=this.x,t=this.y,n=this.z,i=this.w;return Math.sqrt(e*e+t*t+n*n+i*i)}lengthSquared(){const e=this.x,t=this.y,n=this.z,i=this.w;return e*e+t*t+n*n+i*i}isZero(){return 0===this.x&&0===this.y&&0===this.z&&0===this.w}clone(){return new Vh(this.x,this.y,this.z,this.w)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e):[this.x,this.y,this.z,this.w]}toVector3(e){return e?(e.x=this.x,e.y=this.y,e.z=this.z,e):new Uh(this.x,this.y,this.z)}toString(){return Vh.toString(this)}}Vh.zeros=new Vh(0,0,0,0),Vh.ones=new Vh(1,1,1,1),Vh.unitX=new Vh(1,0,0,0),Vh.unitY=new Vh(0,1,0,0),Vh.unitZ=new Vh(0,0,1,0),Vh.unitW=new Vh(0,0,0,1);class Fh{constructor(e=0,t=0,n=0,i=1){e instanceof Fh?(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):Array.isArray(e)?(this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0,this.w=void 0!==e[3]?e[3]:1):"string"==typeof e?this.setString(e):(this.x=e,this.y=t,this.z=n,this.w=i)}static fromString(e){return(new Fh).setString(e)}static fromArray(e){return new Fh(e)}get r(){return this.x}get g(){return this.y}get b(){return this.z}get a(){return this.w}set r(e){this.x=e}set g(e){this.y=e}set b(e){this.z=e}set a(e){this.w=e}get red(){return this.x}get green(){return this.y}get blue(){return this.z}get alpha(){return this.w}set red(e){this.x=e}set green(e){this.y=e}set blue(e){this.z=e}set alpha(e){this.w=e}get redByte(){return Math.floor(255*this.x)}get greenByte(){return Math.floor(255*this.y)}get blueByte(){return Math.floor(255*this.z)}get alphaByte(){return Math.floor(255*this.w)}set redByte(e){this.x=e/255}set greenByte(e){this.y=e/255}set blueByte(e){this.z=e/255}set alphaByte(e){this.w=e/255}inverseMultiply(e){return this.x=this.x*(1-e)+e,this.y=this.y*(1-e)+e,this.z=this.z*(1-e)+e,this}multiply(e){return this.x*=e,this.y*=e,this.z*=e,this}copy(e){this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w}clone(){return new Fh(this.x,this.y,this.z,this.w)}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=void 0===i?1:i,this}setBytes(e,t,n,i){return this.x=e/255,this.y=t/255,this.z=n/255,this.w=void 0===i?1:i/255,this}setUInt24RGB(e){return this.x=e>>16&255,this.y=e>>8&255,this.z=255&e,this.w=1,this}setUInt32RGBA(e){return this.x=e>>24&255,this.y=e>>16&255,this.z=e>>8&255,this.w=255&e,this.w=1,this}setRed(e){return this.x=e,this}setGreen(e){return this.y=e,this}setBlue(e){return this.z=e,this}setAlpha(e){return this.w=e,this}setRedByte(e){return this.x=e/255,this}setGreenByte(e){return this.y=e/255,this}setBlueByte(e){return this.z=e/255,this}setAlphaByte(e){return this.w=e/255,this}setHSV(e,t=1,n=1,i){"object"==typeof e&&(t=e.y,n=e.z,i=void 0!==e.w?e.w:i,e=e.x);const s=Math.floor(e/60),r=e/60-s,o=n*(1-t),a=n*(1-r*t),l=n*(1-(1-r)*t);let c,h,u;switch(s%6){case 0:c=n,h=l,u=o;break;case 1:c=a,h=n,u=o;break;case 2:c=o,h=n,u=l;break;case 3:c=o,h=a,u=n;break;case 4:c=l,h=o,u=n;break;case 5:c=n,h=o,u=a}return this.x=c,this.y=h,this.z=u,void 0!==i&&(this.w=i),this}setHSL(e,t=1,n=1,i){if("object"==typeof e&&(t=e.y,n=e.z,i=void 0!==e.w?e.w:i,e=e.x),0===t)this.x=this.y=this.z=n;else{function i(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}e/=360;var s=n<.5?n*(1+t):n+t-n*t,r=2*n-s;this.x=i(r,s,e+1/3),this.y=i(r,s,e),this.z=i(r,s,e-1/3)}return void 0!==i&&(this.w=i),this}fromArray(e){this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0,this.w=void 0!==e[3]?e[3]:1}setString(e,t=1,n=!0){e=e.trim().toLowerCase();let i=(e=Fh.presets[e]||e).match(/^#?([0-9a-f]{3})$/i);if(i){const e=i[1],n=1/15;return this.x=Number.parseInt(e.charAt(0),16)*n,this.y=Number.parseInt(e.charAt(1),16)*n,this.z=Number.parseInt(e.charAt(2),16)*n,this.w=t,this}if(i=e.match(/^#?([0-9a-f]{6})$/i),i){const e=i[1],n=1/255;return this.x=Number.parseInt(e.substr(0,2),16)*n,this.y=Number.parseInt(e.substr(2,2),16)*n,this.z=Number.parseInt(e.substr(4,2),16)*n,this.w=t,this}if(0===e.indexOf("rgb")){let n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n){const e=1/255;return this.x=Number.parseInt(n[1])*e,this.y=Number.parseInt(n[2])*e,this.z=Number.parseInt(n[3])*e,this.w=t,this}if(n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+.*\d*)\s*\)$/i),n){const e=1/255;return this.x=Number.parseInt(n[1])*e,this.y=Number.parseInt(n[2])*e,this.z=Number.parseInt(n[3])*e,this.w=Number.parseFloat(n[4]),this}}if(0===e.indexOf("hsl")){let n=e.match(/(\d+(\.\d+)?)/g);return n&&this.setHSL(Number.parseFloat(n[0]),.01*Number.parseFloat(n[1]),.01*Number.parseFloat(n[2]),void 0!==n[3]?Number.parseFloat(n[3]):t),this}if(n)throw new RangeError("failed to parse color from string: "+e);return this}toUInt24RGB(){return Math.floor(255*this.x)<<16+Math.floor(255*this.y)<<8+Math.floor(255*this.z)}toUInt32RGBA(){return Math.floor(255*this.x)<<24+Math.floor(255*this.y)<<16+Math.floor(255*this.z)<<8+Math.floor(255*this.w)}toVector3(e){return e?(e.x=this.r,e.y=this.g,e.z=this.b,e):new Uh(this.r,this.g,this.b)}toVector4(e){return e?(e.x=this.r,e.y=this.g,e.z=this.b,e.w=this.a,e):new Vh(this.r,this.g,this.b,this.a)}toHSV(e){let t=this.x,n=this.y,i=this.z,s=Math.min(t,n,i),r=Math.max(t,n,i),o=r-s,a=0,l=0===r?0:o/r,c=r;return 0!==o&&(a=60*(t===r?(n-i)/o+(n.5?o/(2-r-s):o/(r+s),a=60*(t===r?(n-i)/o+(n=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let jh=class extends Zr{constructor(){super(),this.name="",this.index=0,this.selectedIndex=-1,this.tabbingIndex=0,this.selected=!1,this.selectable=!1,this.disabled=!1,this.icon="",this.role="button",this.caret=!1,this.inline=!1,this.transparent=!1,this.addEventListener("click",(e=>this.onClick(e))),this.addEventListener("keydown",(e=>this.onKeyDown(e)))}firstConnected(){this.tabIndex=this.tabbingIndex,this.setAttribute("role",this.role),this.classList.add("ff-button")}shouldUpdate(e){return(e.has("selectedIndex")||e.has("index"))&&this.selectedIndex>=0&&(this.selected=this.index===this.selectedIndex),e.has("disabled")&&this.setClass("ff-disabled",this.disabled),!0}update(e){this.classList.remove("ff-inline","ff-transparent","ff-control"),this.inline?this.classList.add("ff-inline"):this.transparent?this.classList.add("ff-transparent"):this.classList.add("ff-control"),super.update(e)}render(){return _r`${this.renderIcon()}${this.renderText()}${this.renderCaret()}`}renderIcon(){return this.icon?_r``:null}renderText(){return this.text?_r`
${this.text}
`:null}renderCaret(){return this.caret?_r`
`:null}onClick(e){this.selectable&&(this.selected=!this.selected)}onKeyDown(e){(document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement)!==this||"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),this.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}};Bh([Or({type:String})],jh.prototype,"name",void 0),Bh([Or({type:Number})],jh.prototype,"index",void 0),Bh([Or({type:Number})],jh.prototype,"selectedIndex",void 0),Bh([Or({type:Number})],jh.prototype,"tabbingIndex",void 0),Bh([Or({type:Boolean,reflect:!0})],jh.prototype,"selected",void 0),Bh([Or({type:Boolean})],jh.prototype,"selectable",void 0),Bh([Or({type:Boolean})],jh.prototype,"disabled",void 0),Bh([Or()],jh.prototype,"text",void 0),Bh([Or()],jh.prototype,"icon",void 0),Bh([Or()],jh.prototype,"role",void 0),Bh([Or({type:Boolean})],jh.prototype,"caret",void 0),Bh([Or({type:Boolean})],jh.prototype,"inline",void 0),Bh([Or({type:Boolean})],jh.prototype,"transparent",void 0),jh=Bh([Qr("ff-button")],jh);const $h=jh;class Hh extends rl{constructor(e=[]){super(),this.cameras=e}}Hh.prototype.isArrayCamera=!0;const Gh=new Ve(0,1,0),Wh=new Ve,qh=new Ve,Xh=new Ve;class Yh extends Ea{constructor(e,t){super(),this.isAdaptive=!0,this.annotation=e,this.matrixAutoUpdate=!1}get typeName(){return this.constructor.typeName}update(){super.update();const e=this.annotation.data;this.position.fromArray(e.position),Wh.fromArray(e.direction).normalize(),this.quaternion.setFromUnitVectors(Gh,Wh),this.updateMatrix()}emitClickEvent(){const e={type:"click",annotation:this.annotation,sprite:this};this.dispatchEvent(e)}emitLinkEvent(e){const t={type:"link",annotation:this.annotation,sprite:this,link:e};this.dispatchEvent(t)}isBehindCamera(e,t){let n=null;n=t instanceof Hh&&t.cameras.length>0?t.cameras[0]:t;const i=n.matrixWorld.elements;return e.updateMatrixWorld(),qh.setFromMatrixPosition(e.matrixWorld),Xh.setFromMatrixPosition(n.matrixWorld),Wh.set(-i[8],-i[9],-i[10]).normalize(),Xh.addScaledVector(Wh,n.near),Xh.sub(qh),Xh.angleTo(Wh)<=Math.PI/2}}Yh.typeName="Annotation";class Kh extends Ta{constructor(e){super(),this.sprite=e,this.discardEvent=this.discardEvent.bind(this),this.addEventListener("pointerdown",this.discardEvent),this.addEventListener("pointercancel",this.discardEvent),this.addEventListener("click",this.discardEvent)}firstConnected(){super.firstConnected(),this.classList.add("sv-annotation")}discardEvent(e){e.stopPropagation()}}var Jh=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const Zh=["sv-q0","sv-q1","sv-q2","sv-q3"],Qh=new Fh,eu=new Ve(0,1,0);class tu extends Yh{constructor(e){super(e),this.quadrant=-1,this.adaptive=!0;const t=[];t.push(new Ve(0,0,0)),t.push(new Ve(0,1,0));const n=(new qn).setFromPoints(t),i=new Ts({color:"#009cde",transparent:!0});this.stemLine=new Ns(n,i),this.stemLine.frustumCulled=!1,this.stemLine.matrixAutoUpdate=!1,this.add(this.stemLine),this.update()}update(){const e=this.annotation.data;this.stemLine.scale.setScalar(e.scale),this.stemLine.position.y=e.offset,this.stemLine.updateMatrix();this.stemLine.material.color.fromArray(e.color),super.update()}renderHTMLElement(e,t,n){super.renderHTMLElement(e,t,n,this.stemLine,eu);const i=vt.scaleLimit(this.viewAngle*vt.RAD2DEG,90,100,1,0),s=this.annotation.data.visible?i:0;this.stemLine.material.opacity=s,e.setOpacity(s),this.orientationQuadrant!==this.quadrant&&(e.classList.remove(Zh[this.quadrant]),e.classList.add(Zh[this.orientationQuadrant]),this.quadrant=this.orientationQuadrant),this.adaptive!==this.isAdaptive&&(this.isAdaptive?e.classList.remove("sv-static-width"):e.classList.add("sv-static-width"),this.adaptive=this.isAdaptive),this.setVisible(!this.isBehindCamera(this.stemLine,n))}createHTMLElement(){return new nu(this)}}tu.typeName="Standard",Ih.registerDefaultType(tu);let nu=class extends Kh{constructor(e){super(e),this.onClickTitle=this.onClickTitle.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.titleElement=this.appendElement("div"),this.titleElement.classList.add("sv-title"),this.titleElement.addEventListener("click",this.onClickTitle)}firstConnected(){super.firstConnected(),this.classList.add("sv-standard-annotation")}update(e){super.update(e);const t=this.sprite.annotation.data;this.titleElement.innerText=this.sprite.annotation.title,Qh.fromArray(t.color),this.style.borderColor=Qh.toString()}onClickTitle(e){e.stopPropagation(),this.sprite.emitClickEvent()}onKeyDown(e){"Space"!==e.code&&"Enter"!==e.code||(e.stopPropagation(),this.sprite.emitClickEvent())}};nu=Jh([Qr("sv-standard-annotation")],nu);var iu=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const su=["sv-q0","sv-q1","sv-q2","sv-q3"],ru=new Fh,ou=new Ve(0,1,0);class au extends Yh{constructor(e){super(e),this.quadrant=-1,this.adaptive=!0;const t=[];t.push(new Ve(0,0,0)),t.push(new Ve(0,1,0));const n=(new qn).setFromPoints(t),i=new Ts({color:"#009cde",transparent:!0});this.stemLine=new Ns(n,i),this.stemLine.frustumCulled=!1,this.stemLine.matrixAutoUpdate=!1,this.add(this.stemLine),this.update()}update(){const e=this.annotation.data;this.stemLine.scale.setScalar(e.scale),this.stemLine.position.y=e.offset,this.stemLine.updateMatrix();this.stemLine.material.color.fromArray(e.color),super.update()}renderHTMLElement(e,t,n){super.renderHTMLElement(e,t,n,this.stemLine,ou);const i=vt.scaleLimit(this.viewAngle*vt.RAD2DEG,90,100,1,0),s=this.annotation.data.visible?i:0;this.stemLine.material.opacity=s,e.setOpacity(s),this.orientationQuadrant!==this.quadrant&&(e.classList.remove(su[this.quadrant]),e.classList.add(su[this.orientationQuadrant]),this.quadrant=this.orientationQuadrant),this.adaptive!==this.isAdaptive&&(this.isAdaptive?e.classList.remove("sv-static-width"):e.classList.add("sv-static-width"),this.adaptive=this.isAdaptive),this.setVisible(!this.isBehindCamera(this.stemLine,n))}createHTMLElement(){return new lu(this)}}au.typeName="Extended",Ih.registerType(au);let lu=class extends Kh{constructor(e){super(e),this.handler=0,this.isExpanded=void 0,this.onClickTitle=this.onClickTitle.bind(this),this.onClickArticle=this.onClickArticle.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.titleElement=this.appendElement("div"),this.titleElement.classList.add("sv-title"),this.titleElement.addEventListener("click",this.onClickTitle),this.wrapperElement=this.appendElement("div"),this.contentElement=this.createElement("div",null,this.wrapperElement),this.contentElement.classList.add("sv-content"),this.contentElement.style.display="none"}firstConnected(){super.firstConnected(),this.classList.add("sv-extended-annotation")}update(e){super.update(e);const t=this.sprite.annotation.data;this.titleElement.innerText=this.sprite.annotation.title;const n=_r`

${this.sprite.annotation.lead}

- ${t.articleId?_r``:null}`;br(n,this.contentElement),ru.fromArray(t.color),this.style.borderColor=ru.toString(),this.isExpanded&&(this.contentElement.style.height="auto"),this.isExpanded!==t.expanded&&(this.isExpanded=t.expanded,window.clearTimeout(this.handler),this.isExpanded?(this.classList.add("sv-expanded"),this.style.minWidth=this.sprite.annotation.lead.length<40?"0":"",this.contentElement.style.display="inherit",this.contentElement.style.height=this.contentElement.scrollHeight+"px"):(this.classList.remove("sv-expanded"),this.contentElement.style.height="0",this.handler=window.setTimeout((()=>this.contentElement.style.display="none"),300)))}onClickTitle(e){e.stopPropagation(),this.sprite.emitClickEvent()}onClickArticle(e){e.stopPropagation(),this.sprite.emitLinkEvent(this.sprite.annotation.data.articleId)}onKeyDown(e){"Space"!==e.code&&"Enter"!==e.code||(e.stopPropagation(),this.sprite.emitClickEvent())}};lu=iu([Qr("sv-extended-annotation")],lu);class cu extends qn{constructor(e=.5,t=1,n=8,i=1,s=0,r=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:r},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=e;const u=(t-e)/(i=Math.max(1,i)),d=new Ve,p=new sn;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=s+e/n*r;d.x=h*Math.cos(i),d.y=h*Math.sin(i),a.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,c.push(p.x,p.y)}h+=u}for(let e=0;e0}));this.visibleGlyphs=r;var o=mu.positions(r),a=mu.uvs(r,i,s,t),l=pu([],{clockwise:!0,type:"uint16",count:r.length});if(this.setIndex(l),this.setAttribute("position",new On(o,2)),this.setAttribute("uv",new On(a,2)),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var c=mu.pages(r);this.setAttribute("page",new On(c,1))}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new cn);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);fu.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Lt);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():fu.computeBox(t,e)}}var vu=n(4439);function yu(e){var t="number"==typeof(e=e||{}).opacity?e.opacity:1,n="number"==typeof e.alphaTest?e.alphaTest:1e-4,i=e.precision||"highp",s=e.color,r=e.map,o="boolean"!=typeof e.negate||e.negate,a=e.isWebGL2||!1;return delete e.map,delete e.color,delete e.precision,delete e.opacity,delete e.negate,delete e.isWebGL2,vu(a?{uniforms:{opacity:{type:"f",value:t},map:{type:"t",value:r||new fo},color:{type:"c",value:new Pn(s)}},vertexShader:["#version 300 es","in vec2 uv;","in vec4 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","out vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * position;","}"].join("\n"),fragmentShader:["#version 300 es","precision "+i+" float;","uniform float opacity;","uniform vec3 color;","uniform sampler2D map;","in vec2 vUv;","out vec4 myOutputColor;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","void main() {"," vec3 s = "+(o?"1.0 - ":"")+"texture(map, vUv).rgb;"," float sigDist = median(s.r, s.g, s.b) - 0.5;"," float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0.0, 1.0);"," myOutputColor = vec4(color.xyz, alpha * opacity);",0===n?"":" if (myOutputColor.a < "+n+") discard;","}"].join("\n")}:{uniforms:{opacity:{type:"f",value:t},map:{type:"t",value:r||new fo},color:{type:"c",value:new Pn(s)}},vertexShader:["attribute vec2 uv;","attribute vec4 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * position;","}"].join("\n"),fragmentShader:["#ifdef GL_OES_standard_derivatives","#extension GL_OES_standard_derivatives : enable","#endif","precision "+i+" float;","uniform float opacity;","uniform vec3 color;","uniform sampler2D map;","varying vec2 vUv;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","void main() {"," vec3 sample = "+(o?"1.0 - ":"")+"texture2D(map, vUv).rgb;"," float sigDist = median(sample.r, sample.g, sample.b) - 0.5;"," float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0.0, 1.0);"," gl_FragColor = vec4(color.xyz, alpha * opacity);",0===n?"":" if (gl_FragColor.a < "+n+") discard;","}"].join("\n")},e)}var bu=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const xu=new Ve,_u=new Ve,wu=new Ue,Su=new je;class Mu extends Yh{constructor(e,t){super(e),this._isExpanded=!1,this.xrScale=1,this.isWebGL2=!1,this._isExpanded=e.data.expanded,this.offset=new Es,this.offset.matrixAutoUpdate=!1,this.add(this.offset),this.ringGeometry=new cu(.45,.5,32),this.ringMaterialA=new Rn,this.ringMaterialB=new Rn({depthFunc:6,depthWrite:!1,opacity:Mu.behindOpacity,transparent:!0}),this.ringMesh=new ui(this.ringGeometry,this.ringMaterialA);const n=new ui(this.ringGeometry,this.ringMaterialB),i=new ui(new hu(.45,32),new Rn({color:0,opacity:.65,transparent:!0}));i.matrixAutoUpdate=!1,i.position.set(0,0,.005),i.updateMatrix(),this.anchorMesh=new ui(new qn,new Rn),this.anchorMesh.frustumCulled=!1,this.offset.add(this.anchorMesh,this.ringMesh,n,i),this.markerGeometry=null,this.markerA=null,this.markerB=null,t.fontReader.load("fonts/Roboto-Bold").then((e=>{var t;this.markerMaterialA=new uu(yu({map:e.texture,transparent:!0,color:16777215,isWebGL2:this.isWebGL2})),this.markerMaterialB=new uu(yu({map:e.texture,transparent:!0,opacity:Mu.behindOpacity,color:16777215,depthFunc:6,depthWrite:!1,isWebGL2:this.isWebGL2})),this.markerGeometry=(t={font:e.descriptor},new gu(t)),this.markerA=new ui(this.markerGeometry,this.markerMaterialA),this.markerA.matrixAutoUpdate=!1,this.markerB=new ui(this.markerGeometry,this.markerMaterialB),this.markerB.matrixAutoUpdate=!1,Po.add(this.markerA,!1),Po.add(this.markerB,!1),this.offset.add(this.markerA,this.markerB),this.update()})),this.update()}dispose(){this.offset=null,this.anchorMesh=null,this.ringMesh=null,this.ringGeometry=null,this.ringMaterialA=null,this.ringMaterialB=null,this.markerGeometry=null,this.markerMaterialA=null,this.markerMaterialB=null,this.markerA=null,this.markerB=null,super.dispose()}update(){const e=this.annotation.data,t=e.color;if(this.ringMaterialA.color.setRGB(t[0],t[1],t[2]),this.ringMaterialB.color.setRGB(t[0],t[1],t[2]),this.markerA){const t=e.marker.length>1?.013:.016,n=this.markerGeometry;n.update(e.marker),n.computeBoundingBox(),n.boundingBox.getCenter(xu),this.markerA.position.set(-t*(xu.x+1),t*xu.y,.01),this.markerA.scale.set(t,-t,-1),this.markerA.updateMatrix(),this.markerB.position.set(-t*(xu.x+1),t*xu.y,.01),this.markerB.scale.set(t,-t,-1),this.markerB.updateMatrix()}super.update()}renderHTMLElement(e,t,n){const i=this.annotation.data;let s=null;const r=this.annotation.data.visible;n instanceof Hh&&(s=n.cameras[0]),s?Su.copy(s.matrixWorldInverse):Su.copy(n.matrixWorldInverse),Su.multiply(this.matrixWorld),Su.decompose(xu,wu,_u),this.offset.quaternion.copy(wu.invert()),this.offset.parent.matrixWorld.decompose(xu,wu,_u);const o=1/_u.x*(1/i.scale)*this.xrScale,a=t.offsetHeight+250,l=55*i.scale/a*o;let c=1;if(n.isPerspectiveCamera){const e=-xu.set(0,0,0).applyMatrix4(Su).z,t=n.fov*Re*.5;c=Math.tan(t)*e*l}else c=.5*n.size*l;if(this.offset.scale.setScalar(c),this.offset.position.set(0,(i.offset+1)*c*.5,0),this.offset.updateMatrix(),this.setVisible(!this.isBehindCamera(this.offset,n)&&r),this.getVisible()||e.setVisible(this.getVisible()),i.expanded){xu.set(0,0,0).applyMatrix4(this.anchorMesh.modelViewMatrix).applyMatrix4(n.projectionMatrix),_u.set(.6,.5,0).applyMatrix4(this.anchorMesh.modelViewMatrix).applyMatrix4(n.projectionMatrix);const i=.5*(xu.x+1)*t.clientWidth,s=.5*(1-xu.y)*t.clientHeight,r=.5*(_u.x+1)*t.clientWidth-i,o=.5*(1-_u.y)*t.clientHeight-s;let a=i+r,l=s+o;e.classList.remove("sv-align-right","sv-align-bottom"),a+e.offsetWidth>=t.offsetWidth&&(a=i-r,e.classList.add("sv-align-right")),l+e.offsetHeight>=t.offsetHeight&&(l=s-o,e.classList.add("sv-align-bottom")),e.setPosition(a,l)}this._isExpanded!==i.expanded&&(e.style.visibility="",this._isExpanded=i.expanded)}createHTMLElement(){return new Eu(this)}updateHTMLElement(e){e.setVisible(this.getVisible()),this.annotation.data.expanded&&this._isExpanded!==this.annotation.data.expanded&&(e.style.visibility="hidden"),e.requestUpdate()}}Mu.typeName="Circle",Mu.behindOpacity=.2,Ih.registerType(Mu);let Eu=class extends Kh{constructor(e){super(e)}setVisible(e){super.setVisible(e&&this.sprite.annotation.data.expanded)}firstConnected(){super.firstConnected(),this.classList.add("sv-circle-annotation")}render(){const e=this.sprite.annotation,t=e.data;return _r`
${e.title}
-

${e.lead}

- ${t.articleId?_r``:null}`}onClickArticle(e){e.stopPropagation(),this.sprite.emitLinkEvent(this.sprite.annotation.data.articleId)}};Eu=bu([Qr("sv-circle-annotation")],Eu);class Tu extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(Tu.ins),this._activeAnnotation=null,this._annotations={},this._viewports=new Set,this._sprites={},this.addEvents("active-annotation","group"),this.onSpriteClick=this.onSpriteClick.bind(this),this.onSpriteLink=this.onSpriteLink.bind(this),this.on("pointer-up",this.onPointerUp,this),this.system.on("pointer-up",this.onSystemPointerUp,this),this.arManager.outs.isPresenting.on("value",this.handleARStateChange,this),this.language.outs.language.on("value",this.updateLanguage,this),this.object3D=new Ca}get model(){return this.getComponent(Zd)}get meta(){return this.getComponent(Nh,!0)}get reader(){return this.getGraphComponent(Oh,!0)}get language(){return this.getGraphComponent(Lh,!0)}get articles(){const e=this.meta;return e?e.articles:null}get arManager(){return this.system.getMainComponent(gp)}get renderer(){return this.getMainComponent(Ae)}get assetReader(){return this.getMainComponent(Rh)}get activeAnnotation(){return this._activeAnnotation}set activeAnnotation(e){if(e!==this._activeAnnotation){const t=this._activeAnnotation;t&&(t.set("expanded",!1),this.updateSprite(t)),this._activeAnnotation=e,e&&(e.set("expanded",!0),this.updateSprite(e));const n=this.ins;n.marker.setValue(e?e.data.marker:"",!0),n.title.setValue(e?e.title:"",!0),n.lead.setValue(e?e.lead:"",!0),n.tags.setValue(e?e.tags.join(", "):"",!0),n.style.setOption(e?e.data.style:Ih.defaultTypeName,!0),n.scale.setValue(e?100*e.data.scale*Jo(this.model.ins.localUnits.getValidatedValue(),gs.m):1,!0),n.offset.setValue(e?100*e.data.offset*Jo(this.model.ins.localUnits.getValidatedValue(),gs.m):0,!0),n.tilt.setValue(e?e.data.tilt:0,!0),n.azimuth.setValue(e?e.data.azimuth:0,!0),n.color.setValue(e?e.data.color.slice():[1,1,1],!0);const i=this.articles;if(i){const t=i.items.map((e=>e.title));t.unshift("(none)"),n.article.setOptions(t);const s=e?i.getById(e.data.articleId):null;n.article.setValue(s?i.getIndexOf(s)+1:0,!0)}else n.article.setOptions(["(none)"]),n.article.setValue(0);n.image.setValue(e?e.data.imageUri:"",!0),this.emit({type:"annotation-update",annotation:e})}}get hasAnnotations(){return Object.keys(this._annotations).length>0}setActiveAnnotationById(e){this.activeAnnotation=this._annotations[e]}update(e){super.update(e);const t=this.ins,n=this.object3D,i=this.activeAnnotation;if(t.unitScale.changed&&(n.scale.setScalar(t.unitScale.value),n.updateMatrix()),t.activeTags.changed){const e=t.activeTags.value.split(",").map((e=>e.trim())).filter((e=>e));for(const t in this._annotations){const n=this._annotations[t],i=n.tags;let s=0===i.length;e.forEach((e=>{i.indexOf(e)>=0&&(s=!0)})),n.set("visible",s),this.updateSprite(n)}}if(t.visible.changed&&n.setVisible(t.visible.value),i){if(t.marker.changed&&i.set("marker",t.marker.value),t.title.changed&&(i.title=t.title.value),t.lead.changed&&(i.lead=t.lead.value),t.tags.changed&&(i.tags=t.tags.value.split(",").map((e=>e.trim())).filter((e=>e)),this.emit({type:"tag-update"})),t.style.changed&&(i.set("style",t.style.getOptionText()),this.createSprite(i)),t.scale.changed&&i.set("scale",t.scale.value*Jo(gs.m,this.model.ins.localUnits.getValidatedValue())*.01),t.offset.changed&&i.set("offset",t.offset.value*Jo(gs.m,this.model.ins.localUnits.getValidatedValue())*.01),t.tilt.changed&&i.set("tilt",t.tilt.value),t.azimuth.changed&&i.set("azimuth",t.azimuth.value),t.color.changed&&i.set("color",t.color.value.slice()),t.image.changed&&i.set("imageUri",t.image.value),t.article.changed){const e=this.articles,n=e&&e.getAt(t.article.getValidatedValue()-1);i.set("articleId",n?n.id:"")}this.updateSprite(i),this.emit({type:"annotation-update",annotation:i})}return!0}tock(){if(this.updated)return!0}postRender(e){const t=e.viewport;this._viewports.has(t)||(t.on("dispose",this.onViewportDispose,this),this._viewports.add(t));this.object3D.render(t.overlay,e.camera)}dispose(){this.object3D.dispose(),this.off("pointer-up",this.onPointerUp,this),this.system.off("pointer-up",this.onSystemPointerUp,this),this.arManager.outs.isPresenting.off("value",this.handleARStateChange,this),this.language.outs.language.off("value",this.updateLanguage,this),this._viewports.forEach((e=>e.off("dispose",this.onViewportDispose,this))),this._viewports.clear(),super.dispose()}getAnnotations(){return Object.keys(this._annotations).map((e=>this._annotations[e]))}addAnnotation(e){this._annotations[e.id]=e,this.createSprite(e),Object.keys(e.data.titles).forEach((e=>{this.language.addLanguage(vs[e])})),Object.keys(e.data.leads).forEach((e=>{this.language.addLanguage(vs[e])})),this.changed=!0}removeAnnotation(e){const t=Object.keys(this._annotations);if(delete this._annotations[e.id],this.removeSprite(e),e===this.activeAnnotation){const n=Math.min(t.indexOf(e.id)+1,t.length-1);this.activeAnnotation=n<0?null:this._annotations[t[n]],e.tags.length>0&&this.emit({type:"tag-update"})}this.changed=!0}updateAnnotation(e){this.changed=!0}toJSON(){const e=super.toJSON(),t=this.toData();return t&&(e.data=t),e}fromJSON(e){e.data&&this.fromData(e.data)}toData(){const e=Object.keys(this._annotations);return 0===e.length?null:e.map((e=>this._annotations[e].toJSON()))}fromData(e){e.forEach((e=>this.addAnnotation(new kh(e)))),this.emit({type:"tag-update"})}setXRScale(e){for(const t in this._annotations){const n=this._annotations[t];if("Circle"===n.get("style")){const t=this._sprites[n.id];t&&(t.xrScale=e)}}}handleARStateChange(){for(const e in this._annotations){const t=this._annotations[e];this._sprites[t.id].isAdaptive=!this.arManager.outs.isPresenting.value}}onPointerUp(e){if(e.isDragging)return;let t=e.object3D;for(;t&&!t.isHTMLSprite;)t=t.parent;const n=t&&t.annotation;n&&(this.emit({type:"click",sprite:t,annotation:n}),e.stopPropagation=!0)}onSystemPointerUp(e){e.isDragging||this.emit({type:"click",sprite:null,annotation:null})}onViewportDispose(e){this.object3D.disposeHTMLElements(e.viewport.overlay)}onSpriteClick(e){this.emit(e)}onSpriteLink(e){this.reader&&(this.reader.ins.articleId.setValue(e.annotation.data.articleId),this.reader.ins.enabled.setValue(!0))}createSprite(e){this.removeSprite(e);const t="Circle"===e.data.style,n=t?Ih.createInstance(e,"Circle",this.assetReader):Ih.createInstance(e);n.addEventListener("click",this.onSpriteClick),n.addEventListener("link",this.onSpriteLink),this._sprites[e.id]=n,this.object3D.add(n),this.registerPickableObject3D(n,!0),t&&(n.isWebGL2=this.renderer.views[0].renderer.capabilities.isWebGL2)}removeSprite(e){const t=this._sprites[e.id];t&&(t.removeEventListener("click",this.onSpriteClick),t.removeEventListener("link",this.onSpriteLink),t.dispose(),this._sprites[e.id]=void 0,this.object3D.remove(t),this.unregisterPickableObject3D(t,!0))}updateSprite(e){const t=this._sprites[e.id];t&&t.update()}updateLanguage(){const e=this.ins,t=this._activeAnnotation,n=this.language;this.getAnnotations().forEach((e=>{e.language=n.outs.language.value})),e.activeTags.set();for(const e in this._annotations){const t=this._annotations[e],n=this._sprites[t.id];n&&n.update()}e.title.setValue(t?t.title:"",!0),e.lead.setValue(t?t.lead:"",!0),e.tags.setValue(t?t.tags.join(", "):"")}}Tu.typeName="CVAnnotationView",Tu.ins={unitScale:b("Transform.UnitScale",{preset:1,precision:5}),activeTags:A("Tags.Active"),title:A("Annotation.Title"),lead:A("Annotation.Lead"),marker:A("Annotation.Marker"),tags:A("Annotation.Tags"),style:L("Annotation.Style",Ih.typeNames),scale:M("Annotation.Scale",{preset:1,precision:3}),offset:b("Annotation.Offset",{preset:0,precision:3}),article:L("Annotation.Article",[]),image:A("Annotation.Image"),tilt:b("Annotation.Tilt"),azimuth:b("Annotation.Azimuth"),color:T("Annotation.Color")};const Cu=["Footprint_Court_1k_TMap.jpg","spruit_sunrise_1k_LDR.jpg","campbell_env.jpg"];class Au extends j{constructor(){super(...arguments),this.ins=this.addInputs(Au.envIns),this._texture=null,this._currentIdx=0,this.shouldUseEnvMap=!1}get assetReader(){return this.getMainComponent(Rh)}update(){const e=this.ins,t=this.getGraphComponent(op);return e.dirty.changed&&(this.shouldUseEnvMap=!1,t.models.forEach((t=>{t.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(n.roughnessMap||n.metalnessMap)&&(this.shouldUseEnvMap=!0,null!==this._texture&&(this._texture.dispose(),this._texture=null),e.imageIndex.set())}))}))),e.imageIndex.changed&&this.shouldUseEnvMap&&(e.imageIndex.value==this._currentIdx&&null!==this._texture||(null!==this._texture&&this._texture.dispose(),this.assetReader.getSystemTexture("images/"+Cu[e.imageIndex.value]).then((e=>{t.models.forEach((t=>{t.object3D.traverse((t=>{const n=t.material;"Group"!==t.type&&n&&n.isUberPBRMaterial&&(this._texture=e,this._texture.mapping=q,n.envMap=this._texture,n.needsUpdate=!0)}))}))})),this._currentIdx=e.imageIndex.value)),!0}fromData(e){this.ins.copyValues({imageIndex:e.index})}toData(){return{index:this.ins.imageIndex.cloneValue()}}}var Pu;Au.typeName="CVEnvironment",Au.text="Environment",Au.envIns={imageIndex:x("Environment.Index",{preset:0,options:Cu.map((function(e,t){return t.toString()}))}),dirty:D("Environment.Dirty")},function(e){e[e.none=0]="none",e[e.menu=1]="menu",e[e.title=2]="title",e[e.logo=4]="logo",e[e.language=8]="language"}(Pu||(Pu={}));class Ru extends j{constructor(){super(...arguments),this.ins=this.addInputs(Ru.ins),this.outs=this.addOutputs(Ru.outs)}update(e){return!0}fromData(e){e=e||{},this.ins.setValues({visible:void 0===e.visible||e.visible,logo:void 0===e.logo||e.logo,menu:void 0===e.menu||e.menu,tools:void 0===e.tools||e.tools})}toData(){const e=this.ins;return{visible:e.visible.value,logo:e.logo.value,menu:e.menu.value,tools:e.tools.value}}isShowing(e){return(e&this.ins.visibleElements.value)===e}}Ru.typeName="CVInterface",Ru.ins={visible:C("Interface.Visible",!0),logo:C("Interface.Logo",!0),menu:C("Interface.Menu",!0),tools:C("Interface.Tools",!0),visibleElements:b("Interface.VisibleElements",15)},Ru.outs={documentTitle:A("Document.Title")};class Lu extends j{constructor(){super(...arguments),this._rootElement=null,this.ins=this.addInputs(Lu.ins),this.outs=this.addOutputs(Lu.outs)}get settingProperties(){return[this.ins.annotationsVisible,this.ins.activeTags,this.ins.sortedTags,this.ins.radioTags,this.ins.shader,this.ins.toneMapping,this.ins.exposure,this.ins.gamma]}get snapshotProperties(){return[this.ins.annotationsVisible,this.ins.activeAnnotation,this.ins.activeTags,this.ins.shader,this.ins.exposure]}get analytics(){return this.getMainComponent(Dh)}get renderer(){return this.getMainComponent(Ae)}get rootElement(){return this._rootElement}set rootElement(e){this._rootElement=e}create(){super.create(),this.graph.components.on(Zd,this.onModelComponent,this),this.graph.components.on(Tu,this.onAnnotationsComponent,this),this.graph.components.on(Lh,this.onLanguageComponent,this)}dispose(){this.graph.components.off(Zd,this.onModelComponent,this),this.graph.components.off(Tu,this.onAnnotationsComponent,this),this.graph.components.off(Lh,this.onLanguageComponent,this),super.dispose()}update(e){const t=this.ins;if(t.shader.changed){const e=t.shader.getValidatedValue();this.getGraphComponents(Zd).forEach((t=>t.ins.shader.setValue(e)))}if(t.exposure.changed&&this.renderer.ins.exposure.setValue(t.exposure.value),t.toneMapping.changed){this.renderer.views.forEach((e=>e.renderer.toneMapping=t.toneMapping.value?4:0));const e=this.renderer.activeScene;e&&e.traverse((e=>{const t=e;t.isMesh&&(Array.isArray(t.material)?t.material.forEach((e=>e.needsUpdate=!0)):t.material.needsUpdate=!0)}))}if(t.gamma.changed,t.quality.changed){const e=t.quality.getValidatedValue();this.getGraphComponents(Zd).forEach((t=>t.ins.quality.setValue(e)))}if(t.activeAnnotation.changed){const e=t.activeAnnotation.value;this.getGraphComponents(Tu).forEach((t=>t.setActiveAnnotationById(e)))}if(t.annotationsVisible.changed){const e=t.annotationsVisible.value;this.getGraphComponents(Tu).forEach((t=>t.ins.visible.setValue(e)))}if(t.activeTags.changed){const e=t.activeTags.value;this.getGraphComponents(Tu).forEach((t=>t.ins.activeTags.setValue(e))),this.getGraphComponents(Zd).forEach((t=>t.ins.activeTags.setValue(e)))}return t.sortedTags.changed&&this.refreshTagCloud(),!0}fromData(e){const t=this.ins;t.copyValues({shader:na[e.shader]||na.Default,exposure:void 0!==e.exposure?e.exposure:t.exposure.schema.preset,toneMapping:e.toneMapping||!1,gamma:void 0!==e.gamma?e.gamma:t.gamma.schema.preset,annotationsVisible:!!e.annotationsVisible,activeTags:e.activeTags||"",sortedTags:e.sortedTags||"",radioTags:void 0!==e.radioTags?!!e.radioTags:t.radioTags.schema.preset})}toData(){const e=this.ins,t={shader:na[e.shader.value],exposure:e.exposure.value,toneMapping:e.toneMapping.value,gamma:e.gamma.value};return e.annotationsVisible.value&&(t.annotationsVisible=!0),e.activeTags.value&&(t.activeTags=e.activeTags.value),e.sortedTags.value&&(t.sortedTags=e.sortedTags.value),e.radioTags.value&&(t.radioTags=e.radioTags.value),t}refreshTagCloud(){const e=new Set;this.getGraphComponents(Zd).forEach((t=>{t.ins.tags.value.split(",").map((e=>e.trim())).filter((e=>e)).forEach((t=>e.add(t)))}));const t=this.getGraphComponents(Tu),n=this.outs.tagCloud.value.split(",").map((e=>e.trim())).filter((e=>e));t.forEach((t=>{t.getAnnotations().forEach((t=>{t.tags.forEach((t=>{n.includes(t)||this.ins.activeTags.setValue(this.ins.activeTags.value+", "+t),e.add(t)}))}))}));const i=Array.from(e),s=this.ins.sortedTags.value.split(",").map((e=>e.trim())).filter((e=>e));i.sort(((e,t)=>{const n=s.indexOf(e),i=s.indexOf(t);return ni?1:0})),this.outs.tagCloud.setValue(i.join(", ")),this.ins.activeTags.set(),this.ins.annotationsVisible.set()}onAnnotationClick(e){const t=e.annotation?e.annotation.id:"";this.ins.activeAnnotation.setValue(t),this.rootElement.dispatchEvent(new CustomEvent("annotation-active",{detail:t}))}onModelComponent(e){const t=e.object;e.add?(t.on("tag-update",this.refreshTagCloud,this),t.on("model-load",this.onModelLoad,this)):e.remove&&(t.off("tag-update",this.refreshTagCloud,this),t.off("model-load",this.onModelLoad,this))}onAnnotationsComponent(e){const t=e.object;e.add?(t.on("tag-update",this.refreshTagCloud,this),t.on("click",this.onAnnotationClick,this),t.ins.visible.setValue(this.ins.annotationsVisible.value)):e.remove&&(t.off("tag-update",this.refreshTagCloud,this),t.off("click",this.onAnnotationClick,this))}onLanguageComponent(e){const t=e.object;e.add?t.on("tag-update",this.refreshTagCloud,this):e.remove&&t.off("tag-update",this.refreshTagCloud,this)}onModelLoad(e){this.rootElement.dispatchEvent(new CustomEvent("model-load",{detail:Wo[e.quality]}))}}Lu.typeName="CVViewer",Lu.text="Viewer",Lu.icon="",Lu.ins={annotationsVisible:C("Annotations.Visible"),activeAnnotation:A("Annotations.ActiveId"),activeTags:A("Tags.Active"),sortedTags:A("Tags.Sorted"),radioTags:C("Tags.Radio"),shader:R("Renderer.Shader",na),toneMapping:C("Renderer.ToneMapping",!1),exposure:b("Renderer.Exposure",1),gamma:b("Renderer.Gamma",2),quality:R("Models.Quality",Wo,Wo.High)},Lu.outs={tagCloud:A("Tags.Cloud")};const Nu=new Ln,Du=(new Ln,new Ve),Ou=new Ve,Iu=new je,ku=new Ze,zu=new Ue,Uu={PI:3.141592653589793,DOUBLE_PI:6.283185307179586,HALF_PI:1.5707963267948966,QUARTER_PI:.7853981633974483,DEG2RAD:.017453292519943295,RAD2DEG:57.29577951308232,composeOrbitMatrix:function(e,t,n){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z,c=Math.sin(i),h=Math.cos(i),u=Math.sin(s),d=Math.cos(s),p=Math.sin(r),m=Math.cos(r),f=d*m,g=m*u*c-p*h,v=m*u*h+p*c,y=d*p,b=c*u*p+m*h,x=p*u*h-m*c,_=-u,w=d*c,S=d*h,M=(n=n||new je).elements;return M[0]=f,M[1]=y,M[2]=_,M[3]=0,M[4]=g,M[5]=b,M[6]=w,M[7]=0,M[8]=v,M[9]=x,M[10]=S,M[11]=0,M[12]=o*f+a*g+l*v,M[13]=o*y+a*b+l*x,M[14]=o*_+a*w+l*S,M[15]=1,n},decomposeOrbitMatrix:function(e,t,n){ku.setFromRotationMatrix(e,"ZYX"),ku.toVector3(t),Iu.copy(e).invert(),Nu.set(0,0,0,1),Nu.applyMatrix4(Iu),n.x=-Nu.x,n.y=-Nu.y,n.z=-Nu.z},isMatrix4Identity:function(e){const t=e.elements;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]},decomposeTransformMatrix:function(e,t,n,i){Iu.fromArray(e),Iu.decompose(Du,zu,Ou),ku.setFromQuaternion(zu,"XYZ"),Du.toArray(t),Ou.toArray(i),ku.toVector3(Du),Nu.multiplyScalar(vt.RAD2DEG),Du.toArray(n)}},Vu=new je,Fu=new Lt,Bu=new Ve,ju=new Ve;var $u,Hu,Gu;!function(e){e[e.Orbit=0]="Orbit",e[e.FirstPerson=1]="FirstPerson"}($u||($u={})),function(e){e[e.Off=0]="Off",e[e.Pan=1]="Pan",e[e.Orbit=2]="Orbit",e[e.Dolly=3]="Dolly",e[e.Zoom=4]="Zoom",e[e.PanDolly=5]="PanDolly",e[e.Roll=6]="Roll"}(Hu||(Hu={})),function(e){e[e.Off=0]="Off",e[e.Active=1]="Active",e[e.Release=2]="Release"}(Gu||(Gu={}));class Wu{constructor(e){this.orbit=new Ve(0,0,0),this.offset=new Ve(0,0,50),this.minOrbit=new Ve(-90,-1/0,-1/0),this.maxOrbit=new Ve(90,1/0,1/0),this.minOffset=new Ve(-1/0,-1/0,.1),this.maxOffset=new Ve(1/0,1/0,1e3),this.orientationEnabled=!0,this.offsetEnabled=!0,this.mode=Hu.Off,this.phase=Gu.Off,this.prevPinchDist=0,this.deltaX=0,this.deltaY=0,this.deltaPinch=0,this.deltaWheel=0,this.viewportWidth=100,this.viewportHeight=100,this.camera=e}onPointer(e){if(e.isPrimary)if("pointer-down"===e.type)this.phase=Gu.Active;else if("pointer-up"===e.type)return this.phase=Gu.Release,!0;"pointer-down"===e.type&&(this.mode=this.getModeFromEvent(e));if(this.deltaX+=1*e.movementX,this.deltaY+=1*e.movementY,2===e.pointerCount){const t=e.activePositions,n=t[1].clientX-t[0].clientX,i=t[1].clientY-t[0].clientY,s=Math.sqrt(n*n+i*i),r=this.prevPinchDist||s;this.deltaPinch*=r>0?s/r:1,this.prevPinchDist=s}else this.deltaPinch=1,this.prevPinchDist=0;return!0}onTrigger(e){return"wheel"===e.type&&(this.deltaWheel+=vt.limit(e.wheel,-1,1),!0)}setViewportSize(e,t){this.viewportWidth=e,this.viewportHeight=t}updateController(e,t){const n=this.camera;e=e||n;const i=this.orbit,s=this.offset;Uu.decomposeOrbitMatrix(e.matrix,i,s),this.orbit.multiplyScalar(Uu.RAD2DEG),t&&(this.minOffset.min(s),this.maxOffset.max(s))}zoomExtents(e){const t=this.camera,n=this.offset;if(!t)return void console.warn("CameraController.zoomExtents - camera not set");Bu.copy(this.orbit).multiplyScalar(vt.DEG2RAD),ju.setScalar(0),Uu.composeOrbitMatrix(Bu,ju,Vu),Fu.copy(e).applyMatrix4(Vu.transpose()),Fu.getSize(Bu),Fu.getCenter(ju),n.x=ju.x,n.y=ju.y;const i=Math.max(Bu.x/t.aspect,Bu.y);if(t.isOrthographicCamera)n.z=1.1*i;else{const e=1/(2*Math.tan(t.fov*vt.DEG2RAD*.5));n.z=ju.z+i*e+.25*Bu.z}n.z>this.maxOffset.z&&(this.maxOffset.z=2*n.length())}updateCamera(e,t){const n=this.camera;return e=e||n,!(!this.update()&&!t)&&(Bu.copy(this.orbit).multiplyScalar(vt.DEG2RAD),ju.copy(this.offset),n.isOrthographicCamera&&(ju.z=this.maxOffset.z,n.size=this.offset.z,n.far=2*this.maxOffset.z,n.updateProjectionMatrix()),Uu.composeOrbitMatrix(Bu,ju,e.matrix),e.matrixWorldNeedsUpdate=!0,!0)}update(){if(this.phase===Gu.Off&&0===this.deltaWheel)return!1;if(0!==this.deltaWheel)return this.updatePose(0,0,.07*this.deltaWheel+1,0,0,0),this.deltaWheel=0,!0;if(this.phase===Gu.Active)return(0!==this.deltaX||0!==this.deltaY||1!==this.deltaPinch)&&(this.updateByMode(),this.deltaX=0,this.deltaY=0,this.deltaPinch=1,!0);if(this.phase===Gu.Release){this.deltaX*=.85,this.deltaY*=.85,this.deltaPinch=1,this.updateByMode();return Math.abs(this.deltaX)+Math.abs(this.deltaY)<.1&&(this.mode=Hu.Off,this.phase=Gu.Off),!0}return!1}updateByMode(){switch(this.mode){case Hu.Orbit:this.updatePose(0,0,1,this.deltaY,this.deltaX,0);break;case Hu.Pan:this.updatePose(this.deltaX,this.deltaY,1,0,0,0);break;case Hu.Roll:this.updatePose(0,0,1,0,0,this.deltaX);break;case Hu.Dolly:this.updatePose(0,0,.0075*this.deltaY+1,0,0,0);break;case Hu.PanDolly:const e=.42*(this.deltaPinch-1)+1;this.updatePose(.75*this.deltaX,.75*this.deltaY,1/e,0,0,0)}}updatePose(e,t,n,i,s,r){const{orbit:o,minOrbit:a,maxOrbit:l,offset:c,minOffset:h,maxOffset:u}=this;if(this.orientationEnabled&&(o.x+=-1*i*220/this.viewportHeight,o.y+=-1*s*220/this.viewportHeight,o.z+=-1*r*220/this.viewportHeight,o.x=vt.limit(o.x,a.x,l.x),o.y=vt.limit(o.y,a.y,l.y),o.z=vt.limit(o.z,a.z,l.z)),this.offsetEnabled){const i=c.z=n*c.z;c.x+=e*i*-1/this.viewportHeight,c.y-=t*i*-1/this.viewportHeight,c.x=vt.limit(c.x,h.x,u.x),c.y=vt.limit(c.y,h.y,u.y),c.z=vt.limit(c.z,h.z,u.z)}}getModeFromEvent(e){if("mouse"===e.source){const t=e.originalEvent.button;if(0===t)return e.ctrlKey?Hu.Pan:e.altKey?Hu.Dolly:Hu.Orbit;if(2===t)return e.altKey?Hu.Roll:Hu.Pan;if(1===t)return Hu.Dolly}else if("touch"===e.source){const t=e.pointerCount;return 1===t?Hu.Orbit:2===t?Hu.PanDolly:Hu.Pan}}}const qu=.5*Math.PI,Xu=new Lt,Yu=new Ve,Ku=new Ve,Ju=new Ve,Zu=new je,Qu=(new je,[new Ve(0,-qu,0),new Ve(0,qu,0),new Ve(-qu,0,0),new Ve(qu,0,0),new Ve(0,0,0),new Ve(0,Math.PI,0)]);var ed,td,nd;!function(e){e[e.Perspective=0]="Perspective",e[e.Orthographic=1]="Orthographic"}(ed||(ed={})),function(e){e[e.None=-1]="None",e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Top=2]="Top",e[e.Bottom=3]="Bottom",e[e.Front=4]="Front",e[e.Back=5]="Back"}(td||(td={}));class id extends tl{constructor(e){super(),this.isUniversalCamera=!0,this.fov=50,this.size=20,this.aspect=1,this.distance=20,this.zoom=1,this.near=.1,this.far=2e3,this.focus=10,this.filmGauge=35,this.filmOffset=0,this.view=null,this.setProjection(e)}setProjection(e){e===ed.Orthographic?(this.type="OrthographicCamera",this.isPerspectiveCamera=!1,this.isOrthographicCamera=!0):(this.type="PerspectiveCamera",this.isPerspectiveCamera=!0,this.isOrthographicCamera=!1),this.updateProjectionMatrix()}getProjection(){return this.isOrthographicCamera?ed.Orthographic:ed.Perspective}setPreset(e){e!==td.None?(this.rotation.setFromVector3(Qu[e],"XYZ"),this.position.set(0,0,this.distance).applyQuaternion(this.quaternion)):(this.rotation.set(0,0,0),this.position.set(0,0,0)),this.updateMatrix()}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Le*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Re*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Le*Math.atan(Math.tan(.5*Re*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,r){this.isPerspectiveCamera?rl.prototype.setViewOffset.call(this,e,t,n,i,s,r):nl.prototype.setViewOffset.call(this,e,t,n,i,s,r)}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}zoomToView(){}moveToView(e){this.updateMatrixWorld(!1),Xu.copy(e),Zu.extractRotation(this.matrixWorldInverse),Xu.applyMatrix4(Zu),Xu.getSize(Yu),Xu.getCenter(Ku);const t=Math.max(Yu.x/this.aspect,Yu.y);Ju.set(-Ku.x,-Ku.y,0),this.isPerspectiveCamera?Ju.z=Yu.z/(2*Math.tan(this.fov*vt.DEG2RAD*.5)):(this.size=.5*t,Ju.z=2*Yu.z,this.far=Math.max(this.far,2*Ju.z)),Zu.extractRotation(this.matrixWorld),Ju.applyMatrix4(Zu),this.matrix.decompose(this.position,this.quaternion,this.scale),this.position.copy(Ju),this.updateMatrix()}updateProjectionMatrix(){const e=this.near,t=this.far,n=this.aspect,i=this.zoom,s=this.view;if(this.isOrthographicCamera){const r=this.size,o=r/(2*i),a=o*n;let l=-a,c=a,h=o,u=-o;if(s&&s.enabled){const e=i/(s.width/s.fullWidth),t=i/(s.height/s.fullHeight),o=r*n/s.width,a=r/s.height;l+=o*(s.offsetX/e),c=l+o*(s.width/e),h-=a*(s.offsetY/t),u=h-a*(s.height/t)}this.projectionMatrix.makeOrthographic(l,c,h,u,e,t)}else{let o=e*Math.tan(.5*Re*this.fov)/i,a=2*o,l=n*a,c=-.5*l;s&&s.enabled&&(c+=s.offsetX*l/s.fullWidth,o-=s.offsetY*a/s.fullHeight,l*=s.width/s.fullWidth,a*=s.height/s.fullHeight);var r=this.filmOffset;0!==r&&(c+=e*r/this.getFilmWidth()),this.projectionMatrix.makePerspective(c,c+l,o,o-a,e,t)}this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}copy(e,t){return super.copy(e,t),this.type=e.type,this.isOrthographicCamera=e.isOrthographicCamera,this.isPerspectiveCamera=e.isPerspectiveCamera,this.fov=e.fov,this.size=e.size,this.aspect=e.aspect,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.view=e.view?Object.assign({},e.view):null,this}clone(){return(new this.constructor).copy(this)}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.size=this.size,t.object.aspect=this.aspect,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}!function(e){e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Top=2]="Top",e[e.Bottom=3]="Bottom",e[e.Front=4]="Front",e[e.Back=5]="Back",e[e.None=6]="None"}(nd||(nd={}));const sd=[];sd[nd.Left]=[0,-90,0],sd[nd.Right]=[0,90,0],sd[nd.Front]=[0,0,0],sd[nd.Back]=[0,180,0],sd[nd.Top]=[-90,0,0],sd[nd.Bottom]=[90,0,0];const rd=function(e,t){for(let n=0,i=e.length;ne.outs.updated.changed))&&e.update(null),this._modelBoundingBox=e.outs.boundingBox.value,t.zoomExtents(this._modelBoundingBox),n.ins.zoom.set()}return!0}tick(){const e=this.ins,t=this._scene.activeCameraComponent;if(!e.enabled.value||!t)return;const n=this._controller;n.camera=t.camera;const i=t.transform,s=this.changed;return!!n.updateCamera(i.object3D,s)&&(n.orbit.toArray(e.orbit.value),e.orbit.set(!0),n.offset.toArray(e.offset.value),e.offset.set(!0),e.preset.value===nd.None||e.preset.changed||e.preset.setValue(nd.None,!0),i?i.setPropertiesFromMatrix():t.setPropertiesFromMatrix(),!0)}preRender(e){this._modelBoundingBox&&e.viewport.zoomExtents(this._modelBoundingBox)}setChanged(e){this._hasChanged=e}tock(){return this._modelBoundingBox=null,!1}fromData(e){const t=(e=e||{}).orbit||{orbit:[-25,-25,0],offset:[0,0,100],minOrbit:[-90,-1/0,-1/0],minOffset:[-1/0,-1/0,.1],maxOrbit:[90,1/0,1/0],maxOffset:[1/0,1/0,1/0]};this.ins.copyValues({enabled:!!e.enabled,autoZoom:!!e.autoZoom,autoRotation:!!e.autoRotation,lightsFollowCamera:!!e.lightsFollowCamera,orbit:t.orbit,offset:t.offset,minOrbit:rd(t.minOrbit,-1/0),maxOrbit:rd(t.maxOrbit,1/0),minOffset:rd(t.minOffset,-1/0),maxOffset:rd(t.maxOffset,1/0)})}toData(){const e=this.ins,t={};return t.enabled=e.enabled.value,t.autoZoom=e.autoZoom.value,t.autoRotation=e.autoRotation.value,t.lightsFollowCamera=e.lightsFollowCamera.value,t.type="Orbit",t.orbit={orbit:e.orbit.cloneValue(),offset:e.offset.cloneValue(),minOrbit:e.minOrbit.cloneValue(),maxOrbit:e.maxOrbit.cloneValue(),minOffset:e.minOffset.cloneValue(),maxOffset:e.maxOffset.cloneValue()},t}getLightTransform(){const e=this.graph.findNodeByName("Lights");return e&&e.getComponent(Rt,!0)}onPointer(e){const t=e.viewport;t.camera||(this.ins.enabled.value&&this._scene.activeCameraComponent&&(this._controller.setViewportSize(t.width,t.height),this._controller.onPointer(e),e.stopPropagation=!0),this._hasChanged=!0)}onTrigger(e){const t=e.viewport;t.camera||(this.ins.enabled.value&&this._scene.activeCameraComponent&&(this._controller.setViewportSize(t.width,t.height),this._controller.onTrigger(e),e.stopPropagation=!0),this._hasChanged=!0)}onLoadingCompleted(e){this.ins.autoZoom.value&&!this._hasChanged&&this.ins.zoomExtents.set()}}var ad;od.typeName="CVOrbitNavigation",od.text="Orbit Navigation",od.icon="",od.ins={enabled:C("Settings.Enabled",!0),pointerEnabled:C("Settings.PointerEnabled",!0),preset:R("Camera.ViewPreset",nd,nd.None),projection:R("Camera.Projection",ed,ed.Perspective),lightsFollowCamera:C("Navigation.LightsFollowCam",!0),autoRotation:C("Navigation.AutoRotation",!1),zoomExtents:D("Settings.ZoomExtents"),autoZoom:C("Settings.AutoZoom",!0),orbit:w("Current.Orbit",[-25,-25,0]),offset:w("Current.Offset",[0,0,100]),minOrbit:w("Limits.Min.Orbit",[-90,-1/0,-1/0]),minOffset:w("Limits.Min.Offset",[-1/0,-1/0,.1]),maxOrbit:w("Limits.Max.Orbit",[90,1/0,1/0]),maxOffset:w("Limits.Max.Offset",[1/0,1/0,1/0])},function(e){e[e.Solid=0]="Solid",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient"}(ad||(ad={}));class ld extends ui{constructor(){super(new cd,new hd),this.frustumCulled=!1,this.renderOrder=-1/0,this.matrixAutoUpdate=!1}dispose(){this.geometry.dispose(),this.material.dispose()}updateMatrixWorld(e){}}class cd extends qn{constructor(){super();const e=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),t=new yl(e,5);this.setIndex([0,1,2,0,2,3]),this.setAttribute("position",new xl(t,3,0,!1)),this.setAttribute("uv",new xl(t,2,3,!1))}}class hd extends uu{constructor(){super(...arguments),this.depthTest=!1,this.depthWrite=!1,this.transparent=!1,this.uniforms={style:{value:ad.LinearGradient},color0:{value:new Ve(.15,.2,.25)},color1:{value:new Ve(0,0,0)},noise:{value:.02}},this.vertexShader=["precision highp float;","attribute vec3 position;","attribute vec2 uv;","varying vec2 ndc;","void main() {"," ndc = position.xy;"," gl_Position = vec4(position, 1.0);","}"].join("\n"),this.fragmentShader=["precision highp float;","uniform vec3 color0;","uniform vec3 color1;","uniform float noise;","uniform int style;","varying vec2 ndc;","float rand(vec2 co) {","float dt = dot(co.xy ,vec2(12.9898, 78.233));","float sn = mod(dt, 3.14);","return fract(sin(sn) * 43758.5453);","}","void main() {"," float f = style == 0 ? 0.0 : (style == 1 ? ndc.y * 0.5 + 0.5 : length(ndc) * 0.707);"," gl_FragColor = vec4(mix(color0, color1, f) + noise * rand(ndc), 1.0);","}"].join("\n")}set style(e){this.uniforms.style.value=e}get style(){return this.uniforms.style.value}set color0(e){if(e instanceof Pn){const t=this.uniforms.color0.value;t.x=e.r,t.y=e.g,t.z=e.b}else this.uniforms.color0.value.copy(e)}get color0(){return this.uniforms.color0.value}set color1(e){if(e instanceof Pn){const t=this.uniforms.color1.value;t.x=e.r,t.y=e.g,t.z=e.b}else this.uniforms.color1.value.copy(e)}get color1(){return this.uniforms.color1.value}set noise(e){this.uniforms.noise.value=e}get noise(){return this.uniforms.noise.value}}class ud extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(ud.backgroundIns),this.object3D=new ld}get background(){return this.object3D}update(e){super.update(e);const t=this.ins,n=this.background.material;return t.style.changed&&(n.style=t.style.getValidatedValue()),t.color0.changed&&n.color0.fromArray(t.color0.value),t.color1.changed&&n.color1.fromArray(t.color1.value),t.noise.changed&&(n.noise=t.noise.value),!0}dispose(){this.background.dispose(),super.dispose()}}ud.typeName="CBackground",ud.backgroundIns={style:R("Background.Style",ad,ad.RadialGradient),color0:T("Background.Color0",[.2,.25,.3]),color1:T("Background.Color1",[.01,.03,.05]),noise:b("Background.Noise",{min:0,max:1,bar:!0,preset:.02})};class dd extends ud{constructor(e,t){super(e,t),this.background.layers.set(1)}get settingProperties(){return[this.ins.style,this.ins.color0,this.ins.color1]}get snapshotProperties(){return[this.ins.color0,this.ins.color1]}hide(){this.background.visible=!1}show(){this.background.visible=!0}fromData(e){this.ins.copyValues({style:ad[e.style]||ad.Solid,color0:e.color0||[.2,.25,.3],color1:e.color1||[.01,.03,.05]})}toData(){const e=this.ins;return{style:ad[e.style.value],color0:e.color0.cloneValue(),color1:e.color1.cloneValue()}}}dd.typeName="CVBackground";const pd=n(3523).Z,md=n(2001).Z;class fd extends ui{constructor(){super(new pi(2,2,1,1),new gd),this.geometry.rotateX(-90*Re),this.receiveShadow=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class gd extends uh{constructor(e){super(e),this.defines={},this.type="FloorMaterial",this.isMeshPhongMaterial=!0,this.isFloorMaterial=!0,this.defines={},this.uniforms=xo.merge([ta.phong.uniforms]),this.vertexShader=md,this.fragmentShader=pd,this.transparent=!0,this.shininess=0}}class vd extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(vd.floorIns),this.object3D=new fd}get floor(){return this.object3D}update(e){super.update(e);const t=this.ins,n=this.floor;return(t.position.changed||t.radius.changed)&&(n.position.fromArray(t.position.value),n.scale.setScalar(t.radius.value),n.updateMatrix()),t.color.changed&&n.material.color.fromArray(t.color.value),t.opacity.changed&&(n.material.opacity=t.opacity.value),!0}dispose(){this.floor.dispose(),super.dispose()}}vd.typeName="CFloor",vd.floorIns={position:w("Floor.Position",[0,-25,0]),radius:b("Floor.Radius",50),color:T("Floor.Color",[.6,.75,.8]),opacity:_("Floor.Opacity",.5),castShadow:C("Shadow.Cast"),receiveShadow:C("Shadow.Receive")};const yd=new Ve;class bd extends vd{constructor(e,t){super(e,t),this.addIns=this.addInputs(bd.floorAddIns),this.ins.visible.setValue(!1),this.ins.receiveShadow.setValue(!0),this.floor.renderOrder=-1}get settingProperties(){return[this.ins.visible,this.ins.position,this.ins.radius,this.ins.color,this.ins.opacity,this.ins.receiveShadow,this.addIns.autoSize]}get snapshotProperties(){return[this.ins.opacity]}get sceneNode(){return this.getSystemComponent(op)}create(){super.create(),this.sceneNode.outs.boundingBox.on("value",this.recalculateSize,this)}dispose(){this.sceneNode.outs.boundingBox.off("value",this.recalculateSize,this),super.dispose()}update(e){const t=this.addIns;return t.autoSize.changed&&t.autoSize.value&&this.recalculateSize(),super.update(e),!0}recalculateSize(){const{addIns:e}=this;if(e.autoSize.value){const e=this.sceneNode.outs.boundingBox.value;e.getSize(yd);const t=Math.max(yd.x,yd.y,yd.z),{min:n,max:i}=e;this.ins.radius.setValue(t),this.ins.position.setValue([(n.x+i.x)/2,n.y,(n.z+i.z)/2])}}fromData(e){e=e||{},this.ins.copyValues({visible:!!e.visible,position:e.position||[0,-25,0],radius:void 0!==e.size?e.size:50,color:e.color||[.6,.75,.8],opacity:void 0!==e.opacity?e.opacity:.5,receiveShadow:!!e.receiveShadow})}toData(){const e=this.ins;return{visible:e.visible.value,position:e.position.cloneValue(),size:e.radius.value,color:e.color.cloneValue(),opacity:e.opacity.value,receiveShadow:e.receiveShadow.value}}}bd.typeName="CVFloor",bd.text="Floor",bd.icon="",bd.floorAddIns={autoSize:C("Floor.AutoSize",!0)};class xd extends Is{constructor(e){super(xd.generate(e),new Ts({color:4294967295,vertexColors:!0}))}set opacity(e){this.material.opacity=e,this.material.transparent=e<1}update(e){this.geometry&&this.geometry.dispose(),this.geometry=xd.generate(e)}static generate(e){const t=new Pn(e.mainColor),n=new Pn(e.subColor),i=e.mainDivisions*e.subDivisions,s=e.size/i,r=.5*e.size,o=[],a=[];for(let l=0,c=0,h=-r;l<=i;++l,h+=s){o.push(-r,0,h,r,0,h),o.push(h,0,-r,h,0,r);const i=l%e.subDivisions==0?t:n;i.toArray(a,c),c+=3,i.toArray(a,c),c+=3,i.toArray(a,c),c+=3,i.toArray(a,c),c+=3}const l=new qn;return l.setAttribute("position",new zn(o,3)),l.setAttribute("color",new zn(a,3)),l}}const _d=new Ve,wd=new Ve,Sd=(new je).makeRotationX(.5*Math.PI),Md=new je;class Ed extends zo{constructor(){super(...arguments),this.ins=this.addInputs(Ed.gridIns),this.outs=this.addOutputs(Ed.gridOuts),this._lastViewport=null,this._gridProps={size:20,mainDivisions:2,subDivisions:10,mainColor:new Pn(.5,.7,.8),subColor:new Pn(.25,.35,.4)}}get settingProperties(){return[this.ins.visible,this.ins.color,this.ins.opacity]}get snapshotProperties(){return[this.ins.opacity]}get grid(){return this.object3D}create(){this.ins.pickable.setValue(!1),this.ins.visible.setValue(!1),super.create()}activate(){this.getGraphComponent(op).outs.boundingBox.linkTo(this.ins.boundingBox)}update(){const e=this.ins;if(e.color.changed||e.boundingBox.changed){const t=this._gridProps;if(e.color.changed){const n=t.mainColor,i=t.subColor;n.fromArray(e.color.value),i.r=.5*n.r,i.g=.5*n.g,i.b=.5*n.b}if(e.boundingBox.changed){const e=this.getGraphComponent(op),n=e.outs.boundingBox.value,i=e.ins.units.value;n.getSize(_d);let s=Math.max(_d.x,_d.y,_d.z),r=1;for(;s/r>5;)r*=10;s=Math.ceil(s/r)*r*2,t.size=s,this.outs.size.setValue(s),this.outs.units.setValue(i),t.mainDivisions=s/r,t.subDivisions=10,wd.set(0,n.min.y,0)}this.object3D?this.grid.update(t):this.object3D=new xd(t),e.boundingBox.changed&&(this.grid.position.copy(wd),this.grid.updateMatrix())}return e.visible.changed&&(this.grid.visible=e.visible.value),e.opacity.changed&&(this.grid.opacity=e.opacity.value),!0}preRender(e){const t=e.viewport,n=this.object3D;if(t!==this._lastViewport){this._lastViewport=t;const i=e.viewport.camera;i?n.matrix.extractRotation(i.matrixWorld).multiply(Sd):n.matrix.extractRotation(Md),n.updateMatrixWorld(!0)}}postRender(e){this.object3D.matrix.extractRotation(Md)}fromData(e){e=e||{},this.ins.copyValues({visible:!!e.visible,color:e.color||[.5,.7,.8]})}toData(){const e=this.ins;return{visible:e.visible.cloneValue(),color:e.color.cloneValue()}}}Ed.typeName="CVGrid",Ed.text="Grid",Ed.icon="",Ed.gridIns={color:T("Grid.Color",[.5,.7,.8]),opacity:_("Grid.Opacity",1),boundingBox:N("Scene.BoundingBox",Lt)},Ed.gridOuts={size:b("Size"),units:R("Units",gs)};class Td extends qn{constructor(e=[new sn(0,.5),new sn(.5,0),new sn(0,-.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=De(i,0,2*Math.PI);const s=[],r=[],o=[],a=[],l=[],c=1/t,h=new Ve,u=new sn,d=new Ve,p=new Ve,m=new Ve;let f=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case e.length-1:a.push(m.x,m.y,m.z);break;default:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),a.push(d.x,d.y,d.z),m.copy(p)}for(let s=0;s<=t;s++){const d=n+s*c*i,p=Math.sin(d),m=Math.cos(d);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*m,r.push(h.x,h.y,h.z),u.x=s/t,u.y=n/(e.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*m;l.push(i,c,d)}}for(let n=0;n{e.object3D.traverse((e=>{if(e.isMesh){const t=e.material;t.isUberPBRMaterial&&this.updateMaterial(t)}}))})),!0}fromData(e){e=e||{},this.ins.setValues({enabled:e.enabled||!1,axis:oa[e.axis]||oa.X,position:e.position||0,inverted:e.inverted||!1})}toData(){const e=this.ins;return{enabled:e.enabled.value,axis:oa[e.axis.getValidatedValue()],position:e.position.value,inverted:e.inverted.value}}updateMaterial(e){const t=this.ins;t.enabled.changed&&(e.enableCutPlane(t.enabled.value),e.needsUpdate=!0),e.cutPlaneDirection.fromArray(this.plane),e.cutPlaneColor.fromArray(t.color.value)}}Id.typeName="CVSlicer",Id.text="Slicer",Id.icon="",Id.ins={enabled:C("Slice.Enabled"),axis:R("Slice.Axis",oa),position:b("Slice.Position",{min:0,max:1,preset:.5}),inverted:C("Slice.Inverted"),color:T("Slice.Color",[0,.61,.87]),boundingBox:N("Scene.BoundingBox",Lt)};const kd=Math.PI,zd=.5*kd;var Ud;!function(e){e[e.Linear=0]="Linear",e[e.EaseQuad=1]="EaseQuad",e[e.EaseInQuad=2]="EaseInQuad",e[e.EaseOutQuad=3]="EaseOutQuad",e[e.EaseCubic=4]="EaseCubic",e[e.EaseInCubic=5]="EaseInCubic",e[e.EaseOutCubic=6]="EaseOutCubic",e[e.EaseQuart=7]="EaseQuart",e[e.EaseInQuart=8]="EaseInQuart",e[e.EaseOutQuart=9]="EaseOutQuart",e[e.EaseQuint=10]="EaseQuint",e[e.EaseInQuint=11]="EaseInQuint",e[e.EaseOutQuint=12]="EaseOutQuint",e[e.EaseSine=13]="EaseSine",e[e.EaseInSine=14]="EaseInSine",e[e.EaseOutSine=15]="EaseOutSine"}(Ud||(Ud={}));const Vd={Linear:function(e){return e},EaseQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},EaseInQuad:function(e){return e*e},EaseOutQuad:function(e){return e*(2-e)},EaseCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},EaseInCubic:function(e){return e*e*e},EaseOutCubic:function(e){return--e*e*e+1},EaseQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},EaseInQuart:function(e){return e*e*e*e},EaseOutQuart:function(e){return 1- --e*e*e*e},EaseQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},EaseInQuint:function(e){return e*e*e*e*e},EaseOutQuint:function(e){return 1+--e*e*e*e*e},EaseSine:function(e){return-.5*(Math.cos(e*kd)-1)},EaseInSine:function(e){return 1-Math.cos(e*zd)},EaseOutSine:function(e){return Math.sin(e*zd)}};class Fd extends j{constructor(){super(...arguments),this.ins=this.addInputs(Fd.ins),this.outs=this.addOutputs(Fd.outs),this.targets=[],this.states={},this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null}getState(e){return this.states[e]}setState(e){return e.id=e.id||I(6),this.states[e.id]=e,e.id}deleteState(e){delete this.states[e]}clear(){this.targets.forEach((e=>e.property.off("dispose",this.onPropertyDispose,this))),this.targets.length=0,this.states={},this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null}dispose(){this.clear(),super.dispose()}tweenTo(e,t){const n=this.states[e],i=this.outs;if(n)return this._targetState=n,this._currentValues=this.getCurrentValues(),this._startTime=t,this._easingFunction=(s=n.curve,Vd[Ud[s]]),i.switched.setValue(!1),i.tweening.setValue(!0),i.start.set(),!0;var s}update(e){const t=this.ins,n=this.states,i=t.id.value,s=n[i];if(s){if((t.tween.changed||t.recall.changed)&&(t.curve.setValue(s.curve),t.duration.setValue(s.duration),t.threshold.setValue(s.threshold)),t.tween.changed)return this.tweenTo(i,e.secondsElapsed),!0;if(t.recall.changed)return this.setValues(s.values),!0;(t.curve.changed||t.duration.changed||t.threshold.changed)&&(s.curve=t.curve.value,s.duration=t.duration.value,s.threshold=t.threshold.value),t.store.changed&&(s.values=this.getCurrentValues()),t.delete.changed&&delete n[i]}else if(i&&t.store.changed){const e={id:this.ins.id.value,curve:this.ins.curve.getValidatedValue(),duration:this.ins.duration.value,threshold:this.ins.threshold.value,values:this.getCurrentValues()};n[e.id]=e}return!0}tick(e){const t=this._targetState;if(!t)return!1;const n=this.outs,i=this._currentValues,s=this._startTime,r=e.secondsElapsed-s,o=r/t.duration;if(o<1){const e=this._easingFunction(o),s=o>=t.threshold&&!n.switched.value;this.setValues(i,t.values,e,s),n.time.setValue(r),n.completed.setValue(o),s&&(n.switched.setValue(!0),n.switch.set())}else this.setValues(i,t.values,1,!n.switched.value),n.tweening.setValue(!1),n.time.setValue(t.duration),n.completed.setValue(1),n.end.set(),n.switched.value||n.switched.setValue(!0),this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null;return!0}addTargetProperty(e){if("object"===e.type||e.schema.event)throw new Error("can't add object or event properties");if(this.getTarget(e))throw new Error("can't add, target already exists");e.on("dispose",this.onPropertyDispose,this);const t="number"===e.type&&!e.schema.options,n=e.isArray();this.targets.push({property:e,isNumber:t,isArray:n});const i=this.states,s=Object.keys(i);for(let t=0,n=s.length;t{const t=this.getProperty(e.id,e.key);return{property:t,isNumber:!!t&&"number"===t.type&&!t.schema.options,isArray:!!t&&t.isArray()}}))),e.states&&e.states.forEach((e=>this.states[e.id]=e)),this._startTime=0}toJSON(){const e=super.toJSON(),t=this.stateToJSON();return t&&(e.state=t),e}stateToJSON(){const e={},t=this.targets;t.length>0&&(e.targets=t.map((e=>({id:e.property.group.linkable.id,key:e.property.key}))));const n=Object.keys(this.states);return n.length>0&&(e.states=n.map((e=>this.states[e]))),e}getTargetProperties(){return this.targets.map((e=>e.property))}onPropertyDispose(e){e.property.off("dispose",this.onPropertyDispose,this);const t=this.getTarget(e.property);this.removeTarget(t)}removeTarget(e){const t=this.targets.indexOf(e);this.targets.splice(t,1),this.removeChannel(t)}removeChannel(e){const t=this.states,n=Object.keys(t);for(let i=0,s=n.length;it.property===e))}getProperty(e,t){const n=this.system.components.getById(e);return n?n.ins[t]:null}setValues(e,t,n,i){const s=this.targets;for(let r=0,o=s.length;r{this.targetFeatures[e]=!1})),this.targetFeatures.models=!1,this.targetFeatures.lights=!1,this.initializeTargetFeatures()}initializeTargetFeatures(){const e=this.targetFeatures;Object.keys(e).forEach((t=>e[t]=!1)),e.navigation=!0,e.reader=!0,this.updateTargets()}updateTargets(){const e=this.targetFeatures,t=this.getGraphComponent(qd);Object.keys(e).forEach((n=>{const i=t[n],s=e[n];i&&this.updateComponentTarget(i,s)}));this.getGraphComponents(Zd).forEach((t=>this.updateComponentTarget(t.transform,!!e.models)));this.getGraphComponents($d).forEach((t=>this.updateComponentTarget(t,!!e.lights)))}updateComponentTarget(e,t){const n=e.snapshotProperties;n&&n.forEach((e=>{if(!e.schema.event&&"object"!==e.type){const n=this.hasTargetProperty(e);t&&!n?this.addTargetProperty(e):!t&&n&&this.removeTargetProperty(e)}}))}fromData(e,t){this.clear();const n=this.targetFeatures,i=Object.keys(n);e.features?i.forEach((t=>n[t]=e.features.indexOf(t)>=0)):this.initializeTargetFeatures();const s=new Set;e.targets.forEach(((e,n)=>{const i=e.lastIndexOf("/"),r=e.substr(0,i),o=e.substr(i+1),a=t.get(r),l=a?a.ins[o]:null;l?this.addTargetProperty(l):(console.warn(`missing snapshot target property for '${e}'`),s.add(n))})),e.states.forEach((e=>{this.setState({id:e.id,curve:void 0!==e.curve?Ud[e.curve]:Ud.EaseQuad,duration:void 0!==e.duration?e.duration:2,threshold:void 0!==e.threshold?e.threshold:.5,values:e.values.filter(((e,t)=>!s.has(t)))})}))}toData(e){const t=this.targetFeatures,n={features:Object.keys(t).filter((e=>t[e])),targets:this.targets.map((t=>{const n=t.property.group.linkable,i=t.property.key,s=e.get(n);if(!s)throw new Error(`snapshot path not registered for component '${n.displayName}'`);return s+"/"+i})),states:Object.keys(this.states).map((e=>{const t=this.states[e],n={id:t.id,values:t.values};return t.curve!==Ud.EaseQuad&&(n.curve=Ud[t.curve]),2!==t.duration&&(n.duration=t.duration),.5!==t.threshold&&(n.threshold=t.threshold),n}))};return n.targets.length>0&&n.states.length>0?n:null}}Hd.typeName="CVSnapshots";class Gd extends j{constructor(){super(...arguments),this.ins=this.addInputs(Gd.ins),this.outs=this.addOutputs(Gd.outs),this._tours=[]}get analytics(){return this.getMainComponent(Dh)}get language(){return this.getGraphComponent(Lh)}get setup(){return this.getGraphComponent(qd)}get snapshots(){return this.getComponent(Hd)}get tours(){return this._tours}get activeSteps(){const e=this.activeTour;return e?e.steps:null}get activeTour(){return this._tours[this.outs.tourIndex.value]}get activeStep(){const e=this.activeTour;return e?e.steps[this.outs.stepIndex.value]:null}get title(){const e=this.activeTour;return 0===Object.keys(e.titles).length&&(e.titles.EN=e.title),e.titles[vs[this.language.outs.language.value]]||"undefined"}set title(e){this.activeTour.titles[vs[this.language.outs.language.value]]=e}get lead(){const e=this.activeTour;return 0===Object.keys(e.leads).length&&(e.leads.EN=e.lead),e.leads[vs[this.language.outs.language.value]]||""}set lead(e){this.activeTour.leads[vs[this.language.outs.language.value]]=e}get taglist(){const e=this.activeTour;return 0===Object.keys(e.taglist).length&&e.tags.length>0&&(e.taglist.EN=e.tags),e.taglist[vs[this.language.outs.language.value]]||[]}set taglist(e){this.activeTour.taglist[vs[this.language.outs.language.value]]=e}get stepTitle(){const e=this.activeStep;return e?(0===Object.keys(e.titles).length&&(e.titles.EN=e.title),e.titles[vs[this.language.outs.language.value]]||"undefined"):null}set stepTitle(e){const t=this.activeStep;t&&(t.titles[vs[this.language.outs.language.value]]=e)}create(){super.create(),this.language.outs.language.on("value",this.update,this)}dispose(){this.language.outs.language.off("value",this.update,this),super.dispose()}update(e){const{ins:t,outs:n}=this,i=this._tours,s=this.snapshots,r=this.setup.navigation;if(t.enabled.changed){if(!t.enabled.value)return n.tourIndex.set(),s.tweenTo(Gd.sceneSnapshotId,e.secondsElapsed),s.deleteState(Gd.sceneSnapshotId),!0;{const e={id:Gd.sceneSnapshotId,curve:Ud.EaseOutQuad,duration:1,threshold:0,values:s.getCurrentValues()};s.setState(e)}}const o=Math.min(i.length-1,Math.max(-1,t.tourIndex.value)),a=i[o],l=a?a.steps.length:0;n.stepCount.setValue(l);let c=-1;if((t.tourIndex.changed||t.enabled.changed)&&(o!==n.tourIndex.value&&(c=0),n.tourIndex.setValue(o),n.tourTitle.setValue(a?this.title:""),n.tourLead.setValue(a?this.lead:"")),0===l)return n.stepIndex.setValue(-1),n.stepTitle.setValue(""),!0;let h=!0;if(t.enabled.changed&&(c=n.stepIndex.value),t.stepIndex.changed&&(c=Math.min(a.steps.length-1,Math.max(0,t.stepIndex.value)),h=!1),t.first.changed&&(c=0),t.next.changed&&(c=n.stepIndex.value+1,c>=l&&(n.ending.setValue(!0),n.tourIndex.setValue(-1),n.tourTitle.setValue(""),n.tourLead.setValue(""),n.stepIndex.set(),c=-1)),t.previous.changed&&(c=(n.stepIndex.value+l-1)%l),c>=0){r.setChanged(!0);const e=a.steps[c];n.stepIndex.setValue(c),n.stepTitle.setValue(this.stepTitle||"undefined"),s.ins.id.setValue(e.id),h?s.ins.tween.set():s.ins.recall.set()}return!0}fromData(e){this._tours=e.map((e=>({title:e.title,titles:e.titles||{},steps:e.steps.map((e=>({title:e.title,titles:e.titles||{},id:e.id}))),lead:e.lead||"",leads:e.leads||{},tags:e.tags||[],taglist:e.taglist||{}}))),this._tours.forEach((e=>{Object.keys(e.titles).forEach((e=>{this.language.addLanguage(vs[e])})),e.steps.forEach((e=>{0==Object.keys(e.titles).length&&(e.titles.EN=e.title||null)}))})),this.ins.tourIndex.setValue(-1),this.outs.count.setValue(this._tours.length)}toData(){return 0===this._tours.length?null:this._tours.map((e=>{const t={steps:e.steps.map((e=>{const t={};return t.id=e.id,Object.keys(e.titles).length>0?t.titles=e.titles:e.title&&(t.title=e.title),t}))};return Object.keys(e.titles).length>0?t.titles=e.titles:e.title&&(t.title=e.title),Object.keys(e.leads).length>0?t.leads=e.leads:e.lead&&(t.lead=e.lead),Object.keys(e.taglist).length>0?t.taglist=e.taglist:e.tags.length>0&&(t.tags=e.tags),t}))}}Gd.typeName="CVTours",Gd.sceneSnapshotId="scene-default",Gd.ins={enabled:C("Tours.Enabled"),tourIndex:x("Tours.Index",-1),closed:D("Tours.Closed"),stepIndex:x("Step.Index"),next:D("Step.Next"),previous:D("Step.Previous"),first:D("Step.First")},Gd.outs={count:x("Tours.Count"),tourIndex:x("Tour.Index",-1),tourTitle:A("Tour.Title"),tourLead:A("Tour.Lead"),stepCount:x("Tour.Steps"),ending:C("Tour.Ending"),stepIndex:x("Step.Index"),stepTitle:A("Step.Title")};class Wd extends j{constructor(){super(...arguments),this._narrationId=null,this.audioClips={},this.audioPlayer=null,this.isPlaying=!1,this.ins=this.addInputs(Wd.ins),this.outs=this.addOutputs(Wd.outs),this.onEnd=()=>{const{outs:e}=this;this.isPlaying=!1,e.narrationPlaying.setValue(!1)}}get assetManager(){return this.getMainComponent(Ch)}get language(){return this.getGraphComponent(Lh,!0)}get narrationId(){return this._narrationId||""}set narrationId(e){this._narrationId=e}create(){super.create(),this.graph.components.on(Nh,this.onMetaComponent,this)}dispose(){this.graph.components.off(Nh,this.onMetaComponent,this),super.dispose()}update(){const{ins:e,outs:t}=this;return e.playNarration.changed&&this.audioPlayer&&this._narrationId&&(this.isPlaying?this.stop():this.play(this._narrationId)),!0}getAudioList(){return Object.keys(this.audioClips).map((e=>this.audioClips[e]))}getAudioClip(e){return this.audioClips[e]}addAudioClip(e){this.audioClips[e.id]=e}removeAudioClip(e){delete this.audioClips[e]}onMetaComponent(e){const t=e.object;e.add&&t.once("load",(()=>{this.audioClips=t.audio.dictionary||{}}))}fromData(e){const{outs:t}=this;e=e||{},this._narrationId=e.narrationId||null,t.narrationEnabled.setValue(null!=this._narrationId),this.audioClips[this._narrationId]||(t.narrationEnabled.setValue(!1),console.warn("Invalid narration audio ID"))}toData(){let e=null;return null!==this._narrationId&&(e={narrationId:this._narrationId}),e}play(e){if(!this.audioPlayer)return void ho.show("Error - Audio Player not initialized.","error");const{outs:t}=this,n=this.audioClips[e].uris[vs[this.language.outs.language.getValidatedValue()]];this.audioPlayer.setAttribute("src",this.assetManager.getAssetUrl(n)),this.audioPlayer.play().then((()=>{this.isPlaying=!0,t.narrationPlaying.setValue(!0)})).catch((e=>ho.show(`Failed to play audio at '${this.audioPlayer.getAttribute("src")}':${e}`,"warning")))}stop(){this.audioPlayer.pause(),this.audioPlayer.currentTime=0,this.onEnd()}setupAudio(){null===this.audioPlayer&&(this.audioPlayer=document.createElement("audio"),this.audioPlayer.onended=this.onEnd)}}Wd.typeName="CVAudioManager",Wd.text="Audio",Wd.icon="",Wd.isSystemSingleton=!0,Wd.ins={playNarration:D("Audio.PlayNarration")},Wd.outs={narrationEnabled:C("Audio.NarrationEnabled",!1),narrationPlaying:C("Audio.NarrationPlaying",!1)};class qd extends j{constructor(){super(...arguments),this._savedSetupData={},this.ins=this.addInputs(qd.ins)}get featureMap(){return this.constructor.featureMap}get transform(){return this.getComponent(Rt)}create(){super.create();const e=this.node,t=qd.featureMap;for(const n in t)this[n]=e.createComponent(t[n]);this.snapshots=e.createComponent(Hd)}update(){const e=this.ins;return e.saveState.changed&&this.cacheSetupState(),e.restoreState.changed&&this.restoreSetupState(),!0}fromDocument(e,t,n){const i=e.scenes[t];if(!isFinite(i.setup))throw new Error("setup property missing in node");const s=this._savedSetupData=e.setups[i.setup],r=qd.featureMap;for(const e in r){n.set(`scenes/${t}/setup/${e}`,this[e]);const i=s[e];i&&this[e].fromData(i)}s.snapshots&&this.snapshots.fromData(s.snapshots,n)}toDocument(e,t,n){const i=this._savedSetupData,s=qd.featureMap;for(const e in s)n.set(this[e],`scenes/${t}/setup/${e}`);const r=this.tours.toData();r&&(i.tours=r);const o=this.snapshots.toData(n);if(o&&(i.snapshots=o),i){e.setups=e.setups||[];const n=e.setups.length;e.setups.push(i),e.scenes[t].setup=n}}cacheSetupState(){const e=qd.featureMap;for(const t in e){const e=this[t].toData();e&&(this._savedSetupData[t]=e)}}restoreSetupState(){const e=this._savedSetupData,t=qd.featureMap;for(const n in t){const t=e[n];t&&"tours"!==n&&this[n].fromData(t)}}}qd.typeName="CVSetup",qd.ins={saveState:D("Setup.SaveState"),restoreState:D("Setup.RestoreState")},qd.featureMap={interface:Ru,reader:Oh,viewer:Lu,navigation:od,background:dd,environment:Au,language:Lh,floor:bd,grid:Ed,tape:Dd,slicer:Id,tours:Gd,audio:Wd};const Xd=new Ve,Yd=new Ve,Kd=new Ue,Jd=new Lt;class Zd extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(Zd.ins),this.outs=this.addOutputs(Zd.outs),this._derivatives=new fa,this._activeDerivative=null,this._visible=!0,this._boxFrame=null,this._localBoundingBox=new Lt,this.object3D=new Es}get settingProperties(){return[this.ins.name,this.ins.visible,this.ins.quality,this.ins.localUnits,this.ins.tags,this.ins.renderOrder,this.ins.shadowSide,this.ins.shader,this.ins.overlayMap,this.ins.override,this.ins.color,this.ins.opacity,this.ins.hiddenOpacity,this.ins.roughness,this.ins.metalness,this.ins.occlusion,this.ins.doubleSided]}get snapshotProperties(){return[this.ins.visible,this.ins.quality,this.ins.overlayMap]}get derivatives(){return this._derivatives}get activeDerivative(){return this._activeDerivative}get localBoundingBox(){return this._localBoundingBox}get assetManager(){return this.getMainComponent(Ch)}get assetReader(){return this.getMainComponent(Rh)}get renderer(){return this.getMainComponent(Ae)}create(){super.create();this.node.createComponent(Tu).ins.unitScale.linkFrom(this.outs.unitScale);const e=this.renderer.outs.maxTextureSize.value;e<2048?this.ins.quality.setValue(Wo.Low):e<4096?this.ins.quality.setValue(Wo.Medium):this.ins.quality.setValue(Wo.High)}update(){const e=this.ins;if(e.name.changed&&(this.node.name=e.name.value),e.tags.changed||e.activeTags.changed||e.visible.changed){let t=e.visible.value;if(t){const n=e.tags.value.split(",").map((e=>e.trim())).filter((e=>e)),i=e.activeTags.value.split(",").map((e=>e.trim())).filter((e=>e));t=!n.length,i.forEach((e=>{n.indexOf(e)>=0&&(t=!0)}))}const n=this.ins.override.value;this._visible=t,t?(this.object3D.visible=!0,n&&this.updateMaterial()):e.visible.value&&n&&this.ins.hiddenOpacity.value>0?(this.object3D.visible=!0,this.updateMaterial()):this.object3D.visible=!1}if(e.tags.changed&&this.emit({type:"tag-update"}),!this.activeDerivative&&e.autoLoad.changed&&e.autoLoad.value)this.autoLoad(e.quality.value);else if(e.quality.changed){const t=this.derivatives.select(Go.Web3D,e.quality.value);t&&t!==this.activeDerivative&&this.loadDerivative(t).catch((e=>{console.warn("Model.update - failed to load derivative"),console.warn(e)}))}return e.renderOrder.changed&&this.updateRenderOrder(this.object3D,e.renderOrder.value),(e.localUnits.changed||e.globalUnits.changed)&&this.updateUnitScale(),e.shader.changed&&this.updateShader(),e.overlayMap.changed&&this.updateOverlayMap(),e.override.value&&e.shader.value===na.Default&&(e.override.changed||e.color.changed||e.opacity.changed||e.roughness.changed||e.metalness.changed||e.occlusion.changed)&&this.updateMaterial(),e.center.changed&&this.center(),(e.position.changed||e.rotation.changed)&&this.updateMatrixFromProps(),e.dumpDerivatives.changed&&console.log(this.derivatives.toString(!0)),!0}dispose(){this.derivatives.clear(),this._activeDerivative=null,super.dispose()}center(){const e=this.object3D,t=this.ins.position;e.matrix.decompose(Xd,Kd,Yd),e.matrix.makeRotationFromQuaternion(Kd),Jd.makeEmpty(),Ho(e,Jd,e.parent),Jd.getCenter(Xd),Xd.multiplyScalar(-1).toArray(t.value),t.set()}setFromMatrix(e){const t=this.ins;e.decompose(Xd,Kd,Yd),Xd.multiplyScalar(1/this.outs.unitScale.value).toArray(t.position.value),t.position.set(),jo(Kd,Zd.rotationOrder,t.rotation.value),t.rotation.set()}fromDocument(e,t){const{ins:n,outs:i}=this;if(!isFinite(t.model))throw new Error("model property missing in node");const s=e.models[t.model];n.name.setValue(t.name);const r=gs[s.units||"cm"];n.localUnits.setValue(isFinite(r)?r:gs.cm),n.visible.setValue(void 0===s.visible||s.visible),n.tags.setValue(s.tags||""),n.renderOrder.setValue(void 0!==s.renderOrder?s.renderOrder:0);const o=Yo[s.shadowSide||"Back"];if(n.shadowSide.setValue(isFinite(o)?o:Yo.Back),n.position.reset(),n.rotation.reset(),s.translation&&n.position.copyValue(s.translation),s.rotation&&(Kd.fromArray(s.rotation),jo(Kd,Zd.rotationOrder,n.rotation.value),n.rotation.set()),s.boundingBox){const e=this._localBoundingBox;e.min.fromArray(s.boundingBox.min),e.max.fromArray(s.boundingBox.max),this._boxFrame=new ks(e,"#009cde"),this.addObject3D(this._boxFrame),this._boxFrame.updateMatrixWorld(!0);const t=this.getGraphComponent(qd);t.navigation.ins.autoZoom.value&&t.navigation.ins.zoomExtents.set(),i.updated.set(),this.updateUnitScale()}if(s.derivatives&&this.derivatives.fromJSON(s.derivatives),s.material){const e=s.material;n.copyValues({override:!0,color:e.color||n.color.schema.preset,opacity:void 0!==e.opacity?e.opacity:n.opacity.schema.preset,hiddenOpacity:void 0!==e.hiddenOpacity?e.hiddenOpacity:n.hiddenOpacity.schema.preset,roughness:void 0!==e.roughness?e.roughness:n.roughness.schema.preset,metalness:void 0!==e.metalness?e.metalness:n.metalness.schema.preset,occlusion:void 0!==e.occlusion?e.occlusion:n.occlusion.schema.preset,doubleSided:void 0!==e.doubleSided?e.doubleSided:n.doubleSided.schema.preset})}return s.annotations&&this.getComponent(Tu).fromData(s.annotations),this.emit({type:"tag-update"}),this.ins.autoLoad.set(),t.model}toDocument(e,t){const n={units:gs[this.ins.localUnits.getValidatedValue()]},i=this.ins;i.visible.value||(n.visible=!1),i.tags.value&&(n.tags=i.tags.value),0!==i.renderOrder.value&&(n.renderOrder=i.renderOrder.value),i.shadowSide.value!=Yo.Back&&(n.shadowSide=Yo[this.ins.shadowSide.getValidatedValue()]);const s=i.position.value;0===s[0]&&0===s[1]&&0===s[2]||(n.translation=i.position.value);const r=i.rotation.value;0===r[0]&&0===r[1]&&0===r[2]||(Bo(r,Zd.rotationOrder,Kd),n.rotation=Kd.toArray()),i.override.value&&(n.material={color:i.color.value,opacity:i.opacity.value,hiddenOpacity:i.hiddenOpacity.value,roughness:i.roughness.value,metalness:i.metalness.value,occlusion:i.occlusion.value,doubleSided:i.doubleSided.value}),n.boundingBox={min:this._localBoundingBox.min.toArray(),max:this._localBoundingBox.max.toArray()},n.derivatives=this.derivatives.toJSON();const o=this.getComponent(Tu).toData();o&&o.length>0&&(n.annotations=o),e.models=e.models||[];const a=e.models.length;return e.models.push(n),a}updateShader(){const e=this.ins.shader.getValidatedValue();this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&n.setShaderMode(e)}))}updateOverlayMap(){const e=this.getGraphComponent(qd,!0);if(e&&e.snapshots.outs.tweening.value)return void e.snapshots.outs.end.once("value",(()=>{this.ins.overlayMap.set(),this.update()}));const t=this.ins.overlayMap.getOptionText();"None"!==t?this.assetReader.getTexture(t).then((e=>{this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(e.flipY=!1,n.zoneMap=e,n.enableZoneMap(!0))}))})):this.object3D.traverse((e=>{const t=e.material;t&&t.isUberPBRMaterial&&(t.enableZoneMap(!1),t.zoneMap=null)}))}updateMaterial(){const e=this.ins;this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(n.aoMapMix.setScalar(e.occlusion.value),n.color.fromArray(e.color.value),n.opacity=this._visible?e.opacity.value:e.hiddenOpacity.value,n.transparent=n.opacity<1||!!n.alphaMap,n.roughness=e.roughness.value,n.metalness=e.metalness.value,n.side=e.doubleSided.value?2:0)}))}updateUnitScale(){const e=this.ins.localUnits.getValidatedValue(),t=this.ins.globalUnits.getValidatedValue();this.outs.unitScale.setValue(Jo(e,t)),this.updateMatrixFromProps()}updateMatrixFromProps(){const e=this.ins,t=this.outs.unitScale.value,n=this.object3D;Xd.fromArray(e.position.value).multiplyScalar(t),Bo(e.rotation.value,Zd.rotationOrder,Kd),Yd.setScalar(t),n.matrix.compose(Xd,Kd,Yd),n.matrixWorldNeedsUpdate=!0,this.outs.updated.set()}updateRenderOrder(e,t){e.renderOrder=t,e.children.forEach((e=>this.updateRenderOrder(e,t)))}autoLoad(e){const t=[],n=this.derivatives.select(Go.Web3D,Wo.Thumb);n&&t.push(n);const i=this.derivatives.select(Go.Web3D,e);return i&&i!==n&&t.push(i),0===t.length?(ho.show(`No 3D derivatives available for '${this.displayName}'.`),Promise.resolve()):t.reduce(((e,t)=>e.then((()=>{this.loadDerivative(t)}))),Promise.resolve())}loadDerivative(e){if(this.node&&this.assetReader)return e.load(this.assetReader).then((()=>{if(!e.model)return;this.assetManager.initialLoad||this._activeDerivative||(this.assetManager.initialLoad=!0),this._activeDerivative&&(this.removeObject3D(this._activeDerivative.model),this._activeDerivative.unload()),this._activeDerivative=e,this.addObject3D(e.model),this.renderer.activeSceneComponent.scene.updateMatrixWorld(!0),this._boxFrame&&(this.removeObject3D(this._boxFrame),this._boxFrame.geometry.dispose(),this._boxFrame=null),this._localBoundingBox.makeEmpty(),Ho(e.model,this._localBoundingBox),this.outs.updated.set(),this.outs.quality.setValue(e.data.quality),this.ins.override.value&&this.updateMaterial(),this.ins.shadowSide.value!=Yo.Back&&this.object3D.traverse((e=>{const t=e.material;t&&t.isUberPBRMaterial&&(this.ins.shadowSide.value==Yo.Front?t.shadowSide=0:t.shadowSide=1)})),this.getGraphComponent(Au).ins.dirty.set(),0!==this.ins.renderOrder.value&&this.updateRenderOrder(this.object3D,this.ins.renderOrder.value);const t=["None"];t.push(...e.findAssets(qo.Image).filter((e=>e.data.mapType===Xo.Zone)).map((e=>e.data.uri))),this.ins.overlayMap.setOptions(t),this.emit({type:"model-load",quality:e.data.quality})})).catch((e=>ho.show(`Failed to load model derivative: ${e.message}`)));console.warn("Model load interrupted.")}addObject3D(e){this.object3D.add(e),this.object3D.traverse((e=>{"Mesh"===e.type&&this.registerPickableObject3D(e,!0)}))}}Zd.typeName="CVModel2",Zd.text="Model",Zd.icon="cube",Zd.rotationOrder="ZYX",Zd.ins={name:A("Model.Name"),globalUnits:R("Model.GlobalUnits",gs,gs.cm),localUnits:R("Model.LocalUnits",gs,gs.cm),quality:R("Model.Quality",Wo,Wo.High),tags:A("Model.Tags"),renderOrder:b("Model.RenderOrder",0),shadowSide:R("Model.ShadowSide",Yo,Yo.Back),activeTags:A("Model.ActiveTags"),autoLoad:C("Model.AutoLoad",!0),position:w("Model.Position"),rotation:w("Model.Rotation"),center:D("Model.Center"),shader:R("Material.Shader",na,na.Default),overlayMap:L("Material.OverlayMap",["None"],0),override:C("Material.Override",!1),color:T("Material.BaseColor"),opacity:_("Material.Opacity",1),hiddenOpacity:_("Material.HiddenOpacity",0),roughness:_("Material.Roughness",.8),metalness:_("Material.Metalness",.1),occlusion:_("Material.Occlusion",.25),doubleSided:C("Material.DoubleSided",!1),dumpDerivatives:D("Derivatives.Dump")},Zd.outs={unitScale:b("UnitScale",{preset:1,precision:5}),quality:R("LoadedQuality",Wo),updated:D("Updated")};const Qd=new Ve,ep=new Ve,tp=new Ze,np=new Ue;class ip extends zo{constructor(e,t){super(e,t),this.ins=this.addInputs(ip.camIns),this.object3D=new id}get camera(){return this.object3D}update(){const{autoActivate:e,activate:t}=this.ins;if(t.changed||e.changed&&e.value){const e=this.scene;e&&(e.activeCameraComponent=this)}const n=this.camera,{position:i,rotation:s,projection:r,fov:o,size:a,zoom:l,near:c,far:h}=this.ins;return(i.changed||s.changed)&&(n.position.fromArray(i.value),n.rotation.fromArray(s.value),n.updateMatrix()),r.changed&&n.setProjection(r.getValidatedValue()),n.fov=o.value,n.size=a.value,n.zoom=l.value,n.near=c.value,n.far=h.value,n.updateProjectionMatrix(),!0}dispose(){const e=this.scene;e&&e.activeCameraComponent===this&&(e.activeCameraComponent=null),super.dispose()}setPropertiesFromMatrix(e){const t=!e;e=e||this.object3D.matrix;const{position:n,rotation:i,order:s}=this.ins;e.decompose(Qd,np,ep),Qd.toArray(n.value);const r=s.getOptionText();tp.setFromQuaternion(np,r),tp.toVector3(Qd),Qd.multiplyScalar(vt.RAD2DEG).toArray(i.value),n.set(t),i.set(t)}}ip.typeName="CCamera",ip.camIns={autoActivate:C("Camera.AutoActivate",!0),activate:D("Camera.Activate"),position:w("Transform.Position"),rotation:w("Transform.Rotation"),order:R("Transform.Order",Pt,Pt.ZYX),projection:R("Projection.Type",ed,ed.Perspective),fov:b("Projection.FovY",52),size:b("Projection.Size",20),zoom:b("Projection.Zoom",1),near:b("Frustum.ZNear",.01),far:b("Frustum.ZFar",1e4)};class sp extends ip{constructor(e,t){super(e,t),this.object3D.layers.enable(1)}get settingProperties(){return[this.ins.projection,this.ins.fov,this.ins.size,this.ins.near,this.ins.far]}fromDocument(e,t){if(!isFinite(t.camera))throw new Error("camera property missing in node");const n=e.cameras[t.camera];return"perspective"===n.type?this.ins.copyValues({projection:ed.Perspective,fov:n.perspective.yfov,near:n.perspective.znear,far:n.perspective.zfar}):this.ins.copyValues({projection:ed.Orthographic,size:n.orthographic.ymag,near:n.orthographic.znear,far:n.orthographic.zfar}),t.camera}toDocument(e,t){const n=this.ins,i={};n.projection.getValidatedValue()===ed.Perspective?(i.type="perspective",i.perspective={yfov:n.fov.value,znear:n.near.value,zfar:n.far.value}):(i.type="orthographic",i.orthographic={ymag:n.size.value,znear:n.near.value,zfar:n.far.value}),e.cameras=e.cameras||[];const s=e.cameras.length;return e.cameras.push(i),s}}sp.typeName="CVCamera",sp.text="Camera",sp.icon="video";const rp=new Ve;class op extends Ms{constructor(){super(...arguments),this.ins=this.addInputs(op.ins),this.outs=this.addOutputs(op.outs),this.updateCameraHelper=()=>{const e=this.setup.navigation.ins.offset.value,t=rp.set(e[0],e[1],e[2]).length();if(!this.system.getComponent("CVStoryApplication",!0)){const n=2*Math.max(t,this.outs.boundingRadius.value),i=this.setup.navigation.ins.maxOffset.value,s=e[2]{const n=4*Math.max(t,this.outs.boundingRadius.value),i=n/1e3;(n{e.ins.globalUnits.linkFrom(this.ins.units),this.ins.modelUpdated.linkFrom(e.outs.updated)}))}update(e){const t=this.ins,n=this.outs;return t.units.changed&&(this.updateTransformHierarchy(),this.updateModelBoundingBox(),this.updateLights(),this.updateCameras(),n.units.setValue(t.units.value)),t.modelUpdated.changed&&(this.updateModelBoundingBox(),this.updateLights(),this.updateCameras()),t.sceneTransformed.changed&&this.updateModelBoundingBox(),!0}dispose(){this.graph.components.off(Zd,this.onModelComponent,this),super.dispose()}fromDocument(e,t){this.ins.units.setValue(gs[t.units]||0),this.outs.units.setValue(gs[t.units]||0)}toDocument(e,t){t.units=gs[this.ins.units.getValidatedValue()]}onModelComponent(e){const t=e.object;e.add&&(t.ins.globalUnits.linkFrom(this.ins.units),this.ins.modelUpdated.linkFrom(t.outs.updated)),this.updateModelBoundingBox()}updateModelBoundingBox(){const e=this.outs.boundingBox.value;e.makeEmpty(),this.models.forEach((t=>e.expandByObject(t.object3D))),e.getSize(rp),this.outs.boundingBox.set(),this.outs.boundingRadius.setValue(.5*rp.length())}updateTransformHierarchy(){if(0===this.models.length)return;const{ins:e,outs:t}=this,n=Jo(t.units.value,e.units.value),i=this.models[0].object3D.parent.parent;i.position.multiplyScalar(n),i.updateMatrix(),i.updateMatrixWorld(!0),this.models.forEach((e=>{const t=e.object3D.parent;t.position.multiplyScalar(n),t.updateMatrix(),t.updateMatrixWorld(!0)}))}updateLights(){const{ins:e,outs:t}=this,n=this.graph.findNodeByName("Lights").getComponent(Rt,!0),i=Jo(t.units.value,e.units.value);rp.setScalar(this.outs.boundingRadius.value*i*.05),n.ins.scale.setValue(rp.toArray()),n.object3D.updateMatrixWorld(!0)}updateCameras(){this.setup.navigation.ins.autoZoom.value?this.setup.navigation.ins.offset.once("value",this.updateCameraHelper):this.updateCameraHelper()}}op.typeName="CVScene",op.text="Scene",op.icon="hierarchy",op.ins={units:R("Scene.Units",gs,gs.cm),modelUpdated:D("Scene.ModelUpdated"),sceneTransformed:D("Scene.Transformed")},op.outs={units:R("Scene.Units",gs,gs.cm),boundingBox:N("Models.BoundingBox",Lt),boundingRadius:b("Models.BoundingRadius")};class ap extends wn{constructor(e){super(),this.type="ShadowMaterial",this.color=new Pn(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}ap.prototype.isShadowMaterial=!0;class lp extends sl{constructor(e,t,n){super(),this.shadowMaterial=new ap,this.boundingBox=new Lt,this.size=new Ve,this.isAnimated=!1,this.needsUpdate=!1,this.intensity=0,this.castShadow=!0,this.frustumCulled=!1,this.floor=new ui(new pi,this.shadowMaterial),this.floor.rotateX(-Math.PI/2),this.floor.receiveShadow=!0,this.floor.castShadow=!1,this.floor.frustumCulled=!1,this.add(this.floor),this.shadow.camera.up.set(0,0,1),t.add(this),this.target=t,this.setModel(e,n)}setModel(e,t){this.boundingBox.copy(e.outs.boundingBox.value),e.outs.boundingBox.value.getSize(this.size);const{boundingBox:n,size:i}=this;if(this.isAnimated){const e=2*Math.max(i.x,i.y,i.z);i.y=e,n.expandByVector(i.subScalar(e).multiplyScalar(-.5)),n.max.y=n.min.y+e,i.set(e,e,e)}const s=.001*i.y;this.position.y=n.max.y+s,n.getCenter(this.floor.position),this.setSoftness(t)}setSoftness(e){const t=Math.pow(2,9-3*e);this.setMapSize(t)}setMapSize(e){const{camera:t,mapSize:n,map:i}=this.shadow,{size:s,boundingBox:r}=this;null!=i&&(i.dispose(),this.shadow.map=null),this.isAnimated&&(e*=2);const o=Math.floor(s.x>s.z?e:e*s.x/s.z),a=Math.floor(s.x>s.z?e*s.z/s.x:e);n.set(o,a);const l=2.5*s.x/o,c=2.5*s.z/a;t.left=-r.max.x-l,t.right=-r.min.x+l,t.bottom=r.min.z-c,t.top=r.max.z+c,this.setScaleAndOffset(t.zoom,0),this.shadow.updateMatrices(this),this.floor.scale.set(s.x+2*l,s.z+2*c,1),this.needsUpdate=!0}setIntensity(e){this.shadowMaterial.opacity=e,e>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.shadowMaterial.opacity}setRotation(e){this.shadow.camera.up.set(Math.sin(e),0,Math.cos(e)),this.shadow.updateMatrices(this)}setScaleAndOffset(e,t){const n=this.size.y,i=1/e,s=.001*n;this.floor.position.y=2*s-n+t*i;const{camera:r}=this.shadow;r.zoom=e,r.near=0,r.far=n*e-t,r.projectionMatrix.makeOrthographic(r.left*e,r.right*e,r.top*e,r.bottom*e,r.near,r.far),r.projectionMatrixInverse.copy(r.projectionMatrix).invert(),this.shadow.updateMatrices(this)}updateMatrices(){this.shadow.updateMatrices(this)}dispose(){const{floor:e,shadowMaterial:t}=this;e.geometry.dispose(),t.dispose(),this.floor=null,this.shadowMaterial=null}}class cp extends $d{constructor(e,t){super(e,t),this.ins=this.addInputs(cp.dirLightIns),this.object3D=new sl,this.light.target.matrixAutoUpdate=!1}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;if((n.position.changed||n.target.changed)&&(t.position.fromArray(n.position.value),t.target.position.fromArray(n.target.value),t.updateMatrix(),t.target.updateMatrix()),n.shadowSize.changed){const e=t.shadow.camera,i=.5*n.shadowSize.value;e.left=e.bottom=-i,e.right=e.top=i,e.updateProjectionMatrix()}return!0}onAddToParent(e){super.onAddToParent(e),e.add(this.light.target)}onRemoveFromParent(e){super.onRemoveFromParent(e),e.remove(this.light.target)}}cp.typeName="CDirectionalLight",cp.dirLightIns={position:w("Light.Position"),target:w("Light.Target",[0,-1,0]),shadowSize:b("Shadow.Size",100)};class hp extends cp{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.shadowEnabled,this.ins.shadowSize,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if("directional"!==n.type)throw new Error("light type mismatch: not a directional light");return i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,target:i.target.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowSize:void 0!==n.shadowSize?n.shadowSize:i.shadowSize.schema.preset,shadowResolution:void 0!==n.shadowResolution?Bd[n.shadowResolution]||0:i.shadowResolution.schema.preset,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,type:"directional"};n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowSize.isDefault()||(i.shadowSize=n.shadowSize.value),n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=Bd[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}hp.typeName="CVDirectionalLight",hp.text="Directional Light",hp.icon="bulb";const up=new je,dp=new Ve,pp=new Ve,mp=new Lt,fp=new Ue;class gp extends j{constructor(){super(...arguments),this._shadowRoot=null,this.ins=this.addInputs(gp.ins),this.outs=this.addOutputs(gp.outs),this.arLink=document.createElement("a"),this.raycaster=new en,this.initialHitTestSource=null,this.inputSource=null,this.transientHitTestSource=null,this.refSpace=null,this.frame=null,this.vScene=null,this.camera=null,this.cameraParent=null,this.cachedView=null,this.cachedQuality=null,this.cachedNearPlane=0,this.cachedFarPlane=0,this.xrCamera=null,this.hitPlane=null,this.selectionRing=null,this.session=null,this.setup=null,this.originalUnits=null,this.isTranslating=!1,this.isRotating=!1,this.isScaling=!1,this.lastDragValueX=0,this.lastDragValueY=0,this.totalDrag=0,this.lastScale=0,this.lastHitPosition=new Ve,this.lastFrameTime=0,this.targetOpacity=0,this.modelFloorOffset=0,this.optimalCameraDistance=0,this.shadow=null,this.lightTransform=null,this.lightsToReset=[],this.featuresToReset=[],this.onSessionEnded=()=>{this.outs.isPresenting.setValue(!1);const e=this.renderer.views[0].renderer;this.resetScene(),e.shadowMap.autoUpdate=!0;const t=this.initialHitTestSource;null!=t&&(t.cancel(),this.initialHitTestSource=null);const n=this.transientHitTestSource;null!=n&&(n.cancel(),this.transientHitTestSource=null),this.refSpace=null,this.frame=null,this.inputSource=null,this.xrCamera=null,this.cachedView=null,this.vScene=null,this.cachedView=null,this.camera=null;const i=this.session;i&&(i.removeEventListener("end",this.onSessionEnded),i.removeEventListener("selectstart",this.onSelectStart),i.removeEventListener("selectend",this.onSelectEnd),this.session=null),this.setup.reader.ins.enabled.off("value",this.endSession,this),e.setAnimationLoop(null),e.xr.enabled=!1,this.outs.isPlaced.setValue(!1),this.setup.navigation.ins.enabled.setValue(!0),this.renderer.views[0].render()},this.render=(e,t)=>{this.frame=t;const n=this.renderer.views[0].renderer,{camera:i,xrCamera:s,refSpace:r,initialHitTestSource:o,vScene:a,sceneNode:l,shadow:c,lastFrameTime:h}=this;if(!t||!t.getViewerPose(r))return;if(!s&&this.session){const e=n.xr.getCamera(i);return void(this.xrCamera=e.cameras[0])}if(s&&(i.position.setFromMatrixPosition(s.matrixWorld),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),i.projectionMatrix.fromArray(s.projectionMatrix.elements),i.projectionMatrixInverse.copy(s.projectionMatrix).invert()),null!=o&&s){const e=a.scene,{position:t}=e,n=2*l.outs.boundingRadius.value+s.near,r=s.matrixWorld.elements;t.set(-r[8],-r[9],-r[10]).normalize(),t.multiplyScalar(n),t.add(i.position),mp.getCenter(dp),t.add(dp.negate()),e.updateMatrix(),e.updateMatrixWorld()}if(this.setInitialPosition(t),this.handleInput(t),this.outs.isPlaced.value){const t=e-h;this.updateOpacity(t,this.targetOpacity),this.lastFrameTime=e}const u=n.getContext();u.depthMask(!1),u.clear(u.DEPTH_BUFFER_BIT),u.depthMask(!0),c.needsUpdate&&(n.shadowMap.needsUpdate=!0,c.needsUpdate=!1),n.render(a.scene,i)},this.onSelectStart=e=>{const t=this.vScene.scene,n=this.transientHitTestSource;if(null==n)return;this.targetOpacity=.5;const i=this.frame.getHitTestResultsForTransientInput(n);if(1===i.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,n=this.raycaster;n.setFromCamera({x:t[0],y:-t[1]},this.xrCamera);const i=n.intersectObject(this.hitPlane);i.length>0?(this.isTranslating=!0,this.lastHitPosition.copy(i[0].point)):this.isRotating=!0,this.lastDragValueX=t[0],this.lastDragValueY=t[1]}else 2===i.length&&(this.isScaling=!0,this.lastScale=this.getFingerSeparation(i)/t.scale.x)},this.onSelectEnd=()=>{this.targetOpacity=0,this.totalDrag=0,this.isTranslating=!1,this.isRotating=!1,this.isScaling=!1,this.inputSource=null}}get renderer(){return this.getMainComponent(Ae)}get pulse(){return this.getMainComponent(Ee)}get sceneNode(){return this.getSystemComponent(op)}get analytics(){return this.system.getMainComponent(Dh)}get assetManager(){return this.getMainComponent(Ch)}get shadowRoot(){return this._shadowRoot}set shadowRoot(e){this._shadowRoot=e}update(){const{ins:e,outs:t}=this;if(e.enabled.changed){let n=e.enabled.value;n&&(us?(this.launchWebXR(),this.analytics.sendProperty("AR.Enabled","WebXR")):fs?(this.launchSceneViewer(),this.analytics.sendProperty("AR.Enabled","SceneViewer")):ps&&ms?(this.launchQuickLook(),this.analytics.sendProperty("AR.Enabled","QuickLook")):(n=!1,this.analytics.sendProperty("AR.Enabled","Unavailable"))),t.enabled.setValue(n)}return!0}launchWebXR(){var e,t,n;const i=null===(e=this.renderer)||void 0===e?void 0:e.views[0].renderer,s=this.vScene=null===(t=this.renderer)||void 0===t?void 0:t.activeSceneComponent,r=this.camera=null==s?void 0:s.activeCamera;this.cameraParent=r.parent;if(!(this.setup=this.getSystemComponent(qd)))return!1;const o=null===(n=this.sceneNode)||void 0===n?void 0:n.getGraphComponents(Zd);(o[0]?o[0].derivatives.get(Go.Web3D,Wo.AR):null)&&(this.setup.navigation.setChanged(!0),this.cachedQuality=o[0].ins.quality.value,o.forEach((e=>{e.ins.quality.setValue(Wo.AR)})),i.setAnimationLoop(((e,t)=>this.render(e,t))),navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay"],domOverlay:{root:this.shadowRoot.querySelector("ff-viewport-overlay")}}).then((e=>this.onSessionStarted(i,e))))}async onSessionStarted(e,t){const n=this.renderer.views[0].renderer.getContext();await n.makeXRCompatible(),t.updateRenderState({baseLayer:new XRWebGLLayer(t,n,{alpha:!0})}),this.setupScene(),e.shadowMap.autoUpdate=!1,e.xr.enabled=!0,e.xr.setReferenceSpaceType("local"),e.xr.setSession(t),t.addEventListener("end",this.onSessionEnded),this.refSpace=await t.requestReferenceSpace("local");const i=await t.requestReferenceSpace("viewer"),s=20*Math.PI/180,r=new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(s),z:-Math.cos(s)});t.requestHitTestSource({space:i,offsetRay:r}).then((e=>{this.initialHitTestSource=e})),this.outs.isPresenting.setValue(!0),this.session=t,this.lastFrameTime=performance.now(),this.setup.reader.ins.enabled.on("value",this.endSession,this)}endSession(){this.session&&this.session.end()}setupScene(){const{cameraParent:e,setup:t,featuresToReset:n}=this,i=this.sceneNode;e&&e.remove(this.camera),this.setup.background.hide(),this.setup.navigation.ins.enabled.setValue(!1);const s=i.graph.findNodeByName("Lights");(this.lightTransform=s.getComponent(Rt,!0)).ins.rotation.reset(),n.push(t.floor.ins.visible.value?1:0),n.push(t.grid.ins.visible.value?1:0),n.push(t.tape.ins.visible.value?1:0),n.push(t.slicer.ins.enabled.value?1:0),n.push(t.viewer.ins.shader.value),t.floor.ins.visible.setValue(!1),t.grid.ins.visible.setValue(!1),t.tape.ins.visible.setValue(!1),t.slicer.ins.enabled.setValue(!1),t.viewer.ins.shader.value!==na.Default&&t.viewer.ins.shader.setValue(na.Default);(this.originalUnits=i.ins.units.getValidatedValue())!=gs.m&&this.sceneNode.ins.units.setValue(gs.m);i.getGraphComponents(Tu).forEach((e=>{e.setXRScale(2)}));i.getGraphComponents(hp).forEach((e=>{e.ins.shadowEnabled.value&&(e.ins.shadowEnabled.setValue(!1),this.lightsToReset.push(e))})),this.pulse.pulse(Date.now()),i.update(null);(this.shadow=new lp(this.sceneNode,this.vScene.scene,.5)).setIntensity(.3),mp.copy(this.sceneNode.outs.boundingBox.value),mp.getSize(dp),this.cachedNearPlane=this.camera.near,this.cachedFarPlane=this.camera.far,this.vScene.activeCameraComponent.ins.near.setValue(.01),this.vScene.activeCameraComponent.ins.far.setValue(1e3)}resetScene(){const{camera:e,cameraParent:t,setup:n,featuresToReset:i}=this,s=this.vScene.scene;t&&t.add(e),e.position.set(0,0,0),e.rotation.set(0,0,0),this.vScene.activeCameraComponent.ins.near.setValue(this.cachedNearPlane),this.vScene.activeCameraComponent.ins.far.setValue(this.cachedFarPlane),e.updateMatrix(),this.lightTransform.object3D.rotation.set(0,0,0),this.lightTransform.object3D.updateMatrix(),this.sceneNode.ins.units.setValue(this.originalUnits),s.position.setScalar(0),s.rotation.y=0,s.scale.setScalar(1),s.updateMatrix(),s.updateMatrixWorld(!0),i.reverse(),n.floor.ins.visible.setValue(!!i.pop()),n.grid.ins.visible.setValue(!!i.pop()),n.tape.ins.visible.setValue(!!i.pop()),n.slicer.ins.enabled.setValue(!!i.pop());const r=i.pop();r!==na.Default&&n.viewer.ins.shader.setValue(r);this.sceneNode.getGraphComponents(Tu).forEach((e=>{e.setXRScale(1)})),this.lightsToReset.forEach((e=>{e.ins.shadowEnabled.setValue(!0)})),this.lightsToReset.length=0,n.background.show();this.sceneNode.getGraphComponents(Zd).forEach((e=>{e.ins.quality.setValue(this.cachedQuality)}));const o=this.hitPlane;null!=o&&(s.remove(o),o.geometry.dispose(),o.material.dispose(),this.hitPlane=null);const a=this.selectionRing;null!=a&&(s.remove(a),a.geometry.dispose(),a.material.dispose(),this.selectionRing=null);const l=this.shadow;null!=l&&(s.remove(l),l.dispose(),this.shadow=null),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix()}setInitialPosition(e){const t=this.initialHitTestSource;if(null==t)return;const n=e.getHitTestResults(t);if(0==n.length)return;const i=n[0],s=this.getHitPoint(i);if(null==s)return;this.placeModel(s),t.cancel(),this.initialHitTestSource=null;const{session:r}=e;r.addEventListener("selectstart",this.onSelectStart),r.addEventListener("selectend",this.onSelectEnd),r.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e})),this.shadow.updateMatrices()}getHitPoint(e){const t=e.getPose(this.refSpace);if(null==t)return null;const n=up.fromArray(t.transform.matrix);return n.elements[5]>.75?pp.setFromMatrixPosition(n):null}handleInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isScaling&&!this.isRotating)return;const n=e.getHitTestResultsForTransientInput(t),i=this.vScene.scene,s=i.scale.x;if(this.isScaling)if(n.length<2)this.isScaling=!1;else{const e=this.getFingerSeparation(n)/this.lastScale;i.scale.setScalar(e),i.position.y=this.lastHitPosition.y-this.modelFloorOffset*i.scale.y,i.updateMatrix(),i.updateMatrixWorld(),this.shadow.setScaleAndOffset(e,0),this.updateBoundingBox()}else{if(2===n.length)return this.isTranslating=!1,this.isRotating=!1,this.isScaling=!0,void(this.lastScale=this.getFingerSeparation(n)/s);if(this.isRotating){const e=this.inputSource.gamepad.axes[0];i.rotation.y+=1.5*(e-this.lastDragValueX),i.updateMatrix(),fp.copy(i.quaternion),fp.invert(),this.lightTransform.object3D.rotation.setFromQuaternion(fp),this.lightTransform.object3D.updateMatrix(),this.shadow.setRotation(i.rotation.y),this.lastDragValueX=e}else if(this.isTranslating){const e=this.inputSource.gamepad.axes,t=e[0]-this.lastDragValueX,s=e[1]-this.lastDragValueY;this.totalDrag+=Math.hypot(t,s),n.forEach((e=>{if(this.totalDrag<.01||e.inputSource!==this.inputSource||e.results.length<1)return;const t=this.getHitPoint(e.results[0]);null!=t&&(dp.copy(t),dp.sub(this.lastHitPosition),i.position.add(dp),i.updateMatrix(),i.updateMatrixWorld(),this.lastHitPosition.copy(t),this.updateBoundingBox())})),this.shadow.updateMatrices()}}}getFingerSeparation(e){const t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],s=n[1]-t[1];return Math.sqrt(i*i+s*s)}placeModel(e){const t=this.vScene.scene,{min:n,max:i}=mp,s=this.sceneNode.outs.boundingRadius.value,r=Math.max(1.25*(i.x-n.x),.15),o=Math.max(1.25*(i.z-n.z),.15),a=(n.x+i.x)/2,l=(n.z+i.z)/2;this.lastHitPosition.copy(e);const c=this.hitPlane=new ui(new pi(r,o),new Rn);c.position.set(a,n.y,l),c.rotation.set(-Math.PI/2,0,0),c.visible=!1,t.add(c);const h=new Ii,u=new Ii,d=r>o?.025*r:.025*o;this.roundedRect(h,-r/2,-o/2,r,o,.5*d),this.roundedRect(u,-r/2+d,-o/2+d,r-2*d,o-2*d,.4*d),h.holes.push(u);let p=new hs(h);const m=this.selectionRing=new ui(p,new Rn({side:2,opacity:0}));m.position.set(a,n.y,l),m.rotation.set(-Math.PI/2,0,0),m.material.transparent=!0,m.visible=!1,t.add(m),this.modelFloorOffset=n.y,t.position.set(e.x,e.y-n.y,e.z),t.updateMatrix(),t.updateMatrixWorld(!0),this.updateBoundingBox(),this.pulse.pulse(Date.now());const f=this.camera.position.clone(),g=e.clone().sub(f);if(g.length()null!==e.derivatives.get(Go.App3D,Wo.AR))),n=t>-1?e[t].derivatives.get(Go.App3D,Wo.AR):null;if(n){const e=this.arLink,t=n.findAsset(qo.Model),i=`intent://arvr.google.com/scene-viewer/1.0?file=${this.assetManager.getAssetUrl(t.data.uri)}&mode=ar_only#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end;`;e.setAttribute("href",i),e.click()}}launchQuickLook(){const e=this.sceneNode.getGraphComponents(Zd),t=e.findIndex((e=>null!==e.derivatives.get(Go.iOSApp3D,Wo.AR))),n=t>-1?e[t].derivatives.get(Go.iOSApp3D,Wo.AR):null;if(n){const e=this.arLink,t=n.findAsset(qo.Model),i=this.assetManager.getAssetUrl(t.data.uri);e.setAttribute("rel","ar");const s=document.createElement("img");e.appendChild(s),e.setAttribute("href",i.toString()),e.click(),e.removeChild(s)}}updateBoundingBox(){this.sceneNode.ins.sceneTransformed.set()}updateOpacity(e,t){const n=this.selectionRing.material,i=n.opacity;if(t===i)return;const s=t-i;n.opacity=s>0?Math.min(i+.002*e,t):Math.max(i-.002*e,t),this.selectionRing.visible=n.opacity>0}roundedRect(e,t,n,i,s,r){e.moveTo(t,n+r),e.lineTo(t,n+s-r),e.quadraticCurveTo(t,n+s,t+r,n+s),e.lineTo(t+i-r,n+s),e.quadraticCurveTo(t+i,n+s,t+i,n+s-r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t+i,n,t+i-r,n),e.lineTo(t+r,n),e.quadraticCurveTo(t,n,t,n+r)}}function vp(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");const n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);if(n)return n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):""}gp.typeName="CVARManager",gp.text="ARManager",gp.icon="",gp.isSystemSingleton=!0,gp.ins={enabled:C("State.Enabled")},gp.outs={enabled:C("State.Enabled"),available:C("State.Available",ds),isPlaced:C("AR.Placed",!1),isPresenting:C("AR.Presenting",!1)};class yp{constructor(e,t){this._args=e,this._props=t,this._args=e,this._state=null}get name(){return this._props.name||this._props.do.name.replace(/([A-Z])/g," $1").replace(/^./,(e=>e.toUpperCase()))}do(){if(this._state)throw new Error("undo should be called before execute can be applied again");this._state=this._props.do.apply(this._props.target,this._args)}undo(){if(!this._props.undo)throw new Error("can't undo this command");if(!this._state)throw new Error("execute should be called before undo can be applied");this._props.undo.call(this._props.target,this._state),this._state=null}canDo(){return!this._props.canDo||this._props.canDo()}canUndo(){return!!this._props.undo}}class bp extends o{constructor(e){super(),this.addEvent("update"),this.stack=[],this.pointer=-1,this.capacity=void 0!==e?e:bp.defaultCapacity}register(e){let t;t="function"==typeof e?e:t=>new yp(t,e);return(...e)=>{const n=t(e);this.do(n)}}setCapacity(e){for(this.capacity=e;this.stack.length>e;)this.stack.shift(),this.pointer--;this.pointer<0&&(this.stack=[],this.pointer=-1)}do(e){console.log(`Commander.do - '${e.name}'`),e.do(),e.canUndo()&&(this.stack.splice(this.pointer+1),this.stack.push(e),this.stack.length>this.capacity&&this.stack.shift(),this.pointer=this.stack.length-1,this.emit("update"))}undo(){if(this.pointer>=0){this.stack[this.pointer].undo(),this.pointer--,this.emit("update")}}redo(){if(this.pointer0&&(this.stack=[],this.pointer=-1,this.emit("update"))}canUndo(){return this.pointer>=0}canRedo(){return this.pointer=0?"Undo "+this.stack[this.pointer].name:"Can't Undo"}getRedoText(){return this.pointerthis.add(e)));const t=e.typeName;if(!t)throw new Error("type must have a 'typeName' member");if(this._dict[t])throw new Error(`type '${t}' already registered`);this._dict[t]=e,this.emit({type:"type",add:!0,remove:!1,classType:e})}remove(e){if(Array.isArray(e))return void e.forEach((e=>this.remove(e)));const t=e.typeName;if(!t)throw new Error("type must have a 'typeName' member");if(!this._dict[t])throw new Error(`type '${t}' not registered`);delete this._dict[t],this.emit({type:"type",add:!1,remove:!0,classType:e})}getType(e){let t=e;return"function"==typeof e?t=e.typeName:"object"==typeof e&&(t=e.constructor.typeName),this._dict[t]}createInstance(e,...t){const n=this.getType(e);if(!n)throw new Error(`type '${e}' not registered`);return new n(...t)}}class _p extends o{constructor(e){super({knownEvents:!1}),this.nodes=new F(B),this.components=new F(j),this.registry=e||new xp,this.graph=new bt(this,null),this.graph.activate()}getComponent(e,t=!1){return this.components.get(e,t)}getComponents(e){return this.components.getArray(e)}getComponentsByTag(e){return this.components.getByTag(e)}hasComponents(e){return this.components.has(e)}getMainComponent(e,t=!1){return this.graph.components.get(e,t)}getMainComponents(e){return this.graph.components.getArray(e)}getMainComponentsByTag(e){return this.graph.components.getByTag(e)}hasMainComponents(e){return this.graph.components.has(e)}getNode(e,t=!1){return this.nodes.get(e,t)}getNodes(e){return this.nodes.getArray(e)}getNodesByTag(e){return this.nodes.getByTag(e)}hasNodes(e){return this.nodes.has(e)}getMainNode(e,t=!1){return this.graph.nodes.get(e,t)}getMainNodes(e){return this.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.graph.nodes.getByTag(e)}hasMainNodes(e){return this.graph.nodes.has(e)}findNodeByName(e,t){const n=this.nodes.getArray(t);for(let t=0,i=n.length;te.toString(!0))).join("\n"):i}_addNode(e){this.nodes.add(e)}_removeNode(e){this.nodes.remove(e)}_addNodeTag(e,t){this.nodes.addByTag(e,t)}_removeNodeTag(e,t){this.nodes.removeByTag(e,t)}_addComponent(e){if(e.isSystemSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per system`);this.components.add(e)}_removeComponent(e){this.components.remove(e)}_addComponentTag(e,t){this.components.addByTag(e,t)}_removeComponentTag(e,t){this.components.removeByTag(e,t)}}class wp extends j{createActions(e){return{}}}wp.typeName="CController",wp.isSystemSingleton=!0;class Sp extends wp{constructor(e,t){super(e,t),this.outs=this.addOutputs(Sp.selOuts),this.multiSelect=!1,this.exclusiveSelect=!0,this.selectedNodes=new F(B),this.selectedComponents=new F(j),this._activeGraph=null,this.addEvents("select-node","select-component","active-graph","update"),this.selectedNodes.on(B,(e=>this.onSelectNode(e.object,e.add))),this.selectedComponents.on(j,(e=>this.onSelectComponent(e.object,e.add))),this._activeGraph=this.system.graph}getSelectedNode(e){return this.selectedNodes.get(e,!0)}getSelectedNodes(e){return this.selectedNodes.getArray(e)}getSelectedComponent(e){return this.selectedComponents.get(e,!0)}getSelectedComponents(e){return this.selectedComponents.getArray(e)}get activeGraph(){return this._activeGraph}set activeGraph(e){if(e!==this.activeGraph){this.clearSelection();const t=this._activeGraph;this._activeGraph=e,this.onActiveGraph(e),this.emit({type:"active-graph",previous:t,next:e})}}hasParentGraph(){return this._activeGraph&&this._activeGraph.parent}activateParentGraph(){this._activeGraph&&this._activeGraph.parent.graph&&(this.activeGraph=this._activeGraph.parent.graph)}hasChildGraph(){return this.selectedComponents.has(xt)}activateChildGraph(){const e=this.selectedComponents.get(xt,!0);e&&(this.activeGraph=e.innerGraph)}create(){super.create(),this.system.nodes.on(B,this.onSystemNode,this),this.system.components.on(j,this.onSystemComponent,this)}dispose(){this.system.nodes.off(B,this.onSystemNode,this),this.system.components.off(j,this.onSystemComponent,this),super.dispose()}createActions(e){return{selectNode:e.register({name:"Select Node",do:this.selectNode,target:this}),selectComponent:e.register({name:"Select Component",do:this.selectComponent,target:this}),clearSelection:e.register({name:"Clear Selection",do:this.clearSelection,target:this})}}nodeContainsSelectedComponent(e){const t=e.components.getArray();for(let e=0,n=t.length;e{e.updateMatrixWorld(!1),this.matrixWorld.copy(e.matrixWorld)}}dispose(){this.parent&&this.parent.remove(this),this.geometry.dispose()}static expandBoundingBox(e,t,n){const i=e.geometry;if(void 0!==i){let s=e;for(Pp.identity();s&&s!==t;)Pp.premultiply(s.matrix),s=s.parent;if(i.isGeometry){const e=i.vertices;for(let t=0,i=e.length;t{e.on("after-render",this.onSceneAfterRender,this)}),(e=>{e.off("after-render",this.onSceneAfterRender,this)}))}dispose(){this._sceneTracker.dispose(),this.system.off("pointer-up",this.onPointerUp,this),this._sceneTracker.dispose(),super.dispose()}update(){return!0}onSelectNode(e,t){super.onSelectNode(e,t);const n=e.getComponent(Rt,!0);n&&this.updateBracket(n,t)}onSelectComponent(e,t){super.onSelectComponent(e,t),(e instanceof zo||e instanceof Rt)&&this.updateBracket(e,t)}onPointerUp(e){this.ins.viewportPicking.value&&e.isPrimary&&!e.isDragging&&(e.component?this.selectComponent(e.component,e.ctrlKey):e.ctrlKey||this.clearSelection())}onSceneAfterRender(e){if(!this.ins.viewportBrackets.value)return;const t=e.context.renderer,n=e.context.camera;for(let e of this._brackets)e[1]instanceof Op&&e[1].update(),t.render(e[1],n)}updateBracket(e,t){if(e){if(t){const t=e.object3D;if(t)if(t.children[0]instanceof sl){const n=new Op(t.children[0],1,16766515);this._brackets.set(e,n)}else{const t=new Rp(e.object3D);this._brackets.set(e,t)}}else{const t=this._brackets.get(e);t&&(this._brackets.delete(e),t.dispose())}this.changed=!0}}}kp.typeName="CPickSelection";const zp=function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)},Up=function(e,t){"object"==typeof e&&(e=JSON.stringify(e));const n=window.URL.createObjectURL(new Blob([e],{type:"text/json"}));zp(n,t)};class Vp extends xt{constructor(e,t){super(e,t),this.ins=this.addInputs(Vp.rgIns),this._object3D=null,this._isAttached=!1,this._object3D=new ft,this._object3D.matrixAutoUpdate=!1}get transform(){return this.node.components.get(Rt,!0)}get scene(){const e=this.transform;return e?e.getParentComponent(Io,!0):void 0}get object3D(){return this._object3D}create(){super.create(),this.innerRoots.filter((e=>e.is(Rt))).forEach((e=>this._object3D.add(e.object3D))),this.trackComponent(Rt,(e=>this.ins.visible.value&&this.attachObject3D(e)),(e=>this.detachObject3D(e)))}dispose(){this.detachObject3D(this.transform),this.innerRoots.filter((e=>e.is(Rt))).forEach((e=>this._object3D.remove(e.object3D))),super.dispose()}update(e){super.update(e);const t=this.ins;if(t.visible.changed){const e=this.transform;t.visible.value?this.attachObject3D(e):this.detachObject3D(e)}return!0}onAddInnerRoot(e){e.is(Rt)&&this._object3D.add(e.object3D)}onRemoveInnerRoot(e){e.is(Rt)&&this._object3D.remove(e.object3D)}attachObject3D(e){this._isAttached||e&&(e.object3D.add(this._object3D),this._isAttached=!0)}detachObject3D(e){this._isAttached&&e&&(e.object3D.remove(this._object3D),this._isAttached=!1)}}Vp.typeName="CRenderGraph",Vp.rgIns={visible:C("Graph.Visible",!0)};var Fp=n(5310),Bp=n.n(Fp);const jp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/document.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Smithsonian 3D Document","description":"Describes a 3D document containing a scene with 3D models.","definitions":{"scene":{"$id":"#scene","type":"object","properties":{"nodes":{"type":"array","description":"The indices of the scene\'s root nodes.","items":{"type":"integer","minimum":0},"uniqueItems":true,"minItems":1},"setup":{"description":"The index of the scene\'s setup.","type":"integer","minimum":0}}},"node":{"$id":"#node","type":"object","properties":{"name":{"type":"string"},"children":{"type":"array","description":"The indices of this node\'s children.","items":{"type":"integer","minimum":0},"uniqueItems":true,"minItems":1},"matrix":{"description":"A floating-point 4x4 transformation matrix stored in column-major order.","type":"array","items":{"type":"number"},"minItems":16,"maxItems":16,"default":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},"translation":{"description":"The node\'s translation along the x, y, and z axes.","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[0,0,0]},"rotation":{"description":"The node\'s unit quaternion rotation in the order (x, y, z, w), where w is the scalar.","type":"array","items":{"type":"number","minimum":-1,"maximum":1},"minItems":4,"maxItems":4,"default":[0,0,0,1]},"scale":{"description":"The node\'s non-uniform scale, given as the scaling factors along the x, y, and z axes.","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[1,1,1]},"camera":{"description":"The index of the camera component of this node.","type":"integer","minimum":0},"light":{"description":"The index of the light component of this node.","type":"integer","minimum":0},"meta":{"description":"The index of the meta data component of this node.","type":"integer","minimum":0},"model":{"description":"The index of the model component of this node.","type":"integer","minimum":0}},"not":{"anyOf":[{"required":["matrix","translation"]},{"required":["matrix","rotation"]},{"required":["matrix","scale"]}]}},"camera":{"$id":"#camera","type":"object","properties":{"type":{"description":"Specifies if the camera uses a perspective or orthographic projection.","type":"string","enum":["perspective","orthographic"]},"perspective":{"description":"A perspective camera containing properties to create a perspective projection matrix.","type":"object","properties":{"yfov":{"type":"number","description":"The floating-point vertical field of view in radians.","exclusiveMinimum":0},"aspectRatio":{"type":"number","description":"The floating-point aspect ratio of the field of view.","exclusiveMinimum":0},"znear":{"type":"number","description":"The floating-point distance to the near clipping plane.","exclusiveMinimum":0},"zfar":{"type":"number","description":"The floating-point distance to the far clipping plane.","exclusiveMinimum":0}},"required":["yfov","znear"]},"orthographic":{"description":"An orthographic camera containing properties to create an orthographic projection matrix.","type":"object","properties":{"xmag":{"type":"number","description":"The floating-point horizontal magnification of the view. Must not be zero."},"ymag":{"type":"number","description":"The floating-point vertical magnification of the view. Must not be zero."},"znear":{"type":"number","description":"The floating-point distance to the near clipping plane.","exclusiveMinimum":0},"zfar":{"type":"number","description":"The floating-point distance to the far clipping plane. `zfar` must be greater than `znear`.","exclusiveMinimum":0}},"required":["ymag","znear","zfar"]}},"required":["type"],"not":{"required":["perspective","orthographic"]}},"light":{"$id":"#light","type":"object","properties":{"type":{"description":"Specifies the type of the light source.","type":"string","enum":["ambient","directional","point","spot","hemisphere"]},"color":{"$ref":"#/definitions/colorRGB"},"intensity":{"type":"number","minimum":0,"default":1},"castShadow":{"type":"boolean","default":false},"point":{"type":"object","properties":{"distance":{"type":"number","minimum":0},"decay":{"type":"number","minimum":0}}},"spot":{"type":"object","properties":{"distance":{"type":"number","minimum":0},"decay":{"type":"number","minimum":0},"angle":{"type":"number","minimum":0},"penumbra":{"type":"number","minimum":0}}},"hemisphere":{"type":"object","properties":{"groundColor":{"$ref":"#/definitions/colorRGB"}}}},"required":["type"],"not":{"required":["point","spot","hemisphere"]}},"colorRGB":{"$id":"#colorRGB","type":"array","items":{"type":"number","minimum":0,"maximum":1},"minItems":3,"maxItems":3,"default":[1,1,1]}},"type":"object","properties":{"asset":{"type":"object","properties":{"type":{"type":"string","const":"application/si-dpo-3d.document+json"},"version":{"description":"Version of this presentation description.","type":"string","minLength":1},"copyright":{"description":"A copyright message to credit the content creator.","type":"string","minLength":1},"generator":{"description":"Tool that generated this presentation description.","type":"string","minLength":1}},"required":["type","version"]},"scene":{"description":"Index of the root scene of the document.","type":"integer","minimum":0},"scenes":{"description":"An array of scenes.","type":"array","items":{"$ref":"#/definitions/scene"}},"nodes":{"description":"An array of nodes.","type":"array","items":{"$ref":"#/definitions/node"},"minItems":1},"metas":{"description":"An array of meta data components.","type":"array","items":{"$ref":"./meta.schema.json"}},"setups":{"description":"An array of setup components.","type":"array","items":{"$ref":"./setup.schema.json"},"minItems":1},"cameras":{"description":"An array of camera components.","type":"array","items":{"$ref":"#/definitions/camera"},"minItems":1},"lights":{"description":"An array of light components.","type":"array","items":{"$ref":"#/definitions/light"},"minItems":1},"models":{"description":"An array of model components.","type":"array","items":{"$ref":"./model.schema.json"},"minItems":1}},"required":["asset","scene","scenes"],"additionalProperties":false}'),$p=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/common.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Math","description":"Definitions for mathematical compound objects such as vectors and matrices.","definitions":{"units":{"$id":"#units","type":"string","enum":["inherit","mm","cm","m","km","in","ft","yd","mi"]},"vector2":{"description":"2-component vector.","$id":"#vector2","type":"array","items":{"type":"number"},"minItems":2,"maxItems":2,"default":[0,0]},"vector3":{"description":"3-component vector.","$id":"#vector3","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[0,0,0]},"vector4":{"description":"4-component vector.","$id":"#vector4","type":"array","items":{"type":"number"},"minItems":4,"maxItems":4,"default":[0,0,0,0]},"matrix3":{"description":"3 by 3, matrix, storage: column-major.","$id":"#matrix3","type":"array","items":{"type":"number"},"minItems":9,"maxItems":9,"default":[1,0,0,0,1,0,0,0,1]},"matrix4":{"description":"4 by 4 matrix, storage: column-major.","$id":"#matrix4","type":"array","items":{"type":"number"},"minItems":16,"maxItems":16,"default":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},"boundingBox":{"description":"Axis-aligned 3D bounding box.","$id":"#boundingBox","type":"object","properties":{"min":{"$ref":"#/definitions/vector3"},"max":{"$ref":"#/definitions/vector3"}},"required":["min","max"]}}}'),Hp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/meta.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Meta","description":"Meta data for a scene or model item.","definitions":{"image":{"$id":"image","description":"Reference to a preview image","type":"object","properties":{"uri":{"description":"Location of the image resource, absolute URL or path relative to this document","type":"string","minLength":1},"quality":{"type":"string","enum":["Thumb","Low","Medium","High"]},"byteSize":{"type":"integer","minimum":1},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1}},"required":["uri","quality"]},"article":{"$id":"#article","description":"Reference to an external document (HTML)","type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"description":"Short title.","type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"description":"Short lead text.","type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"tags":{"description":"Array of tags, categorizing the article.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"uri":{"description":"Location of the article resource, absolute URL or path relative to this document","type":"string","minLength":1},"uris":{"description":"Location of the article resource, absolute URL or path relative to this document with language key","type":"object"},"mimeType":{"description":"MIME type of the resource.","type":"string"},"thumbnailUri":{"description":"Location of a thumbnail/preview image of the resource.","type":"string"}},"required":["id"],"additionalProperties":false},"audioclip":{"$id":"audioclip","description":"Reference to an audio file","type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"description":"Short name.","type":"string"},"uris":{"description":"Location of the audio resource, absolute URL or path relative to this document with language key","type":"object"}},"required":["id","uris"]}},"type":"object","properties":{"collection":{"description":"Information retrieved from the collection record for the item.","type":"object"},"process":{"description":"Information about how the item was processed.","type":"object"},"images":{"type":"array","items":{"$ref":"#/definitions/image"},"minItems":1},"articles":{"type":"array","items":{"$ref":"#/definitions/article"},"minItems":1},"leadArticle":{"description":"Index of the main article. This is the default article displayed with the item.","type":"integer","minimum":0},"audio":{"type":"array","items":{"$ref":"#/definitions/audioclip"},"minItems":0}},"additionalProperties":false}'),Gp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/model.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Model","description":"Describes the visual representations (models, derivatives) of a 3D item.","definitions":{"annotation":{"description":"Spatial annotation (hot spot, hot zone) on a model. Annotations can reference articles.","type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"marker":{"type":"string"},"tags":{"description":"Array of tags, categorizing the annotation.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"articleId":{"description":"Id of an article related to this annotation.","type":"string","minLength":1},"imageUri":{"description":"URI of an image resource for this annotation.","type":"string","minLength":1},"style":{"type":"string"},"visible":{"description":"Flag indicating whether the annotation is visible.","type":"boolean","default":true},"expanded":{"description":"Flag indicating whether the annotation is displayed in expanded state.","type":"boolean","default":false},"scale":{"description":"Scales the annotation relative to its default size.","type":"number","default":1},"offset":{"description":"Offsets the annotation along its direction.","type":"number","default":0},"tilt":{"description":"Tilt angle of the annotation relative to the direction vector in degrees.","type":"number","default":0},"azimuth":{"description":"Azimuth angle of a tilted annotation.","type":"number","default":0},"color":{"description":"Color of the annotation","type":"array","minItems":3,"maxItems":3,"items":{"type":"number"}},"position":{"description":"Position where the annotation is anchored, in local item coordinates.","$ref":"./common.schema.json#/definitions/vector3"},"direction":{"description":"Direction of the stem of this annotation, usually corresponds to the surface normal.","$ref":"./common.schema.json#/definitions/vector3"},"zoneIndex":{"description":"Index of the zone on the zone texture.","type":"integer","minimum":0}},"required":["id"],"additionalProperties":false},"derivative":{"description":"Visual representation derived from the master model.","type":"object","properties":{"usage":{"description":"usage categories for a derivative.","type":"string","enum":["Image2D","Web3D","App3D","iOSApp3D","Print3D","Editorial3D"]},"quality":{"type":"string","enum":["Thumb","Low","Medium","High","Highest","AR"]},"assets":{"description":"List of individual resources this derivative is composed of.","type":"array","items":{"$ref":"#/definitions/asset"}}}},"asset":{"description":"an individual resource for a 3D model.","type":"object","properties":{"uri":{"type":"string","minLength":1},"type":{"type":"string","enum":["Model","Geometry","Image","Texture","Points","Volume"]},"part":{"type":"string","minLength":1},"mimeType":{"type":"string","minLength":1},"byteSize":{"type":"integer","minimum":1},"numFaces":{"type":"integer","minimum":1},"imageSize":{"type":"integer","minimum":1},"mapType":{"type":"string","enum":["Color","Normal","Occlusion","Emissive","MetallicRoughness","Zone"]}},"required":["uri","type"]},"material":{"description":"Surface properties for this model, shared by all derivatives.","type":"object","properties":{}}},"type":"object","properties":{"units":{"$ref":"./common.schema.json#/definitions/units"},"tags":{"type":"string"},"visible":{"type":"boolean"},"renderOrder":{"type":"number"},"shadowSide":{"type":"string","enum":["Front","Back","Double"]},"derivatives":{"type":"array","items":{"$ref":"#/definitions/derivative"}},"translation":{"description":"Translation vector. Must be applied to bring model into its \'neutral\' pose.","$ref":"./common.schema.json#/definitions/vector3"},"rotation":{"description":"Rotation quaternion. Must be applied to bring model into its \'neutral\' pose.","$ref":"./common.schema.json#/definitions/vector4"},"boundingBox":{"description":"Bounding box for this model, shared by all derivatives.","$ref":"./common.schema.json#/definitions/boundingBox"},"material":{"$ref":"#/definitions/material"},"annotations":{"description":"List of annotations to be displayed with the model","type":"array","items":{"$ref":"#/definitions/annotation"}}},"required":["units","derivatives"],"additionalProperties":false}'),Wp=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/setup.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Setup","description":"Tours and settings for explorer documents (background, interface, etc.)","definitions":{"viewer":{"type":"object","properties":{"shader":{"type":"string"},"exposure":{"type":"number"},"gamma":{"type":"number"},"annotationsVisible":{"type":"boolean"},"activeTags":{"type":"string"},"sortedTags":{"type":"string"},"radioTags":{"type":"boolean"}},"required":["shader","exposure","gamma"]},"reader":{"type":"object","properties":{"enabled":{"type":"boolean"},"position":{"type":"string"},"articleId":{"description":"Id of the article currently displayed in the reader.","type":"string","minLength":1}}},"interface":{"type":"object","properties":{"visible":{"type":"boolean"},"logo":{"type":"boolean"},"menu":{"type":"boolean"},"tools":{"type":"boolean"}}},"navigation":{"type":"object","properties":{"type":{"type":"string","enum":["Orbit","Walk"]},"enabled":{"type":"boolean"},"autoZoom":{"type":"boolean"},"orbit":{"$comment":"TODO: Implement","type":"object","properties":{}},"walk":{"$comment":"TODO: Implement","type":"object","properties":{}}}},"background":{"type":"object","properties":{"style":{"type":"string","enum":["Solid","LinearGradient","RadialGradient"]},"color0":{"$ref":"./common.schema.json#/definitions/vector3"},"color1":{"$ref":"./common.schema.json#/definitions/vector3"}}},"floor":{"type":"object","properties":{"visible":{"type":"boolean"},"position":{"$ref":"./common.schema.json#/definitions/vector3"},"size":{"type":"number"},"color":{"$ref":"./common.schema.json#/definitions/vector3"},"opacity":{"type":"number"},"receiveShadow":{"type":"boolean"}}},"grid":{"type":"object","properties":{"visible":{"type":"boolean"},"color":{"$ref":"./common.schema.json#/definitions/vector3"}}},"tape":{"type":"object","properties":{"enabled":{"type":"boolean"},"startPosition":{"$ref":"./common.schema.json#/definitions/vector3"},"startDirection":{"$ref":"./common.schema.json#/definitions/vector3"},"endPosition":{"$ref":"./common.schema.json#/definitions/vector3"},"endDirection":{"$ref":"./common.schema.json#/definitions/vector3"}}},"slicer":{"type":"object","properties":{"enabled":{"type":"boolean"},"axis":{"type":"string","enum":["X","Y","Z"]},"inverted":{"type":"boolean"},"position":{"type":"number"}}},"tours":{"description":"Animated tours.","type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"tags":{"description":"Array of tags, categorizing the tour.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"steps":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"id":{"type":"string"}}}}}}},"snapshots":{"description":"Snapshots are animatable scene states.","type":"object","properties":{"features":{"type":"array","items":{"type":"string"}},"targets":{"type":"array","items":{"type":"string"}},"states":{"type":"array","items":{"type":"object"}}}}},"type":"object","properties":{"units":{"$ref":"./common.schema.json#/definitions/units"},"interface":{"$ref":"#/definitions/interface"},"viewer":{"$ref":"#/definitions/viewer"},"reader":{"$ref":"#/definitions/reader"},"navigation":{"$ref":"#/definitions/navigation"},"background":{"$ref":"#/definitions/background"},"floor":{"$ref":"#/definitions/floor"},"grid":{"$ref":"#/definitions/grid"},"tape":{"$ref":"#/definitions/tape"},"slicer":{"$ref":"#/definitions/slicer"},"tours":{"$ref":"#/definitions/tours"}}}');new Ve;class qp extends $d{constructor(e,t){super(e,t),this.ins=this.addInputs(qp.pointLightIns),this.object3D=new hl}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return n.position.changed&&(t.position.fromArray(n.position.value),t.updateMatrix()),(n.distance.changed||n.decay.changed)&&(t.distance=n.distance.value,t.decay=n.decay.value),t.updateMatrix(),!0}}qp.typeName="CPointLight",qp.pointLightIns={position:w("Light.Position"),distance:b("Light.Distance"),decay:b("Light.Decay",1)};class Xp extends qp{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.distance,this.ins.decay,this.ins.shadowEnabled,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if("point"!==n.type)throw new Error("light type mismatch: not a point light");return n.point=n.point||{},i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,distance:n.point.distance||i.distance.schema.preset,decay:void 0!==n.point.decay?n.point.decay:i.decay.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowResolution:void 0!==n.shadowResolution&&Bd[n.shadowResolution]||1,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,point:{distance:n.distance.value,decay:n.decay.value},type:"point"};n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=Bd[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}Xp.typeName="CVPointLight",Xp.text="Point Light",Xp.icon="bulb";class Yp extends $d{constructor(e,t){super(e,t),this.ins=this.addInputs(Yp.spotLightIns),this.object3D=new dl,this.light.target.matrixAutoUpdate=!1}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return(n.position.changed||n.target.changed)&&(t.position.fromArray(n.position.value),t.target.position.fromArray(n.target.value),t.updateMatrix(),t.target.updateMatrix()),(n.distance.changed||n.decay.changed||n.angle.changed||n.penumbra.changed)&&(t.distance=n.distance.value,t.decay=n.decay.value,t.angle=n.angle.value*Re,t.penumbra=n.penumbra.value),!0}onAddToParent(e){super.onAddToParent(e),e.add(this.light.target)}onRemoveFromParent(e){super.onRemoveFromParent(e),e.remove(this.light.target)}}Yp.typeName="CSpotLight",Yp.spotLightIns={position:w("Light.Position"),target:w("Light.Target",[0,-1,0]),distance:b("Light.Distance"),decay:b("Light.Decay",1),angle:b("Light.Angle",45),penumbra:_("Light.Penumbra",.5)};class Kp extends Yp{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.distance,this.ins.decay,this.ins.angle,this.ins.penumbra,this.ins.shadowEnabled,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if("spot"!==n.type)throw new Error("light type mismatch: not a spot light");return n.spot=n.spot||{},i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,target:i.target.schema.preset,distance:n.spot.distance||i.distance.schema.preset,decay:void 0!==n.spot.decay?n.spot.decay:i.decay.schema.preset,angle:void 0!==n.spot.angle?n.spot.angle:i.angle.schema.preset,penumbra:n.spot.penumbra||i.penumbra.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowResolution:void 0!==n.shadowResolution&&Bd[n.shadowResolution]||1,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,spot:{distance:n.distance.value,decay:n.decay.value,angle:n.angle.value,penumbra:n.penumbra.value},type:"spot"};n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=Bd[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}Kp.typeName="CVSpotLight",Kp.text="Spot Light",Kp.icon="bulb";class Jp extends B{get transform(){return this.components.get(Ms)}get meta(){return this.components.get(Nh,!0)}get model(){return this.components.get(Zd,!0)}get camera(){return this.components.get(sp,!0)}get light(){return this.components.get($d,!0)}get scene(){return this.components.get(op,!0)}createComponents(){this.name="Node",this.createComponent(Ms)}createModel(){this.name="Model",this.createComponent(Nh),this.createComponent(Zd)}fromDocument(e,t,n){const i=e.nodes[t];this.transform.fromData(i),n.set(`node/${t}`,this.transform);let s="Node";if(isFinite(i.meta)&&(this.createComponent(Nh).fromDocument(e,i),n.set(`meta/${i.meta}`,this.meta),s="Meta"),isFinite(i.model)&&(this.createComponent(Zd).fromDocument(e,i),n.set(`model/${i.model}`,this.model),s="Model"),isFinite(i.camera)&&(this.createComponent(sp).fromDocument(e,i),n.set(`camera/${i.camera}`,this.camera),s="Camera"),isFinite(i.light)){const t=e.lights[i.light].type;switch(t){case"directional":this.createComponent(hp).fromDocument(e,i),s="Directional Light";break;case"point":this.createComponent(Xp).fromDocument(e,i),s="Point Light";break;case"spot":this.createComponent(Kp).fromDocument(e,i),s="Spot Light";break;default:throw new Error(`unknown light type: '${t}'`)}n.set(`light/${i.light}`,this.light)}this.name=i.name||s;const r=i.children;r&&r.forEach((t=>{const i=this.graph.createCustomNode(Jp);this.transform.addChild(i.transform),i.fromDocument(e,t,n)}))}toDocument(e,t,n){n=n||{meta:!0,setup:!0,model:!0,camera:!0,light:!0},e.nodes=e.nodes||[];const i=e.nodes.length,s=this.transform.toData();e.nodes.push(s),t.set(this.transform,`node/${i}`),this.name&&(s.name=this.name),this.model&&n.model&&(s.model=this.model.toDocument(e,s),t.set(this.model,`model/${s.model}`)),this.camera&&n.camera&&(s.camera=this.camera.toDocument(e,s),t.set(this.camera,`camera/${s.camera}`)),this.light&&n.light&&(s.light=this.light.toDocument(e,s),t.set(this.light,`light/${s.light}`)),this.meta&&n.meta&&(s.meta=this.meta.toDocument(e,s),t.set(this.meta,`info/${s.meta}`));const r=this.transform.children.map((e=>e.node)).filter((e=>e.is(Jp)));return r.forEach((i=>{if(i.hasNodeComponents(n)){const r=i.toDocument(e,t,n);s.children=s.children||[],s.children.push(r)}})),i}hasNodeComponents(e){if(!e)return!0;const t=this.transform,n=this.components;return!(!e.model||!n.has(Zd)&&!t.hasChildComponents(Zd,!0))||(!(!e.camera||!n.has(sp)&&!t.hasChildComponents(sp,!0))||!(!e.light||!n.has($d)&&!t.hasChildComponents($d,!0)))}}Jp.typeName="NVNode";class Zp extends Jp{get setup(){return this.components.get(qd,!0)}createComponents(){this.createComponent(op),this.createComponent(qd),this.createComponent(Nh)}fromDocument(e,t,n){const i=e.scenes[t];i.name&&(this.name=i.name),this.scene.fromDocument(e,i),isFinite(i.meta)&&(this.meta.fromDocument(e,i),n.set(`meta/${i.meta}`,this.meta)),isFinite(i.setup)&&this.setup.fromDocument(e,t,n);const s=i.nodes;s&&s.forEach((t=>{const i=this.graph.createCustomNode(Jp);this.transform.addChild(i.transform),i.fromDocument(e,t,n)}))}toDocument(e,t,n){e.scenes=e.scenes||[];const i=e.scenes.length,s={units:"cm"};e.scenes.push(s),this.name&&(s.name=this.name),this.scene.toDocument(e,s);return this.transform.children.map((e=>e.node)).filter((e=>e.is(Jp))).forEach((i=>{if(i.hasNodeComponents(n)){const r=i.toDocument(e,t,n);s.nodes=s.nodes||[],s.nodes.push(r)}})),n&&!n.setup||(this.meta&&(s.meta=this.meta.toDocument(e,s),t.set(this.meta,`meta/${s.meta}`)),this.setup&&this.setup.toDocument(e,i,t)),i}}Zp.typeName="NVScene";class Qp extends Vp{constructor(e,t){super(e,t),this.titles={},this.meta=null,this.ins=this.addInputs(Qp.ins),this.outs=this.addOutputs(Qp.outs),this.innerGraph.createCustomNode(Zp),this.ins.active.setValue(!1),this.ins.visible.setValue(!1)}get root(){return this.innerNodes.get(Zp)}get setup(){return this.innerComponents.get(qd)}get assetPath(){return this.outs.assetPath.value}get assetBaseName(){let e=this.assetPath;const t=e.indexOf(".svx.json");return t>=0&&(e=e.substr(0,t)),e}get analytics(){return this.getMainComponent(Dh)}create(){super.create(),this.innerGraph.components.on(Nh,this.onMetaComponent,this),this.setup.language.outs.language.on("value",this.updateTitle,this)}dispose(){this.setup.language.outs.language.off("value",this.updateTitle,this),this.innerGraph.components.off(Nh,this.onMetaComponent,this),super.dispose()}update(e){super.update(e);const{ins:t,outs:n}=this;if(t.dumpJson.changed){const e=this.deflateDocument();console.log("-------------------- VOYAGER DOCUMENT --------------------"),console.log(JSON.stringify(e,((e,t)=>"number"==typeof t?parseFloat(t.toFixed(5)):t),2))}if(t.dumpTree.changed&&(console.log("-------------------- VOYAGER DOCUMENT --------------------"),this.dump()),t.download.changed){const e=n.assetPath.value.split("/").pop()||"voyager-document.json";Up(this.deflateDocument(),e)}if(t.title.changed&&this.titles){const e=this.setup.language;t.title.setValue(t.title.value,!0),n.title.setValue(t.title.value),t.title.value&&(this.titles[vs[e.outs.language.value]]=t.title.value,this.updateTitlesMeta())}return!0}clearNodeTree(){this.root.transform.children.slice().forEach((e=>e.node.dispose()))}openDocument(e,t,n){if(!Qp.validator.validate(e))throw new Error("document schema validation failed");n||(this.clearNodeTree(),this.ins.title.setValue(null)),this.onMetaComponent({type:"CVMeta",object:this.root.meta,add:!0,remove:!1});let i="object"==typeof n?n:this.root;if(i.graph!==this.innerGraph)throw new Error("invalid parent node");const s=new Map;if(i instanceof Zp)i.fromDocument(e,e.scene,s);else{e.scenes[e.scene].nodes.forEach((t=>{const n=this.innerGraph.createCustomNode(Jp);i.transform.addChild(n.transform),n.fromDocument(e,t,s)}))}t&&(this.outs.assetPath.setValue(t),this.name=this.getMainComponent(Ch).getAssetName(t))}appendModel(e,t,n){if(n&&n.graph!==this.innerGraph)throw new Error("invalid parent node");if(this.isEmpty())throw new Error("empty document, can't append model");n=n||this.root;const i=this.innerGraph.createCustomNode(Jp);n.transform.addChild(i.transform),i.createModel();const s=i.model;return s.derivatives.createModelAsset(e,t),s}appendGeometry(e,t,n,i,s,r){if(r&&r.graph!==this.innerGraph)throw new Error("invalid parent node");if(this.isEmpty())throw new Error("empty document, can't append geometry");r=r||this.root;const o=this.innerGraph.createCustomNode(Jp);r.transform.addChild(o.transform),o.createModel();o.model.derivatives.createMeshAsset(e,t,n,i,s)}deflateDocument(e){if(this.isEmpty())throw new Error("empty document, can't serialize");const t={asset:{type:Qp.mimeType,version:Qp.version,generator:"Voyager",copyright:"(c) Smithsonian Institution. All rights reserved."},scene:0,scenes:[]},n=new Map;return t.scene=this.root.toDocument(t,n,e),t}onMetaComponent(e){const t=e.object,n=this.ins.title,i=this.setup.language;null===this.meta&&(this.meta=t),e.add&&!n.value&&t.once("load",(()=>{this.titles=t.collection.get("titles")||{},0===Object.keys(this.titles).length&&(this.titles[vs[i.outs.language.value]]=t.collection.get("title")||"",t.collection.dictionary.titles=this.titles);const e=this.titles[vs[i.outs.language.value]];n.setValue(e),this.analytics.setTitle(e),this.meta=t}))}updateTitle(){const e=this.setup.language,t=this.titles[vs[e.outs.language.value]];this.ins.title.setValue(t)}updateTitlesMeta(){const e=this.meta;e&&(e.collection.dictionary.titles=this.titles)}}Qp.typeName="CVDocument",Qp.mimeType="application/si-dpo-3d.document+json",Qp.version="1.0",Qp.validator=new class{constructor(){this._schemaValidator=new(Bp())({schemas:[jp,$p,Hp,Gp,Wp],allErrors:!0}),this._validateDocument=this._schemaValidator.getSchema("https://schemas.3d.si.edu/voyager/document.schema.json")}validate(e){return!!this._validateDocument(e)||(console.warn(this._schemaValidator.errorsText(this._validateDocument.errors,{separator:", ",dataVar:"document"})),!1)}},Qp.ins={dumpJson:D("Document.DumpJSON"),dumpTree:D("Document.DumpTree"),download:D("Document.Download"),title:A("Document.Title")},Qp.outs={assetPath:P("Asset.Path",{preset:"scene.svx.json"}),title:A("Document.Title")};class em extends Tp{constructor(e,t){super(e,t),this.outs=this.addOutputs(em.outs),this.scope=Mp.Node}createDocument(e,t){const n=this.node.createComponent(Qp);return this.activeComponent=n,e&&n.openDocument(e,t),n}amendDocument(e,t,n){const i=this.activeComponent;if(!i)throw new Error("no active document, can't amend");return i.openDocument(e,t,n),i}refreshDocument(){this.emit({type:"active-component",previous:null,next:this.activeComponent})}appendModel(e,t){const n=this.activeComponent;if(!n)throw new Error("no active document, can't append model");return n.appendModel(e,t),n}appendGeometry(e,t,n,i,s){const r=this.activeComponent;if(!r)throw new Error("no active document, can't append geometry");return r.appendGeometry(e,t,n,i,s),r}removeActiveDocument(){const e=this.activeComponent;e&&e.dispose()}activateComponent(e){e.ins.visible.setValue(!0),e.ins.active.setValue(!0)}deactivateComponent(e){e.ins.visible.setValue(!1),e.ins.active.setValue(!1)}onActiveComponent(e,t){this.outs.activeDocument.setValue(t)}onScopedComponents(){this.outs.changedDocuments.set()}}em.typeName="CVDocumentProvider",em.componentType=Qp,em.outs={activeDocument:N("Documents.Active",Qp),changedDocuments:D("Documents.Changed")};class tm extends j{constructor(){super(...arguments),this.ins=this.addInputs(tm.ins)}get model(){return this.getComponent(Zd)}update(e){return!0}}tm.typeName="CVAnnotations",tm.ins={};class nm extends B{get pulse(){return this.components.get(Ee)}get renderer(){return this.components.get(Ae)}get fullscreen(){return this.components.get($)}get selection(){return this.components.get(kp)}get assetManager(){return this.components.get(Ch)}get assetReader(){return this.components.get(Rh)}get analytics(){return this.components.get(Dh)}get arManager(){return this.components.get(gp)}createComponents(){this.createComponent(Ee),this.createComponent(Ae),this.createComponent($),this.createComponent(Ch),this.createComponent(Rh),this.createComponent(Dh),this.createComponent(gp);this.createComponent(kp).ins.viewportBrackets.setValue(!1)}}nm.typeName="NVEngine";class im extends Cp{constructor(e,t){super(e,t),this.outs=this.addOutputs(im.outs),this.scope=Ep.Graph}get documentProvider(){return this.getComponent(em)}create(){super.create(),this.documentProvider.on("active-component",this.onActiveDocument,this)}dispose(){this.documentProvider.off("active-component",this.onActiveDocument,this),super.dispose()}onActiveDocument(e){this.scopedGraph=e.next}onActiveNode(e,t){this.outs.activeNode.setValue(t);const n=this.selection;t?n.nodeContainsSelectedComponent(t)||n.selectNode(t):e&&n.clearSelection()}onScopedNodes(){this.outs.changedNodes.set()}}im.typeName="CVNodeProvider",im.nodeType=Jp,im.followComponentSelection=!0,im.outs={activeNode:N("Nodes.Active",Jp),changedNodes:D("Nodes.Changed")};class sm extends B{get scene(){return this.components.get(Io)}get documentProvider(){return this.components.get(em)}get nodeProvider(){return this.components.get(im)}createComponents(){this.createComponent(Io,"Master Scene"),this.createComponent(em),this.createComponent(im)}}sm.typeName="NVDocuments";const rm=[xt,Ee,Tp,Cp,Fd,Ae,$,kp,Io,B,Dh,gp,Ch,Rh,Qp,em,op,qd,Ms,Nh,Zd,tm,Tu,sp,hp,Xp,Kp,Ru,Lu,Oh,od,dd,bd,Ed,Dd,Id,Gd,Hd,Au,Lh,Wd,nm,sm,Zp,Jp];class om extends j{constructor(){super(...arguments),this.activeDocument=null}get documentProvider(){return this.getGraphComponent(em)}startObserving(){const e=this.documentProvider;e.on("active-component",this.onActiveDocumentEvent,this),e.activeComponent&&(this.activeDocument=e.activeComponent,this.onActiveDocument(null,e.activeComponent))}stopObserving(){const e=this.documentProvider;e.off("active-component",this.onActiveDocumentEvent,this),e.activeComponent&&(this.activeDocument=null,this.onActiveDocument(e.activeComponent,null))}onActiveDocument(e,t){}onActiveDocumentEvent(e){this.activeDocument=e.next,this.onActiveDocument(e.previous,e.next)}}om.typeName="CVDocumentObserver";class am extends om{constructor(){super(...arguments),this.activeNode=null}get nodeProvider(){return this.getGraphComponent(im)}startObserving(){super.startObserving();const e=this.nodeProvider;e.on("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=e.activeNode,this.onActiveNode(null,e.activeNode))}stopObserving(){const e=this.nodeProvider;e.off("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=null,this.onActiveNode(e.activeNode,null)),super.stopObserving()}onActiveNode(e,t){}onActiveNodeEvent(e){this.activeNode=e.next,this.onActiveNode(e.previous,e.next)}}am.typeName="CVNodeObserver";var lm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class cm extends Zr{constructor(e){super(),this.system=e}}lm([Or({attribute:!1})],cm.prototype,"system",void 0);class hm extends cm{constructor(){super(...arguments),this.activeDocument=null}get documentProvider(){return this.system.getMainComponent(em)}connected(){const e=this.documentProvider;e.on("active-component",this.onActiveDocumentEvent,this);const t=e.activeComponent;t&&(this.activeDocument=t,this.onActiveDocument(null,t))}disconnected(){this.documentProvider.off("active-component",this.onActiveDocumentEvent,this);const e=this.activeDocument;e&&(this.activeDocument=null,this.onActiveDocument(e,null))}onActiveDocument(e,t){}onActiveDocumentEvent(e){this.activeDocument=e.next,this.onActiveDocument(e.previous,e.next)}}class um extends hm{constructor(){super(...arguments),this.activeNode=null}get nodeProvider(){return this.system.getMainComponent(im)}connected(){super.connected();const e=this.nodeProvider;e.on("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=e.activeNode,this.onActiveNode(null,e.activeNode))}disconnected(){const e=this.nodeProvider;e.off("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=null,this.onActiveNode(e.activeNode,null)),super.disconnected()}onActiveNode(e,t){this.requestUpdate()}onActiveNodeEvent(e){this.activeNode=e.next,this.onActiveNode(e.previous,e.next)}}var dm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class pm extends am{constructor(){super(...arguments),this.ins=this.addInputs(pm.toolIns),this.outs=this.addOutputs(pm.toolOuts),this._isActiveTool=!1}get isActiveTool(){return this._isActiveTool}dispose(){this._isActiveTool&&this.deactivateTool(),super.dispose()}createView(){throw new Error("must override")}activateTool(){this._isActiveTool=!0,this.startObserving()}deactivateTool(){this.stopObserving(),this._isActiveTool=!1}}pm.typeName="CVTool",pm.toolIns={},pm.toolOuts={};class mm extends um{constructor(e){super(e.system),this.tool=null,this.needsFocus=!1,this.tool=e}get analytics(){return this.system.getMainComponent(Dh)}firstConnected(){this.classList.add("sv-group","sv-tool-view"),this.needsFocus=!0}connected(){super.connected(),this.tool.on("update",this.onUpdate,this)}disconnected(){this.tool.off("update",this.onUpdate,this),super.disconnected()}updated(e){super.updated(e),this.needsFocus&&(this.setFocus(),this.needsFocus=!1)}setFocus(){}}dm([Or({attribute:!1})],mm.prototype,"tool",void 0);class fm extends Tp{constructor(e,t){super(e,t),this.ins=this.addInputs(fm.ins),this.scope=Mp.Node}get analytics(){return this.getMainComponent(Dh)}update(e){return this.ins.visible.changed,!0}activateComponent(e){e.activateTool(),this.analytics.sendProperty("Tools.ActiveTool",e.text)}deactivateComponent(e){e.deactivateTool()}onActiveComponent(e,t){}}fm.typeName="CVToolProvider",fm.isSystemSingleton=!0,fm.componentType=pm,fm.ins={visible:C("Tools.Visible"),closed:D("Tools.Closed")};var gm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let vm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.options=null,this.indexMap=null,this.language=null}firstConnected(){this.classList.add("sv-property-view","sv-property-options")}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type||!this.property.schema.options)throw new Error("not an options property");if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.indexMap,n=this.name||e.name,i=this.options||e.schema.options,s=e.value,r=this.language;let o;return o=t?t.map((e=>_r` - `)):i.map(((e,t)=>_r` - `)),_r`
this.onKeyDown(e)} title=${n} class="sv-options">${o}
`}onButtonClick(e){const t=e.target.index;this.property.setValue(t)}onKeyDown(e){if("ArrowUp"===e.code||"ArrowLeft"===e.code){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).findIndex((t=>e.target===t));n>0&&(t[n].setAttribute("tabIndex","-1"),t[n-1].setAttribute("tabIndex","0"),t[n-1].focus())}else if("ArrowDown"===e.code||"ArrowRight"===e.code){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).findIndex((t=>e.target===t));n0===e.tabIndex)),0)].focus()}tabReset(e){const t=this.getElementsByTagName("ff-button"),n=Array.from(t),i=n.findIndex((e=>0===e.tabIndex)),s=n.findIndex((e=>"true"===e.getAttribute("aria-checked")));if(i!=s){t[i].setAttribute("tabIndex","-1");t[s>-1?s:0].setAttribute("tabIndex","0")}}};gm([Or({attribute:!1})],vm.prototype,"property",void 0),gm([Or({type:String})],vm.prototype,"name",void 0),gm([Or({attribute:!1})],vm.prototype,"options",void 0),gm([Or({attribute:!1})],vm.prototype,"indexMap",void 0),gm([Or({attribute:!1})],vm.prototype,"language",void 0),vm=gm([Qr("sv-property-options")],vm);var ym=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let bm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.text="",this.icon=""}firstConnected(){this.classList.add("sv-property-view","sv-property-event")}update(e){if(!this.property)throw new Error("missing property attribute");if(!this.property.schema.event)throw new Error(`not an event property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=this.text,i=this.icon;return _r` -
- -
`}onButtonClick(e){this.property.set()}};ym([Or({attribute:!1})],bm.prototype,"property",void 0),ym([Or({type:String})],bm.prototype,"name",void 0),ym([Or({type:String})],bm.prototype,"text",void 0),ym([Or({type:String})],bm.prototype,"icon",void 0),bm=ym([Qr("sv-property-event")],bm);var xm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class _m extends pm{createView(){return new wm(this)}}_m.typeName="CVViewTool",_m.text="View",_m.icon="eye";let wm=class extends mm{firstConnected(){super.firstConnected(),this.classList.add("sv-view-tool-view")}render(){const e=this.activeDocument;if(!e)return _r``;this.tool;const t=e.setup.navigation,n=e.setup.language,i=t.ins.projection,s=t.ins.preset,r=t.ins.zoomExtents,o=[nd.Front,nd.Back,nd.Left,nd.Right,nd.Top,nd.Bottom];return _r``}onActiveDocument(e,t){this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};wm=xm([Qr("sv-view-tool-view")],wm);var Sm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class Mm extends pm{createView(){return new Em(this)}}Mm.typeName="CVRenderTool",Mm.text="Material",Mm.icon="palette";let Em=class extends mm{constructor(){super(...arguments),this.viewer=null}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-render-tool-view")}render(){this.tool;const e=this.activeDocument,t=this.viewer;if(!t)return _r``;const n=t.ins.shader,i=e.setup.language;return _r`
-
- -
-
`}onActiveDocument(e,t){this.viewer&&(this.viewer.ins.shader.off("value",this.onUpdate,this),this.viewer=null),t&&(this.viewer=t.setup.viewer,this.viewer.ins.shader.on("value",this.onUpdate,this))}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};Em=Sm([Qr("sv-render-tool-view")],Em);var Tm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class Cm extends pm{createView(){return new Am(this)}}Cm.typeName="CVEnvironmentTool",Cm.text="Environment",Cm.icon="environment";let Am=class extends mm{firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-environment-tool-view")}render(){this.tool;if(!this.activeDocument)return _r`No active document`;const e=this.activeDocument.setup,t=e.grid,n=e.floor,i=e.background,s=i.ins.style.getValidatedValue()===ad.Solid,r=e.environment,o=e.language;return _r`
-
- - - ${s?null:_r``} - - - - - -
-
`}onActiveDocument(e,t){if(e){e.setup.background.ins.style.off("value",this.onUpdate,this)}if(t){t.setup.background.ins.style.on("value",this.onUpdate,this)}this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};Am=Tm([Qr("sv-environment-tool-view")],Am);var Pm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Rm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.text=null,this.language=null,this.disabled=!1,this.customLabelStyle=""}firstConnected(){this.classList.add("sv-property-view","sv-property-boolean")}update(e){if(!this.property)throw new Error("missing property attribute");if("boolean"!==this.property.type)throw new Error("not a boolean property");if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=t.replace(/\s/g,""),i=this.text,s=this.language,r=this.customLabelStyle;let o=e.value?Array.isArray(i)?i[1]:i||"On":Array.isArray(i)?i[0]:i||"Off";return _r` - `}onButtonClick(e){this.property.setValue(!this.property.value)}};Pm([Or({attribute:!1})],Rm.prototype,"property",void 0),Pm([Or({type:String})],Rm.prototype,"name",void 0),Pm([Or({attribute:!1})],Rm.prototype,"text",void 0),Pm([Or({attribute:!1})],Rm.prototype,"language",void 0),Pm([Or({type:Boolean})],Rm.prototype,"disabled",void 0),Pm([Or({type:String})],Rm.prototype,"customLabelStyle",void 0),Rm=Pm([Qr("sv-property-boolean")],Rm);class Lm{constructor(e){this.isEnabled=!0,this._isDragging=!1,this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this.target=e,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),e.addEventListener("pointercancel",this.onPointerUp)}get isDragging(){return this._isDragging}get startX(){return this._startX}get startY(){return this._startY}onPointerDown(e){e.isPrimary&&this.isEnabled&&(this._isDragging=!0,this._startX=this._lastX=e.clientX,this._startY=this._lastY=e.clientY,this.target.setPointerCapture(e.pointerId),this.target.dragStart(e)),e.stopPropagation(),e.preventDefault()}onPointerMove(e){if(e.isPrimary&&this._isDragging){const t=e.clientX-this._lastX;this._lastX=e.clientX;const n=e.clientY-this._lastY;this._lastY=e.clientY,this.target.dragMove(e,t,n)}e.stopPropagation(),e.preventDefault()}onPointerUp(e){this._isDragging&&e.isPrimary&&(this.target.dragEnd(e),this.target.releasePointerCapture(e.pointerId),this._isDragging=!1),e.stopPropagation(),e.preventDefault()}}var Nm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Dm=class extends Zr{constructor(){super(),this.direction="horizontal",this.value=0,this._isVertical=!1,this._offsetX=0,this._offsetY=0,this._knob=(new Zr).addClass("ff-knob").setStyle({display:"block",position:"relative "}),new Lm(this)}dragStart(e){const t=this._knob,n=this.getBoundingClientRect();e.target===this._knob?(this._offsetX=e.clientX-t.offsetLeft+.5*(t.clientWidth-t.offsetWidth),this._offsetY=e.clientY-t.offsetTop+.5*(t.clientHeight-t.offsetHeight)):(this._offsetX=n.left+.8*t.clientWidth,this._offsetY=n.top+.8*t.clientHeight),this.dragMove(e)}dragMove(e){const t=this._knob,n=e.clientX-this._offsetX,i=e.clientY-this._offsetY;let s=this._isVertical?1-i/(this.clientHeight-t.clientHeight):n/(this.clientWidth-t.clientWidth);s=vt.limit(s,0,1),s!==this.value&&(this.value=s,this.emitChangeEvent(!0))}dragEnd(){this.emitChangeEvent(!1)}firstConnected(){this.setStyle({position:"relative",touchAction:"none"}),this.setAttribute("touch-action","none"),this.setAttribute("tabindex","0"),this.classList.add("ff-control","ff-linear-slider"),this.appendChild(this._knob)}update(e){if(e.has("direction")&&(this._isVertical="vertical"===this.direction,this.setClass("ff-horizontal",!this._isVertical),this.setClass("ff-vertical",this._isVertical)),e.has("value")){const e=vt.limit(this.value,0,1),t=this._isVertical?0:100*e,n=this._isVertical?100*(1-e):0;this._knob.style.left=`${t.toFixed(3)}%`,this._knob.style.top=`${n.toFixed(3)}%`}super.update(e)}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,isDragging:e},bubbles:!0}))}};Nm([Or({type:String})],Dm.prototype,"direction",void 0),Nm([Or({type:Number})],Dm.prototype,"value",void 0),Dm=Nm([Qr("ff-linear-slider")],Dm);const Om=Dm;var Im=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let km=class extends Zr{constructor(){super(...arguments),this.property=null,this.name="",this.min=void 0,this.max=void 0}firstConnected(){super.firstConnected(),this.classList.add("sv-property-view","sv-property-slider")}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type)throw new Error(`not a number property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=e.getValidatedValue(),i=isFinite(this.min)?this.min:e.schema.min,s=isFinite(this.max)?this.max:e.schema.max,r=(n-i)/(s-i);return _r` - `}onSliderChange(e){const t=this.property,n=isFinite(this.min)?this.min:t.schema.min,i=isFinite(this.max)?this.max:t.schema.max,s=n+e.detail.value*(i-n);t.setValue(s)}onKeyDown(e){const t=this.property;"ArrowRight"===e.code||"ArrowUp"===e.code||"PageUp"===e.code?t.setValue(this.clamp("PageUp"===e.code?t.value+.1:t.value+.01)):"ArrowLeft"!==e.code&&"ArrowDown"!==e.code&&"PageDown"!==e.code||t.setValue(this.clamp("PageDown"===e.code?t.value-.1:t.value-.01))}clamp(e){const t=this.property,n=isFinite(this.min)?this.min:t.schema.min,i=isFinite(this.max)?this.max:t.schema.max;return Math.min(Math.max(e,n),i)}};Im([Or({attribute:!1})],km.prototype,"property",void 0),Im([Or({type:String})],km.prototype,"name",void 0),Im([Or({type:Number})],km.prototype,"min",void 0),Im([Or({type:Number})],km.prototype,"max",void 0),km=Im([Qr("sv-property-slider")],km);var zm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Um=class extends Zr{constructor(){super(...arguments),this.name="",this.index=0,this.text="",this.placeholder="",this.align="left",this.initialValue="",this.requestFocus=!1}get inputElement(){return this.getElementsByTagName("input").item(0)}focus(){this.requestFocus=!0,this.performUpdate()}hasFocus(){const e=document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement;return this.inputElement===e}firstConnected(){this.classList.add("ff-control","ff-line-edit")}shouldUpdate(e){return!this.hasFocus()&&super.shouldUpdate(e)}render(){return _r``}updated(){this.requestFocus&&(this.requestFocus=!1,this.inputElement.focus())}onKeyDown(e){const t=e.target;"Enter"===e.key?(this.commit(t),t.blur()):"Escape"===e.key&&(this.revert(t),t.blur())}onChange(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!1)}onInput(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!0)}onFocus(e){this.initialValue=e.target.value,e.target.select()}onBlur(e){this.commit(e.target),this.requestUpdate()}revert(e){e.value=this.initialValue,this.dispatchChangeEvent(e.value,!1)}commit(e){this.initialValue=e.value,this.dispatchChangeEvent(e.value,!1)}dispatchChangeEvent(e,t){this.dispatchEvent(new CustomEvent("change",{detail:{text:e,isEditing:t}}))}};zm([Or({type:String})],Um.prototype,"name",void 0),zm([Or({type:Number})],Um.prototype,"index",void 0),zm([Or({type:String})],Um.prototype,"text",void 0),zm([Or({type:String})],Um.prototype,"placeholder",void 0),zm([Or({type:String})],Um.prototype,"align",void 0),Um=zm([Qr("ff-line-edit")],Um);var Vm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Fm=class extends Zr{constructor(){super(),this.value=new zh,this._offsetX=0,this._offsetY=0,this._knob=(new Zr).addClass("ff-knob").setStyle({display:"block",position:"relative "}),new Lm(this)}setXY(e,t){this.value.set(e,t),this.requestUpdate()}dragStart(e){const t=this._knob,n=this.getBoundingClientRect();e.target===this._knob?(this._offsetX=e.clientX-t.offsetLeft+.5*(t.clientWidth-t.offsetWidth),this._offsetY=e.clientY-t.offsetTop+.5*(t.clientHeight-t.offsetHeight)):(this._offsetX=n.left+.8*t.clientWidth,this._offsetY=n.top+.8*t.clientHeight),this.dragMove(e)}dragMove(e){const t=this._knob,n=e.clientX-this._offsetX,i=e.clientY-this._offsetY;let s=n/(this.clientWidth-t.clientWidth);s=vt.limit(s,0,1);let r=1-i/(this.clientHeight-t.clientHeight);r=vt.limit(r,0,1),s===this.value.x&&r===this.value.y||(this.value=this.value.set(s,r),this.emitChangeEvent(!0))}dragEnd(){this.emitChangeEvent(!1)}firstConnected(){this.setStyle({position:"relative",touchAction:"none"}),this.setAttribute("touch-action","none"),this.setAttribute("tabindex","0"),this.classList.add("ff-control","ff-vector-slider"),this.appendChild(this._knob)}update(e){const t=100*this.value.x,n=100*(1-this.value.y);this._knob.style.left=`${t.toFixed(3)}%`,this._knob.style.top=`${n.toFixed(3)}%`,super.update(e)}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,isDragging:e},bubbles:!0}))}};Vm([Or({attribute:!1})],Fm.prototype,"value",void 0),Fm=Vm([Qr("ff-vector-slider")],Fm);const Bm=Fm;var jm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const $m=new Fh;let Hm=class extends Zr{constructor(){super(),this.color=new Fh,this.alpha=!1,this.numeric=!1,this.onLumSatChange=this.onLumSatChange.bind(this),this.onHueChange=this.onHueChange.bind(this),this.onAlphaChange=this.onAlphaChange.bind(this),this.addEventListener("click",(e=>e.stopPropagation())),this._hsv=new Uh,this._lumSatSlider=(new Bm).on("change",this.onLumSatChange),this._hueSlider=(new Om).addClass("ff-hue-slider").on("change",this.onHueChange),this._hueSlider.direction="vertical"}firstConnected(){this.classList.add("ff-flex-column","ff-control","ff-color-edit")}update(e){e.has("color")&&this.color.toHSV(this._hsv),e.has("alpha")&&(this.alpha&&!this._alphaSlider?(this._alphaSlider=(new Om).addClass("ff-alpha-slider").on("change",this.onAlphaChange),this._alphaSlider.direction="vertical"):!this.alpha&&this._alphaSlider&&this._alphaSlider.remove()),super.update(e)}render(){let e=null;if(this.numeric){const t=this.color,n=t.toString(!1).substr(1),i=this.alpha?_r` -
A
- `:null;e=_r`
-
R
-
G
-
B
- ${i} -
#
-
`}return _r`
- ${this._lumSatSlider}${this._hueSlider}${this._alphaSlider} -
${e}`}updated(){this._hueSlider.value=1-this._hsv.x/360;const e=`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, ${$m.setHSV(this._hsv.x).toString(!1)})`;if(this._lumSatSlider.style.backgroundImage=e,this._lumSatSlider.setXY(this._hsv.y,this._hsv.z),this.alpha){const e=this.color.toString(!1),t=getComputedStyle(this._alphaSlider).color,n=`linear-gradient(to top, transparent, ${e}), repeating-linear-gradient(-45deg, transparent, transparent 8px, ${t} 8px, ${t} 16px)`;this._alphaSlider.style.backgroundImage=n,this._alphaSlider.value=this.color.alpha}}onLumSatChange(e){e.stopPropagation();const t=e.detail.value;this._hsv.y=t.x,this._hsv.z=t.y,this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onHueChange(e){e.stopPropagation(),this._hsv.x=360*(1-e.target.value),this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onAlphaChange(e){e.stopPropagation(),this.color.alpha=e.target.value,this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onNumericEdit(e){e.stopPropagation();const t=e.target.name;if("string"===t)this.color.setString(e.detail.text,1,!1);else{let n=parseInt(e.detail.text);if(!isFinite(n))return;this.color[t]=vt.limit(n,0,255)}this.color.toHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isEditing)}onKeyDown(e){const t="ArrowRight"===e.code||"ArrowUp"===e.code,n="PageUp"===e.code,i="ArrowLeft"===e.code||"ArrowDown"===e.code,s="PageDown"===e.code;if(t||n||i||s)if(e.target===this._hueSlider||e.target===this._alphaSlider){const s=t||n?-1:1,r=t||i?.01:.1;e.target===this._hueSlider?(this._hsv.x=vt.limit(this._hsv.x+360*r*s,0,360),this.color.setHSV(this._hsv)):this.color.alpha=vt.limit(this.color.alpha+r*s,0,1),this.requestUpdate(),this.emitChangeEvent(!1)}else if(e.target===this._lumSatSlider&&(t||i)){const n=t?1:-1,i=e.shiftKey?.1:.01;"ArrowRight"===e.code||"ArrowLeft"===e.code?this._hsv.y=vt.limit(this._hsv.y+i*n,0,1):this._hsv.z=vt.limit(this._hsv.z+i*n,0,1),this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(!1)}}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{color:this.color,isDragging:e},bubbles:!0}))}};jm([Or({attribute:!1})],Hm.prototype,"color",void 0),jm([Or({type:Boolean})],Hm.prototype,"alpha",void 0),jm([Or({type:Boolean})],Hm.prototype,"numeric",void 0),Hm=jm([Qr("ff-color-edit")],Hm);function Gm(e){return[...e.querySelectorAll('a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden")&&"-1"!==e.getAttribute("tabindex")))}function Wm(e,t){const n=e[0],i=e[e.length-1];t.shiftKey?t.target===n&&(t.preventDefault(),i.focus()):t.target===i&&(t.preventDefault(),n.focus())}var qm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Xm=class extends Zr{constructor(){super(),this.property=null,this.name="",this.color=new Fh,this.pickerActive=!1,this.onPointerDown=this.onPointerDown.bind(this)}firstConnected(){super.firstConnected(),this.classList.add("sv-property-view","sv-property-color")}connected(){document.addEventListener("pointerdown",this.onPointerDown,{capture:!0,passive:!0})}disconnected(){document.removeEventListener("pointerdown",this.onPointerDown)}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type||3!==this.property.elementCount)throw new Error(`not an color property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onPropertyChange,this),this.property&&(this.property.on("value",this.onPropertyChange,this),this.color.fromArray(this.property.value))}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=this.color.toString();return _r` - - ${this.pickerActive?_r`this.onKeyDown(e)} @change=${this.onColorEditChange}>`:null}`}async setPickerFocus(){await this.updateComplete;Gm(this.getElementsByTagName("ff-color-edit").item(0))[0].focus()}onButtonClick(e){this.pickerActive=!this.pickerActive,this.requestUpdate(),this.pickerActive&&this.setPickerFocus()}onColorEditChange(e){this.property.setValue(e.detail.color.toRGBArray())}onPropertyChange(e){this.color.fromArray(e),this.requestUpdate()}onPointerDown(e){this.pickerActive&&(e.composedPath()[0]instanceof Node&&this.contains(e.composedPath()[0])||(this.pickerActive=!1,this.requestUpdate()))}onKeyDown(e){if("Escape"===e.code)e.preventDefault(),e.stopPropagation(),this.pickerActive=!1,this.requestUpdate(),this.getElementsByTagName("ff-button")[0].focus();else if("Tab"===e.code){Wm(Gm(this.getElementsByTagName("ff-color-edit")[0]),e)}}};qm([Or({attribute:!1})],Xm.prototype,"property",void 0),qm([Or({type:String})],Xm.prototype,"name",void 0),Xm=qm([Qr("sv-property-color")],Xm);var Ym=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class Km extends pm{constructor(){super(...arguments),this.lights=[],this.ins=this.addInputs(Km.ins),this.outs=this.addOutputs(Km.outs)}update(e){return this.outs.light.setValue(this.lights[this.ins.light.getValidatedValue()]),!0}createView(){return new Jm(this)}onActiveDocument(e,t){this.lights=t?t.getInnerComponents($d):[],this.ins.light.setOptions(this.lights.map((e=>e.node.name))),this.outs.light.setValue(this.lights[0]),super.onActiveDocument(e,t)}}Km.typeName="CVLightTool",Km.text="Lights",Km.icon="bulb",Km.ins={light:L("Tool.Light",[])},Km.outs={light:N("Tool.SelectedLight",$d)};let Jm=class extends mm{constructor(){super(...arguments),this.lights=null}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-light-tool-view")}connected(){super.connected(),this.tool.outs.light.on("value",this.onUpdate,this)}disconnected(){this.tool.outs.light.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.tool,t=e.lights,n=this.activeDocument;if(!t||!n)return _r`No editable lights in this scene.`;const i=e.outs.light.value,s=n.setup.navigation,r=n.setup.language,o=i?_r`
- -
- - - -
-
`:null;return _r`${o}
-
- - -
-
`}onActiveDocument(e,t){e&&e.setup.navigation.ins.lightsFollowCamera.off("value",this.onUpdate,this),t&&t.setup.navigation.ins.lightsFollowCamera.on("value",this.onUpdate,this),this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};Jm=Ym([Qr("sv-light-tool-view")],Jm);var Zm=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Qm=class extends Zr{constructor(){super(...arguments),this.property=null,this.name=""}firstConnected(){this.classList.add("sv-property-view","sv-property-string")}update(e){if(!this.property)throw new Error("missing property attribute");if("string"!==this.property.type)throw new Error(`not a string property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=e.value;return _r` -
${n}
`}};Zm([Or({attribute:!1})],Qm.prototype,"property",void 0),Zm([Or({type:String})],Qm.prototype,"name",void 0),Qm=Zm([Qr("sv-property-string")],Qm);var ef=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class tf extends pm{createView(){return new nf(this)}}tf.typeName="CVTapeTool",tf.text="Measure",tf.icon="tape";let nf=class extends mm{constructor(){super(...arguments),this.firstRender=!0,this.statusMsg=""}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-tape-tool-view")}render(){const e=this.activeDocument;if(!e)return _r``;this.tool;const t=e.setup.tape,n=t.ins.enabled,i=t.outs.state.value,s=t.outs.distance.value,r=e.setup.language;let o;if(n.value)if(0===s)o=r.getLocalizedString("Tap on model to set start of tape")+".";else if(i===Nd.SetStart){const t=e.root.scene.ins.units.getOptionText();o=`${s.toFixed(2)} ${t}`}else o=r.getLocalizedString("Tap on model to set end of tape")+".";else o=r.getLocalizedString("Switch on to take measurements")+".";return this.statusMsg=o,_r`
-
- -
-
-
`}updated(e){super.updated(e);const t=this.getElementsByClassName("ff-string").item(0);t&&(t.innerHTML=this.statusMsg,this.firstRender&&(setTimeout((()=>{t.innerHTML=`
${this.statusMsg}
`}),200),this.firstRender=!1))}onActiveDocument(e,t){e&&e.setup.tape.off("update",this.onUpdate,this),t&&t.setup.tape.on("update",this.onUpdate,this),this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("ff-button")[1].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};nf=ef([Qr("sv-tape-tool-view")],nf);var sf=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class rf extends pm{createView(){return new of(this)}}rf.typeName="CVSliceTool",rf.text="Slice",rf.icon="knife";let of=class extends mm{firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-slice-tool-view")}render(){const e=this.activeDocument;if(!e)return _r``;this.tool;const t=e.setup.slicer,n=t.ins.enabled,i=t.ins.axis,s=t.ins.position,r=e.setup.language;return _r`
-
- - - -
-
`}onActiveDocument(e,t){this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("ff-button")[1].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};of=sf([Qr("sv-slice-tool-view")],of);class af extends B{get toolProvider(){return this.getComponent(fm)}createComponents(){this.createComponent(fm),this.createComponent(_m),this.createComponent(Mm),this.createComponent(Cm),this.createComponent(Km),this.createComponent(tf),this.createComponent(rf)}}af.typeName="NVTools";const lf=[im,fm,_m,Mm,Cm,Km,tf,rf,af],cf=JSON.parse('{"asset":{"type":"application/si-dpo-3d.document+json","version":"1.0","copyright":"(c) Smithsonian Institution, all rights reserved","generator":"Voyager"},"scene":0,"scenes":[{"nodes":[0,1],"setup":0}],"nodes":[{"translation":[0,0,15],"camera":0},{"name":"Lights","children":[2,3,4,5]},{"translation":[0,0,2],"rotation":[0.4829741,-0.1070728,0.1880998,0.8484633],"scale":[1,1,1],"name":"Key","light":0},{"rotation":[0.3546969,0.163893,-0.3861077,0.8356136],"scale":[1,1,1],"name":"Fill #1","light":1},{"translation":[0,0,1],"rotation":[0.9374013,-0.3018693,0.0532277,0.1652891],"name":"Fill #2","light":2},{"translation":[1,0,-1],"rotation":[0.373256,0.6426073,-0.5786063,0.3360813],"scale":[1,1,1],"name":"Rim","light":3}],"setups":[{"units":"cm","interface":{"visible":true,"logo":true,"menu":true,"tools":true},"viewer":{"shader":"Default","exposure":1,"gamma":2,"annotationsVisible":false},"reader":{"enabled":false,"position":"Overlay"},"navigation":{"type":"Orbit","enabled":true,"autoZoom":true,"lightsFollowCamera":true,"autoRotation":false,"orbit":{"orbit":[-24,-26,0],"offset":[0,0,150],"minOrbit":[-90,null,null],"maxOrbit":[90,null,null],"minOffset":[null,null,0.1],"maxOffset":[null,null,10000]}},"background":{"style":"RadialGradient","color0":[0.2,0.25,0.3],"color1":[0.01,0.03,0.05]},"floor":{"visible":false,"position":[0,-25,0],"size":50,"color":[0.6,0.75,0.8],"opacity":0.5,"receiveShadow":false},"grid":{"visible":false,"color":[0.5,0.7,0.8]},"tape":{"enabled":false,"startPosition":[0,0,0],"startDirection":[0,0,0],"endPosition":[0,0,0],"endDirection":[0,0,0]},"slicer":{"enabled":false,"axis":"X","inverted":false,"position":0.5}}],"cameras":[{"type":"perspective","perspective":{"yfov":52,"znear":0.1,"zfar":100000}}],"lights":[{"color":[1,0.95,0.9],"intensity":1,"type":"directional","shadowEnabled":true},{"color":[0.9,0.95,1],"intensity":0.7,"type":"directional","shadowEnabled":true},{"color":[0.8,0.85,1],"intensity":0.5,"type":"directional"},{"color":[0.85,0.9078313,1],"intensity":0.6,"type":"directional"}]}');function hf(e,t,n){return Math.min(Math.max(e,t),n)}class uf{constructor(e,t,n){this.props=t||{},console.log(uf.splashMessage);const i=new xp;i.add(rm),i.add(lf),this.commander=new bp;const s=this.system=new _p(i),r=s.graph.createCustomNode(nm);s.graph.createCustomNode(af),s.graph.createCustomNode(sm),this.analytics.startTimer(),e&&new db(this).appendTo(e),n||(this.documentProvider.createDocument(cf),this.evaluateProps());(/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1)&&(window.createImageBitmap=void 0),r.pulse.start()}get assetManager(){return this.system.getMainComponent(Ch)}get assetReader(){return this.system.getMainComponent(Rh)}get documentProvider(){return this.system.getMainComponent(em)}get analytics(){return this.system.getMainComponent(Dh)}dispose(){this.assetReader.dispose(),this.documentProvider.activeComponent.clearNodeTree(),this.system.getMainComponent(Ae).views.forEach((e=>e.dispose())),this.documentProvider.activeComponent.setup.tape.dispose(),this.documentProvider.activeComponent.setup.floor.dispose(),this.documentProvider.activeComponent.setup.grid.dispose()}setBaseUrl(e){this.assetManager.baseUrl=e}loadDocument(e,t,n){const i=Wo[n];return this.assetReader.getJSON(e).then((n=>(t=void 0===t?!n.lights&&!n.cameras:t,this.documentProvider.amendDocument(n,e,t)))).then((e=>(isFinite(i)&&e.setup.viewer.ins.quality.setValue(i),e)))}loadModel(e,t){return this.documentProvider.appendModel(e,t)}loadGeometry(e,t,n,i,s){return this.documentProvider.appendGeometry(e,t,n,i,s)}evaluateProps(){const e=this.props,t=this.assetManager;e.root=e.root||vp("root")||vp("r"),e.dracoRoot=e.dracoRoot||vp("dracoRoot")||vp("dr"),e.resourceRoot=e.resourceRoot||vp("resourceRoot")||vp("rr"),e.document=e.document||vp("document")||vp("d"),e.model=e.model||vp("model")||vp("m"),e.geometry=e.geometry||vp("geometry")||vp("g"),e.texture=e.texture||vp("texture")||vp("t"),e.occlusion=e.occlusion||vp("occlusion")||vp("o"),e.normals=e.normals||vp("normals")||vp("n"),e.quality=e.quality||vp("quality")||vp("q"),e.uiMode=e.uiMode||vp("uiMode")||vp("u"),e.bgColor=e.bgColor||vp("bgColor")||vp("bc"),e.bgStyle=e.bgStyle||vp("bgStyle")||vp("bs"),e.controls=e.controls||vp("controls")||vp("ct"),e.lang=e.lang||vp("lang")||vp("l");const n=e.root||e.document||e.model||e.geometry;if(this.setBaseUrl(new URL(n||".",window.location).href),e.uiMode){let t=0,n=!1;const i=Object.values(Pu).filter((e=>"string"==typeof e));e.uiMode.split("|").forEach((e=>{const s=e.toLowerCase();i.includes(s)&&(t+=Pu[s],n=!0)})),n&&this.documentProvider.activeComponent.setup.interface.ins.visibleElements.setValue(t)}e.dracoRoot&&this.assetReader.setDracoPath(e.dracoRoot),e.resourceRoot&&this.assetReader.setSystemAssetPath(e.resourceRoot),e.lang&&this.setLanguage(e.lang),e.document?(e.document=e.root?e.document:t.getAssetName(e.document),this.loadDocument(e.document,void 0,e.quality).then((()=>this.postLoadHandler(e))).catch((e=>ho.show(`Failed to load document: ${e.message}`,"error")))):e.model?(e.model=e.root?e.model:t.getAssetName(e.model),this.assetReader.getText(e.model).then((()=>{this.loadModel(e.model,e.quality),this.postLoadHandler(e)})).catch((e=>ho.show(`Bad Model Path: ${e.message}`,"error")))):e.geometry?(e.geometry=e.root?e.geometry:t.getAssetName(e.geometry),e.texture=e.root?e.texture:t.getAssetName(e.texture),e.occlusion=e.root?e.occlusion:t.getAssetName(e.occlusion),e.normals=e.root?e.normals:t.getAssetName(e.normals),this.assetReader.getText(e.geometry).then((()=>{this.loadGeometry(e.geometry,e.texture,e.occlusion,e.normals,e.quality),this.postLoadHandler(e)})).catch((e=>ho.show(`Bad Geometry Path: ${e.message}`,"error")))):e.root&&this.loadDocument("scene.svx.json",void 0).then((()=>this.postLoadHandler(e))).catch((()=>{}))}postLoadHandler(e){if(this.assetManager.ins.baseUrlValid.setValue(!0),e.bgColor){const t=e.bgColor.split(" ");this.setBackgroundColor(t[0],t[1]||null)}e.bgStyle&&this.setBackgroundStyle(e.bgStyle),e.controls&&this.enableNavigation(e.controls)}toggleAnnotations(){const e=this.system.getMainComponent(em).activeComponent.setup.viewer.ins,t=this.system.getMainComponent(fm).ins;t.visible.value&&t.visible.setValue(!1),e.annotationsVisible.setValue(!e.annotationsVisible.value),this.analytics.sendProperty("Annotations.Visible",e.annotationsVisible.value)}toggleReader(){const e=this.system.getMainComponent(em).activeComponent.setup.reader.ins;e.enabled.setValue(!e.enabled.value),this.analytics.sendProperty("Reader.Enabled",e.enabled.value)}toggleTours(){const e=this.system.getMainComponent(em).activeComponent.setup.tours.ins,t=this.system.getMainComponent(em).activeComponent.setup.reader.ins;e.enabled.value?e.enabled.setValue(!1):(t.enabled.value&&t.enabled.setValue(!1),e.enabled.setValue(!0),e.tourIndex.setValue(-1)),this.analytics.sendProperty("Tours.Enabled",e.enabled.value)}toggleTools(){const e=this.system.getMainComponent(fm).ins,t=this.system.getMainComponent(em).activeComponent.setup.viewer.ins;t.annotationsVisible.value&&t.annotationsVisible.setValue(!1),e.visible.setValue(!e.visible.value),this.analytics.sendProperty("Tools.Visible",e.visible.value)}toggleMeasurement(){const e=this.system.getMainComponent(em).activeComponent.setup.tape.ins;e.visible.setValue(!e.visible.value)}enableAR(){this.system.getMainComponent(gp).ins.enabled.setValue(!0),this.analytics.sendProperty("AR.enabled",!0)}getArticles(){return this.system.getMainComponent(em).activeComponent.setup.reader.articles.map((e=>e.article.data))}getAnnotations(){const e=this.system.getComponent(op).getGraphComponents(Tu);let t=[];return e.forEach((e=>{t=t.concat(e.getAnnotations())})),t}getCameraOrbit(){return this.system.getMainComponent(em).activeComponent.setup.navigation.ins.orbit.value.slice(0,2)}setCameraOrbit(e,t){const n=this.system.getMainComponent(em).activeComponent.setup.navigation.ins,i=parseFloat(e),s=parseFloat(t);isNaN(i)||isNaN(s)?console.log("Error: setCameraOrbit param is not a number."):n.orbit.setValue([i,s,0])}getCameraOffset(){return this.system.getMainComponent(em).activeComponent.setup.navigation.ins.offset.value.slice(0,3)}setCameraOffset(e,t,n){const i=this.system.getMainComponent(em).activeComponent.setup.navigation.ins;let s=parseFloat(e),r=parseFloat(t),o=parseFloat(n);if(isNaN(s)||isNaN(r)||isNaN(o))console.log("Error: setCameraOffset param is not a number.");else{const e=i.minOffset.value,t=i.maxOffset.value;s=hf(s,e[0],t[0]),r=hf(r,e[1],t[1]),o=hf(o,e[2],t[2]),i.offset.setValue([s,r,o])}}setBackgroundColor(e,t){const n=this.system.getMainComponent(em).activeComponent.setup.background.ins,i=document.createElement("div");if(i.id="temp-color",document.getElementsByTagName("voyager-explorer")[0].appendChild(i),i.style.color=e,""!==i.style.color){const e=getComputedStyle(i).color.split("(")[1].split(")")[0].split(",").map((e=>parseInt(e)/255));n.color0.setValue(e)}else console.log("Error: Color0 param is invalid.");if(t)if(i.style.color=t,""!==i.style.color){const e=getComputedStyle(i).color.split("(")[1].split(")")[0].split(",").map((e=>parseInt(e)/255));n.color1.setValue(e)}else console.log("Error: Color1 param is invalid.");document.getElementsByTagName("voyager-explorer")[0].removeChild(i)}setBackgroundStyle(e){const t=this.system.getMainComponent(em).activeComponent.setup.background.ins,n=Object.values(ia).filter((e=>"string"==typeof e)).find((t=>t.toLowerCase()===e.toLowerCase()));void 0!==n?t.style.setValue(ia[n]):console.log("Error: Style param is invalid.")}setTourStep(e,t,n){const i=this.system.getMainComponent(em).activeComponent.setup.tours.ins,s=this.system.getMainComponent(em).activeComponent.setup.tours.outs;let r=parseInt(e),o=parseInt(t);!isNaN(r)&&!isNaN(o)&&r>=0&&o>=0?(i.tourIndex.setValue(r),n?(s.stepIndex.setValue(o-1),i.next.set()):i.stepIndex.setValue(o)):console.log("Error: setTourStep param ["+r+" "+o+"] is not a valid number.")}enableNavigation(e){let t;const n=e.toLowerCase();if("true"===n?t=!0:"false"===n&&(t=!1),null!=t){this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.setValue(t)}else console.log("Error: enableNavigation param is not valid.")}setLanguage(e){const t=this.system.getMainComponent(em).activeComponent.setup.language.ins,n=e.toUpperCase();n in vs?t.language.setValue(vs[n]):console.log("Error: setLanguage param is not a valid language id.")}}uf.splashMessage="\n _________ .__ __ .__ .__ ________ ________ \n / _____/ _____ |__|/ |_| |__ __________ ____ |__|____ ____ \\_____ \\\\______ \\ \n \\_____ \\ / \\| \\ __\\ | \\ / ___/ _ \\ / \\| \\__ \\ / \\ _(__ < | | \\ \n / \\ Y Y \\ || | | Y \\\\___ ( <_> ) | \\ |/ __ \\| | \\ / \\| ` \\\n/_______ /__|_| /__||__| |___| /____ >____/|___| /__(____ /___| / /______ /_______ /\n \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \n \nVoyager - 3D Explorer and Tool Suite\n3D Foundation Project\n(c) 2022 Smithsonian Institution\n\nhttps://3d.si.edu\nhttps://github.com/smithsonian/dpo-voyager\n\n-----------------------------------------------------\nVersion: Voyager Explorer v0.17.0 PROD\n-----------------------------------------------------\n ",window.VoyagerExplorer=uf;class df{constructor(e,t,n){this._type=e,this._callback=t,this._context=n,this._publishers=[]}on(...e){return e.forEach((e=>{this._publishers.push(e),e.on(this._type,this._callback,this._context)})),this}off(){return this._publishers.forEach((e=>e.off(this._type,this._callback,this._context))),this._publishers.length=0,this}}class pf{constructor(e){this.next=null,this.activePositions=[],this.activeType="",this.centerX=0,this.centerY=0,this.startX=0,this.startY=0,this.isDragging=!1,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUpOrCancel=this.onPointerUpOrCancel.bind(this),this.onDoubleClick=this.onDoubleClick.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onWheel=this.onWheel.bind(this),e&&(e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUpOrCancel),e.addEventListener("pointercancel",this.onPointerUpOrCancel),e.addEventListener("contextmenu",this.onContextMenu),e.addEventListener("wheel",this.onWheel))}onPointerDown(e){if(this.activeType&&e.pointerType!==this.activeType)return;0===this.activePositions.length&&(this.startX=e.clientX,this.startY=e.clientY,this.isDragging=!1),this.activeType=e.pointerType,this.activePositions.push({id:e.pointerId,clientX:e.clientX,clientY:e.clientY}),e.currentTarget.setPointerCapture(e.pointerId);const t=this.createManipPointerEvent(e,"pointer-down");this.sendPointerEvent(t)&&e.stopPropagation()}onPointerMove(e){const t=this.activePositions;for(let n=0,i=t.length;n0&&!this.isDragging){Math.abs(e.clientX-this.startX)+Math.abs(e.clientY-this.startY)>4&&(this.isDragging=!0)}const n=t.length?"pointer-move":"pointer-hover",i=this.createManipPointerEvent(e,n);this.sendPointerEvent(i)&&e.stopPropagation()}onPointerUpOrCancel(e){const t=this.activePositions;let n=!1;for(let i=0,s=t.length;i0){for(let e=0;e0?1:-1,c.push(C.x,C.y,C.z),h.push(a/f),h.push(1-r/g),E+=1}}for(let e=0;e=0){let r=l[t];if(void 0===r&&("instanceMatrix"===t&&s.instanceMatrix&&(r=s.instanceMatrix),"instanceColor"===t&&s.instanceColor&&(r=s.instanceColor)),void 0!==r){const t=r.normalized,o=r.itemSize,l=n.get(r);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(r.isInterleavedBufferAttribute){const n=r.data,l=n.stride,d=r.offset;if(n&&n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const r="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=r||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),m=e.getParameter(e.MAX_VERTEX_ATTRIBS),f=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=u>0,b=r||t.has("OES_texture_float");return{isWebGL2:r,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:s,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:r?e.getParameter(e.MAX_SAMPLES):0}}function _f(e){const t=this;let n=null,i=0,s=!1,r=!1;const o=new qa,a=new tt,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function h(e,n,i,s){const r=null!==e?e.length:0;let c=null;if(0!==r){if(c=l.value,!0!==s||null===c){const t=i+4*r,s=n.matrixWorldInverse;a.getNormalMatrix(s),(null===c||c.length\n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new gf(5,5,5),s=new _o({name:"CubemapFromEquirect",uniforms:yo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});s.uniforms.tEquirect.value=t;const r=new ui(i,s),o=t.minFilter;t.minFilter===ne&&(t.minFilter=te);return new Sf(1,10,this).update(e,r),t.minFilter=o,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(s)}}function Tf(e){let t=new WeakMap;function n(e,t){return t===q?e.mapping=G:304===t&&(e.mapping=W),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const s=t.get(n);void 0!==s&&(t.delete(n),s.dispose())}return{get:function(s){if(s&&s.isTexture&&!1===s.isRenderTargetTexture){const r=s.mapping;if(r===q||304===r){if(t.has(s)){return n(t.get(s).texture,s.mapping)}{const r=s.image;if(r&&r.height>0){const o=new Ef(r.height/2);return o.fromEquirectangularTexture(e,s),t.set(s,o),s.addEventListener("dispose",i),n(o.texture,s.mapping)}return null}}}return s},dispose:function(){t=new WeakMap}}}Ef.prototype.isWebGLCubeRenderTarget=!0;const Cf=Math.pow(2,8),Af=[.125,.215,.35,.446,.526,.582],Pf=5+Af.length,Rf=20,Lf=new nl,{_lodPlanes:Nf,_sizeLods:Df,_sigmas:Of}=Bf(),If=new Pn;let kf=null;const zf=(1+Math.sqrt(5))/2,Uf=1/zf,Vf=[new Ve(1,1,1),new Ve(-1,1,1),new Ve(1,1,-1),new Ve(-1,1,-1),new Ve(0,zf,Uf),new Ve(0,zf,-Uf),new Ve(Uf,0,zf),new Ve(-Uf,0,zf),new Ve(zf,Uf,0),new Ve(-zf,Uf,0)];class Ff{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(e),n=new Ve(0,1,0);return new uu({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:Wf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(Rf),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){kf=this._renderer.getRenderTarget();const s=this._allocateTargets();return this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Gf(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Hf(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let e=0;e2?Cf:0,Cf,Cf),a.setRenderTarget(i),d&&a.render(u,s),a.render(e,s)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===G||e.mapping===W;i?(null===this._cubemapShader&&(this._cubemapShader=Gf()),this._cubemapShader.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectShader&&(this._equirectShader=Hf());const s=i?this._cubemapShader:this._equirectShader,r=new ui(Nf[0],s),o=s.uniforms;o.envMap.value=e,i||o.texelSize.value.set(1/e.image.width,1/e.image.height),$f(t,0,0,3*Cf,2*Cf),n.setRenderTarget(t),n.render(r,Lf)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;tRf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e4?i-8+4:0),3*v,2*v),a.setRenderTarget(t),a.render(c,Lf)}}function Bf(){const e=[],t=[],n=[];let i=8;for(let s=0;s4?o=Af[s-8+4-1]:0===s&&(o=0),n.push(o);const a=1/(r-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,m=2,f=1,g=new Float32Array(p*d*u),v=new Float32Array(m*d*u),y=new Float32Array(f*d*u);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(i,p*d*e),v.set(h,m*d*e);const s=[e,e,e,e,e,e];y.set(s,f*d*e)}const b=new qn;b.setAttribute("position",new On(g,p)),b.setAttribute("uv",new On(v,m)),b.setAttribute("faceIndex",new On(y,f)),e.push(b),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function jf(e){const t=new vo(3*Cf,3*Cf,e);return t.texture.mapping=X,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function $f(e,t,n,i,s){e.viewport.set(t,n,i,s),e.scissor.set(t,n,i,s)}function Hf(){const e=new sn(1,1);return new uu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e}},vertexShader:Wf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = texture2D ( envMap, uv ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Gf(){return new uu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Wf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Wf(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function qf(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const s=t.get(n);void 0!==s&&(t.delete(n),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping,o=r===q||304===r,a=r===G||r===W;if(o||a){if(s.isRenderTargetTexture&&!0===s.needsPMREMUpdate){s.needsPMREMUpdate=!1;let i=t.get(s);return null===n&&(n=new Ff(e)),i=o?n.fromEquirectangular(s,i):n.fromCubemap(s,i),t.set(s,i),i.texture}if(t.has(s))return t.get(s).texture;{const r=s.image;if(o&&r&&r.height>0||a&&r&&function(e){let t=0;const n=6;for(let i=0;it.maxTextureSize&&(u=Math.ceil(h/t.maxTextureSize),h=t.maxTextureSize);const d=new Float32Array(h*u*4*i),p=new Zf(d,h,u,i);p.format=ce,p.type=oe,p.needsUpdate=!0;const m=4*l;for(let t=0;t0)return e;const s=t*n;let r=hg[s];if(void 0===r&&(r=new Float32Array(s),hg[s]=r),0!==t){i.toArray(r,0);for(let i=1,s=0;i!==t;++i)s+=n,e[i].toArray(r,s)}return r}function gg(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function bv(e){return e.replace(yv,xv)}function xv(e,t){const n=Qo[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return bv(n)}const _v=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,wv=/#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 Sv(e){return e.replace(wv,Ev).replace(_v,Mv)}function Mv(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ev(e,t,n,i)}function Ev(e,t,n,i){let s="";for(let e=parseInt(t);e0&&(f+="\n"),g=[d,p].filter(fv).join("\n"),g.length>0&&(g+="\n")):(f=[Tv(n),"#define SHADER_NAME "+n.shaderName,p,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(fv).join("\n"),g=[d,Tv(n),"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Qo.tonemapping_pars_fragment:"",0!==n.toneMapping?mv("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.transparent?"":"#define OPAQUE",Qo.encodings_pars_fragment,pv("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(fv).join("\n")),o=bv(o),o=gv(o,n),o=vv(o,n),a=bv(a),a=gv(a,n),a=vv(a,n),o=Sv(o),a=Sv(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",f=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+f,g=["#define varying in",n.glslVersion===Se?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Se?"":"#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("\n")+"\n"+g);const y=v+f+o,b=v+g+a,x=hv(s,s.VERTEX_SHADER,y),_=hv(s,s.FRAGMENT_SHADER,b);if(s.attachShader(m,x),s.attachShader(m,_),void 0!==n.index0AttributeName?s.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&s.bindAttribLocation(m,0,"position"),s.linkProgram(m),e.debug.checkShaderErrors){const e=s.getProgramInfoLog(m).trim(),t=s.getShaderInfoLog(x).trim(),n=s.getShaderInfoLog(_).trim();let i=!0,r=!0;if(!1===s.getProgramParameter(m,s.LINK_STATUS)){i=!1;const t=dv(s,x,"vertex"),n=dv(s,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(m,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(r=!1);r&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:f},fragmentShader:{log:n,prefix:g}})}let w,S;return s.deleteShader(x),s.deleteShader(_),this.getUniforms=function(){return void 0===w&&(w=new cv(s,m)),w},this.getAttributes=function(){return void 0===S&&(S=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s0,R=r.clearcoat>0;return{isWebGL2:h,shaderID:w,shaderName:r.type,vertexShader:M,fragmentShader:E,defines:r.defines,customVertexShaderID:T,customFragmentShaderID:C,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:f,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:m,outputEncoding:null===A?e.outputEncoding:!0===A.isXRRenderTarget?A.texture.encoding:be,map:!!r.map,matcap:!!r.matcap,envMap:!!_,envMapMode:_&&_.mapping,envMapCubeUV:!!_&&(_.mapping===X||307===_.mapping),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,decodeVideoTexture:!!r.map&&!0===r.map.isVideoTexture&&r.map.encoding===xe,clearcoat:R,clearcoatMap:R&&!!r.clearcoatMap,clearcoatRoughnessMap:R&&!!r.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,specularIntensityMap:!!r.specularIntensityMap,specularColorMap:!!r.specularColorMap,transparent:r.transparent,alphaMap:!!r.alphaMap,alphaTest:P,gradientMap:!!r.gradientMap,sheen:r.sheen>0,sheenColorMap:!!r.sheenColorMap,sheenRoughnessMap:!!r.sheenRoughnessMap,transmission:r.transmission>0,transmissionMap:!!r.transmissionMap,thicknessMap:!!r.thicknessMap,combine:r.combine,vertexTangents:!!r.normalMap&&!!y.geometry&&!!y.geometry.attributes.tangent,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!y.geometry&&!!y.geometry.attributes.color&&4===y.geometry.attributes.color.itemSize,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap||r.thicknessMap||r.specularIntensityMap||r.specularColorMap||r.sheenColorMap||r.sheenRoughnessMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmission>0||r.transmissionMap||r.thicknessMap||r.specularIntensityMap||r.specularColorMap||r.sheen>0||r.sheenColorMap||r.sheenRoughnessMap||!r.displacementMap),fog:!!b,useFog:r.fog,fogExp2:b&&b.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===y.isSkinnedMesh&&S>0,maxBones:S,useVertexTexture:d,morphTargets:!!y.geometry&&!!y.geometry.morphAttributes.position,morphNormals:!!y.geometry&&!!y.geometry.morphAttributes.normal,morphTargetsCount:y.geometry&&y.geometry.morphAttributes.position?y.geometry.morphAttributes.position.length:0,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.maxBones),e.push(t.morphTargetsCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection)}(n,t),function(e,t){a.disableAll(),t.isWebGL2&&a.enable(0);t.supportsVertexTextures&&a.enable(1);t.instancing&&a.enable(2);t.instancingColor&&a.enable(3);t.map&&a.enable(4);t.matcap&&a.enable(5);t.envMap&&a.enable(6);t.envMapCubeUV&&a.enable(7);t.lightMap&&a.enable(8);t.aoMap&&a.enable(9);t.emissiveMap&&a.enable(10);t.bumpMap&&a.enable(11);t.normalMap&&a.enable(12);t.objectSpaceNormalMap&&a.enable(13);t.tangentSpaceNormalMap&&a.enable(14);t.clearcoat&&a.enable(15);t.clearcoatMap&&a.enable(16);t.clearcoatRoughnessMap&&a.enable(17);t.clearcoatNormalMap&&a.enable(18);t.displacementMap&&a.enable(19);t.specularMap&&a.enable(20);t.roughnessMap&&a.enable(21);t.metalnessMap&&a.enable(22);t.gradientMap&&a.enable(23);t.alphaMap&&a.enable(24);t.alphaTest&&a.enable(25);t.vertexColors&&a.enable(26);t.vertexAlphas&&a.enable(27);t.vertexUvs&&a.enable(28);t.vertexTangents&&a.enable(29);t.uvsVertexOnly&&a.enable(30);t.fog&&a.enable(31);e.push(a.mask),a.disableAll(),t.useFog&&a.enable(0);t.flatShading&&a.enable(1);t.logarithmicDepthBuffer&&a.enable(2);t.skinning&&a.enable(3);t.useVertexTexture&&a.enable(4);t.morphTargets&&a.enable(5);t.morphNormals&&a.enable(6);t.premultipliedAlpha&&a.enable(7);t.shadowMapEnabled&&a.enable(8);t.physicallyCorrectLights&&a.enable(9);t.doubleSided&&a.enable(10);t.flipSided&&a.enable(11);t.depthPacking&&a.enable(12);t.dithering&&a.enable(13);t.specularIntensityMap&&a.enable(14);t.specularColorMap&&a.enable(15);t.transmission&&a.enable(16);t.transmissionMap&&a.enable(17);t.thicknessMap&&a.enable(18);t.sheen&&a.enable(19);t.sheenColorMap&&a.enable(20);t.sheenRoughnessMap&&a.enable(21);t.decodeVideoTexture&&a.enable(22);t.transparent&&a.enable(23);e.push(a.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=g[e.type];let n;if(t){const e=ta[t];n=xo.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=c.length;e0?i.push(h):!0===o.transparent?s.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=r(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?s.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||Dv),i.length>1&&i.sort(t||Ov),s.length>1&&s.sort(t||Ov)}}}function kv(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Iv,e.set(t,[i])):n>=e.get(t).length?(i=new Iv,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function zv(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Ve,color:new Pn};break;case"SpotLight":n={position:new Ve,direction:new Ve,color:new Pn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ve,color:new Pn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ve,skyColor:new Pn,groundColor:new Pn};break;case"RectAreaLight":n={color:new Pn,position:new Ve,halfWidth:new Ve,halfHeight:new Ve}}return e[t.id]=n,n}}}let Uv=0;function Vv(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Fv(e,t){const n=new zv,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new sn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new sn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)s.probe.push(new Ve);const r=new Ve,o=new je,a=new je;return{setup:function(r,o){let a=0,l=0,c=0;for(let e=0;e<9;e++)s.probe[e].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,v=0;r.sort(Vv);const y=!0!==o?Math.PI:1;for(let e=0,t=r.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(s.rectAreaLTC1=ea.LTC_FLOAT_1,s.rectAreaLTC2=ea.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(s.rectAreaLTC1=ea.LTC_HALF_1,s.rectAreaLTC2=ea.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=a,s.ambient[1]=l,s.ambient[2]=c;const b=s.hash;b.directionalLength===h&&b.pointLength===u&&b.spotLength===d&&b.rectAreaLength===p&&b.hemiLength===m&&b.numDirectionalShadows===f&&b.numPointShadows===g&&b.numSpotShadows===v||(s.directional.length=h,s.spot.length=d,s.rectArea.length=p,s.point.length=u,s.hemi.length=m,s.directionalShadow.length=f,s.directionalShadowMap.length=f,s.pointShadow.length=g,s.pointShadowMap.length=g,s.spotShadow.length=v,s.spotShadowMap.length=v,s.directionalShadowMatrix.length=f,s.pointShadowMatrix.length=g,s.spotShadowMatrix.length=v,b.directionalLength=h,b.pointLength=u,b.spotLength=d,b.rectAreaLength=p,b.hemiLength=m,b.numDirectionalShadows=f,b.numPointShadows=g,b.numSpotShadows=v,s.version=Uv++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t=n.get(i).length?(r=new Bv(e,t),n.get(i).push(r)):r=n.get(i)[s],r},dispose:function(){n=new WeakMap}}}class $v extends wn{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}$v.prototype.isMeshDepthMaterial=!0;class Hv extends wn{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Ve,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}Hv.prototype.isMeshDistanceMaterial=!0;function Gv(e,t,n){let i=new Ka;const s=new sn,r=new sn,o=new Ln,a=new $v({depthPacking:3201}),l=new Hv,c={},h=n.maxTextureSize,u={0:1,1:0,2:2},d=new _o({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new sn},radius:{value:4}},vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n",fragmentShader:"\nuniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n\n#include \n\nvoid main() {\n\n\tconst float samples = float( VSM_SAMPLES );\n\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\n\t// This seems totally useless but it's a crazy work around for a Adreno compiler bug\n\t// float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\n\t\t#ifdef HORIZONTAL_PASS\n\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\n\t\t#else\n\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\n\t\t#endif\n\n\t}\n\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n\n}\n"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const m=new qn;m.setAttribute("position",new On(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new ui(m,d),g=this;function v(n,i){const s=t.update(f);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,s,d,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,s,p,f,null)}function y(t,n,i,s,r,o,h){let d=null;const p=!0===s.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(d=void 0!==p?p:!0===s.isPointLight?l:a,e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const e=d.uuid,t=i.uuid;let n=c[e];void 0===n&&(n={},c[e]=n);let s=n[t];void 0===s&&(s=d.clone(),n[t]=s),d=s}return d.visible=i.visible,d.wireframe=i.wireframe,d.side=3===h?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],d.alphaMap=i.alphaMap,d.alphaTest=i.alphaTest,d.clipShadows=i.clipShadows,d.clippingPlanes=i.clippingPlanes,d.clipIntersection=i.clipIntersection,d.displacementMap=i.displacementMap,d.displacementScale=i.displacementScale,d.displacementBias=i.displacementBias,d.wireframeLinewidth=i.wireframeLinewidth,d.linewidth=i.linewidth,!0===s.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(s.matrixWorld),d.nearDistance=r,d.farDistance=o),d}function b(n,s,r,o,a){if(!1===n.visible)return;if(n.layers.test(s.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld);const i=t.update(n),s=n.material;if(Array.isArray(s)){const t=i.groups;for(let l=0,c=t.length;lh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/p.x),s.x=r.x*p.x,u.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/p.y),s.y=r.y*p.y,u.mapSize.y=r.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const e={minFilter:te,magFilter:te,format:ce};u.map=new vo(s.x,s.y,e),u.map.texture.name=c.name+".shadowMap",u.mapPass=new vo(s.x,s.y,e),u.camera.updateProjectionMatrix()}if(null===u.map){const e={minFilter:Z,magFilter:Z,format:ce};u.map=new vo(s.x,s.y,e),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e=1):-1!==P.indexOf("OpenGL ES")&&(A=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),C=A>=2);let R=null,L={};const N=e.getParameter(e.SCISSOR_BOX),D=e.getParameter(e.VIEWPORT),O=(new Ln).fromArray(N),I=(new Ln).fromArray(D);function k(t,n,i){const s=new Uint8Array(4),r=e.createTexture();e.bindTexture(t,r),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let t=0;ti||e.height>i)&&(s=i/Math.max(e.width,e.height)),s<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?ze:Math.floor,r=i(s*e.width),o=i(s*e.height);void 0===m&&(m=g(r,o));const a=n?g(r,o):m;a.width=r,a.height=o;return a.getContext("2d").drawImage(e,0,0,r,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+r+"x"+o+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function y(e){return ke(e.width)&&ke(e.height)}function b(e,t){return e.generateMipmaps&&t&&e.minFilter!==Z&&e.minFilter!==te}function x(t){e.generateMipmap(t)}function _(n,i,s,r,o=!1){if(!1===a)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return i===e.RED&&(s===e.FLOAT&&(l=e.R32F),s===e.HALF_FLOAT&&(l=e.R16F),s===e.UNSIGNED_BYTE&&(l=e.R8)),i===e.RG&&(s===e.FLOAT&&(l=e.RG32F),s===e.HALF_FLOAT&&(l=e.RG16F),s===e.UNSIGNED_BYTE&&(l=e.RG8)),i===e.RGBA&&(s===e.FLOAT&&(l=e.RGBA32F),s===e.HALF_FLOAT&&(l=e.RGBA16F),s===e.UNSIGNED_BYTE&&(l=r===xe&&!1===o?e.SRGB8_ALPHA8:e.RGBA8),s===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),s===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)),l!==e.R16F&&l!==e.R32F&&l!==e.RG16F&&l!==e.RG32F&&l!==e.RGBA16F&&l!==e.RGBA32F||t.get("EXT_color_buffer_float"),l}function w(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&e.minFilter!==Z&&e.minFilter!==te?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(t){return t===Z||t===Q||t===ee?e.NEAREST:e.LINEAR}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function E(t){const n=t.target;n.removeEventListener("dispose",E),function(t){const n=t.texture,s=i.get(t),r=i.get(n);if(!t)return;void 0!==r.__webglTexture&&(e.deleteTexture(r.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(s.__webglFramebuffer[t]),s.__webglDepthbuffer&&e.deleteRenderbuffer(s.__webglDepthbuffer[t]);else e.deleteFramebuffer(s.__webglFramebuffer),s.__webglDepthbuffer&&e.deleteRenderbuffer(s.__webglDepthbuffer),s.__webglMultisampledFramebuffer&&e.deleteFramebuffer(s.__webglMultisampledFramebuffer),s.__webglColorRenderbuffer&&e.deleteRenderbuffer(s.__webglColorRenderbuffer),s.__webglDepthRenderbuffer&&e.deleteRenderbuffer(s.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,s=n.length;t0&&r.__version!==t.version){const e=t.image;if(void 0===e)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==e.complete)return void D(r,t,s);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_2D,r.__webglTexture)}function A(t,s){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,s){if(6!==i.image.length)return;N(t,i),n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const o=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=o||l?l?i.image[e].image:i.image[e]:v(i.image[e],!1,!0,c),h[e]=U(i,h[e]);const u=h[0],d=y(u)||a,p=r.convert(i.format,i.encoding),m=r.convert(i.type),f=_(i.internalFormat,p,m,i.encoding),g=a&&!0!==i.isVideoTexture,S=void 0===t.__version;let M,E=w(i,u,d);if(L(e.TEXTURE_CUBE_MAP,i,d),o){g&&S&&n.texStorage2D(e.TEXTURE_CUBE_MAP,E,f,u.width,u.height);for(let t=0;t<6;t++){M=h[t].mipmaps;for(let s=0;s0&&E++,n.texStorage2D(e.TEXTURE_CUBE_MAP,E,f,h[0].width,h[0].height));for(let t=0;t<6;t++)if(l){g?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,h[t].width,h[t].height,p,m,h[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,f,h[t].width,h[t].height,0,p,m,h[t].data);for(let i=0;i1||i.get(r).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,s.getMaxAnisotropy())),i.get(r).__currentAnisotropy=r.anisotropy)}}function N(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",M),t.__webglTexture=e.createTexture(),o.memory.textures++)}function D(t,i,s){let o=e.TEXTURE_2D;i.isDataTexture2DArray&&(o=e.TEXTURE_2D_ARRAY),i.isDataTexture3D&&(o=e.TEXTURE_3D),N(t,i),n.activeTexture(e.TEXTURE0+s),n.bindTexture(o,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const l=function(e){return!a&&(e.wrapS!==K||e.wrapT!==K||e.minFilter!==Z&&e.minFilter!==te)}(i)&&!1===y(i.image);let c=v(i.image,l,!1,h);c=U(i,c);const u=y(c)||a,d=r.convert(i.format,i.encoding);let p,m=r.convert(i.type),f=_(i.internalFormat,d,m,i.encoding,i.isVideoTexture);L(o,i,u);const g=i.mipmaps,S=a&&!0!==i.isVideoTexture,M=void 0===t.__version,E=w(i,c,u);if(i.isDepthTexture)f=e.DEPTH_COMPONENT,a?f=i.type===oe?e.DEPTH_COMPONENT32F:i.type===re?e.DEPTH_COMPONENT24:i.type===le?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:i.type===oe&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===he&&f===e.DEPTH_COMPONENT&&i.type!==se&&i.type!==re&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=se,m=r.convert(i.type)),i.format===ue&&f===e.DEPTH_COMPONENT&&(f=e.DEPTH_STENCIL,i.type!==le&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=le,m=r.convert(i.type))),S&&M?n.texStorage2D(e.TEXTURE_2D,1,f,c.width,c.height):n.texImage2D(e.TEXTURE_2D,0,f,c.width,c.height,0,d,m,null);else if(i.isDataTexture)if(g.length>0&&u){S&&M&&n.texStorage2D(e.TEXTURE_2D,E,f,g[0].width,g[0].height);for(let t=0,i=g.length;t0&&u){S&&M&&n.texStorage2D(e.TEXTURE_2D,E,f,g[0].width,g[0].height);for(let t=0,i=g.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=C,this.setTexture2DArray=function(t,s){const r=i.get(t);t.version>0&&r.__version!==t.version?D(r,t,s):(n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_2D_ARRAY,r.__webglTexture))},this.setTexture3D=function(t,s){const r=i.get(t);t.version>0&&r.__version!==t.version?D(r,t,s):(n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_3D,r.__webglTexture))},this.setTextureCube=A,this.rebindTextures=function(t,n,s){const r=i.get(t);void 0!==n&&O(r.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),void 0!==s&&k(t)},this.setupRenderTarget=function(t){const l=t.texture,c=i.get(t),h=i.get(l);t.addEventListener("dispose",E),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=l.version,o.memory.textures++);const u=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=l.isDataTexture3D||l.isDataTexture2DArray,m=y(t)||a;if(u){c.__webglFramebuffer=[];for(let t=0;t<6;t++)c.__webglFramebuffer[t]=e.createFramebuffer()}else if(c.__webglFramebuffer=e.createFramebuffer(),d)if(s.drawBuffers){const n=t.texture;for(let t=0,s=n.length;ta+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==s),null!==l&&(l.visible=null!==r),this}}class Jv extends fo{constructor(e,t,n,i,s,r,o,a,l,c){if((c=void 0!==c?c:he)!==he&&c!==ue)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===he&&(n=se),void 0===n&&c===ue&&(n=le),super(null,i,s,r,o,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:Z,this.minFilter=void 0!==a?a:Z,this.flipY=!1,this.generateMipmaps=!1}}Jv.prototype.isDepthTexture=!0;class Zv extends Qe{constructor(e,t){super();const n=this;let i=null,s=1,r=null,o="local-floor";const a=e.extensions.has("WEBGL_multisampled_render_to_texture");let l=null,c=null,h=null,u=null,d=!1,p=null;const m=t.getContextAttributes();let f=null,g=null;const v=[],y=new Map,b=new rl;b.layers.enable(1),b.viewport=new Ln;const x=new rl;x.layers.enable(2),x.viewport=new Ln;const _=[b,x],w=new Hh;w.layers.enable(1),w.layers.enable(2);let S=null,M=null;function E(e){const t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function T(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),S=null,M=null,e.setRenderTarget(f),u=null,h=null,c=null,i=null,g=null,N.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function C(e){const t=i.inputSources;for(let e=0;e0&&(t.alphaTest.value=n.alphaTest);const i=e.get(n).envMap;let s,r;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?s=n.map:n.specularMap?s=n.specularMap:n.displacementMap?s=n.displacementMap:n.normalMap?s=n.normalMap:n.bumpMap?s=n.bumpMap:n.roughnessMap?s=n.roughnessMap:n.metalnessMap?s=n.metalnessMap:n.alphaMap?s=n.alphaMap:n.emissiveMap?s=n.emissiveMap:n.clearcoatMap?s=n.clearcoatMap:n.clearcoatNormalMap?s=n.clearcoatNormalMap:n.clearcoatRoughnessMap?s=n.clearcoatRoughnessMap:n.specularIntensityMap?s=n.specularIntensityMap:n.specularColorMap?s=n.specularColorMap:n.transmissionMap?s=n.transmissionMap:n.thicknessMap?s=n.thicknessMap:n.sheenColorMap?s=n.sheenColorMap:n.sheenRoughnessMap&&(s=n.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),t.uvTransform.value.copy(s.matrix)),n.aoMap?r=n.aoMap:n.lightMap&&(r=n.lightMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uv2Transform.value.copy(r.matrix))}function n(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,s,r,o){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i),i.isMeshPhysicalMaterial?function(e,t,i){n(e,t),e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate()));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap);t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,o):n(e,i)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);let s;t.map?s=t.map:t.alphaMap&&(s=t.alphaMap);void 0!==s&&(!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uvTransform.value.copy(s.matrix))}(e,i,s,r):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);let n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function ey(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=Vn("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,s=void 0===e.depth||e.depth,r=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,a=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u=null,d=null;const p=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=be,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const f=this;let g=!1,v=0,y=0,b=null,x=-1,_=null;const w=new Ln,S=new Ln;let M=null,E=t.width,T=t.height,C=1,A=null,P=null;const R=new Ln(0,0,E,T),L=new Ln(0,0,E,T);let N=!1;const D=new Ka;let O=!1,I=!1,k=null;const z=new je,U=new Ve,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function F(){return null===b?C:1}let B,j,$,H,G,W,q,X,Y,J,Q,ee,te,se,re,le,he,ue,de,pe,me,fe,ge,ve=n;function ye(e,n){for(let i=0;i0&&function(e,t,n){if(null===k){const e=!0===o&&!0===j.isWebGL2;k=new(e?ig:vo)(1024,1024,{generateMipmaps:!0,type:null!==fe.convert(ae)?ae:ie,minFilter:ne,magFilter:Z,wrapS:K,wrapT:K,useRenderToTexture:B.has("WEBGL_multisampled_render_to_texture")})}const i=f.getRenderTarget();f.setRenderTarget(k),f.clear();const s=f.toneMapping;f.toneMapping=0,Le(e,t,n),f.toneMapping=s,W.updateMultisampleRenderTarget(k),W.updateRenderTargetMipmap(k),f.setRenderTarget(i)}(s,t,n),i&&$.viewport(w.copy(i)),s.length>0&&Le(s,t,n),r.length>0&&Le(r,t,n),a.length>0&&Le(a,t,n)}function Le(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let s=0,r=e.length;s0?m[m.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(e,t,n){G.get(e.texture).__webglTexture=t,G.get(e.depthTexture).__webglTexture=n;const i=G.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||e.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),e.useRenderToTexture=!1,e.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(e,t){const n=G.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){b=e,v=t,y=n;let i=!0;if(e){const t=G.get(e);void 0!==t.__useDefaultFramebuffer?($.bindFramebuffer(ve.FRAMEBUFFER,null),i=!1):void 0===t.__webglFramebuffer?W.setupRenderTarget(e):t.__hasExternalTextures&&W.rebindTextures(e,G.get(e.texture).__webglTexture,G.get(e.depthTexture).__webglTexture)}let s=null,r=!1,o=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const i=G.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(s=i[t],r=!0):s=e.useRenderbuffer?G.get(e).__webglMultisampledFramebuffer:i,w.copy(e.viewport),S.copy(e.scissor),M=e.scissorTest}else w.copy(R).multiplyScalar(C).floor(),S.copy(L).multiplyScalar(C).floor(),M=N;if($.bindFramebuffer(ve.FRAMEBUFFER,s)&&j.drawBuffers&&i&&$.drawBuffers(e,s),$.viewport(w),$.scissor(S),$.setScissorTest(M),r){const i=G.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=G.get(e.texture),s=t||0;ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,i.__webglTexture,n||0,s)}x=-1},this.readRenderTargetPixels=function(e,t,n,i,s,r,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=G.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){$.bindFramebuffer(ve.FRAMEBUFFER,a);try{const o=e.texture,a=o.format,l=o.type;if(a!==ce&&fe.convert(a)!==ve.getParameter(ve.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===ae&&(B.has("EXT_color_buffer_half_float")||j.isWebGL2&&B.has("EXT_color_buffer_float"));if(!(l===ie||fe.convert(l)===ve.getParameter(ve.IMPLEMENTATION_COLOR_READ_TYPE)||l===oe&&(j.isWebGL2||B.has("OES_texture_float")||B.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");ve.checkFramebufferStatus(ve.FRAMEBUFFER)===ve.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-s&&ve.readPixels(t,n,i,s,fe.convert(a),fe.convert(l),r):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const e=null!==b?G.get(b).__webglFramebuffer:null;$.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),s=Math.floor(t.image.width*i),r=Math.floor(t.image.height*i);W.setTexture2D(t,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,n,0,0,e.x,e.y,s,r),$.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const s=t.image.width,r=t.image.height,o=fe.convert(n.format),a=fe.convert(n.type);W.setTexture2D(n,0),ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,n.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,i,e.x,e.y,s,r,o,a,t.image.data):t.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ve.texSubImage2D(ve.TEXTURE_2D,i,e.x,e.y,o,a,t.image),0===i&&n.generateMipmaps&&ve.generateMipmap(ve.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,s=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const r=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=fe.convert(i.format),c=fe.convert(i.type);let h;if(i.isDataTexture3D)W.setTexture3D(i,0),h=ve.TEXTURE_3D;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");W.setTexture2DArray(i,0),h=ve.TEXTURE_2D_ARRAY}ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,i.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,i.unpackAlignment);const u=ve.getParameter(ve.UNPACK_ROW_LENGTH),d=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),p=ve.getParameter(ve.UNPACK_SKIP_PIXELS),m=ve.getParameter(ve.UNPACK_SKIP_ROWS),g=ve.getParameter(ve.UNPACK_SKIP_IMAGES),v=n.isCompressedTexture?n.mipmaps[0]:n.image;ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,v.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,e.min.x),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,e.min.y),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isDataTexture3D?ve.texSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,c,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ve.compressedTexSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,v.data)):ve.texSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,c,v),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,u),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,d),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,p),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,m),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,g),0===s&&i.generateMipmaps&&ve.generateMipmap(h),$.unbindTexture()},this.initTexture=function(e){W.setTexture2D(e,0),$.unbindTexture()},this.resetState=function(){v=0,y=0,b=null,$.reset(),ge.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ey.prototype.isWebGLRenderer=!0;var ty,ny=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};!function(e){e[e.TopLeft=0]="TopLeft",e[e.TopCenter=1]="TopCenter",e[e.TopRight=2]="TopRight",e[e.BottomLeft=3]="BottomLeft",e[e.BottomCenter=4]="BottomCenter",e[e.BottomRight=5]="BottomRight"}(ty||(ty={}));let iy=class extends Zr{constructor(){super(),this.labels=[],this.labels.push({},{},{},{},{},{})}setLabel(e,t,n,i){this.labels[e][t]={text:n,className:i},this.requestUpdate()}unsetLabel(e,t){delete this.labels[e][t],this.requestUpdate()}firstConnected(){this.classList.add("ff-container","ff-viewport-overlay")}render(){const e=this.labels;return _r`
-
${Object.keys(e[ty.TopLeft]).map((t=>{const n=e[ty.TopLeft][t];return _r`
${n.text}
`}))}
-
${Object.keys(e[ty.TopCenter]).map((t=>{const n=e[ty.TopCenter][t];return _r`
${n.text}
`}))}
-
${Object.keys(e[ty.TopRight]).map((t=>{const n=e[ty.TopRight][t];return _r`
${n.text}
`}))}
-
-
${Object.keys(e[ty.BottomLeft]).map((t=>{const n=e[ty.BottomLeft][t];return _r`
${n.text}
`}))}
-
${Object.keys(e[ty.BottomCenter]).map((t=>{const n=e[ty.BottomCenter][t];return _r`
${n.text}
`}))}
-
${Object.keys(e[ty.BottomRight]).map((t=>{const n=e[ty.BottomRight][t];return _r`
${n.text}
`}))}
-
`}};iy=ny([Qr("ff-viewport-overlay")],iy);const sy=iy;class ry extends o{constructor(e){super(),this.next=null,this._canvasWidth=1,this._canvasHeight=1,this._overlay=null,this._camera=null,this._controller=null,this.addEvent("dispose"),this.next=null,e=e||{},this._relRect={x:e.x||0,y:e.y||0,width:e.width||1,height:e.height||1},this._absRect={x:0,y:0,width:1,height:1},e.overlay&&(this._overlay=e.overlay)}get x(){return this._absRect.x}get y(){return this._absRect.y}get width(){return this._absRect.width}get height(){return this._absRect.height}get canvasWidth(){return this._canvasWidth}get canvasHeight(){return this._canvasHeight}get camera(){return this._camera}get controller(){return this._controller}get overlay(){return this._overlay}set overlay(e){this._overlay=e,this.updateGeometry()}dispose(){this.emit({type:"dispose",viewport:this}),this._overlay&&(this._overlay.remove(),this._overlay=null)}setSize(e,t,n,i){const s=this._relRect;s.x=e,s.y=t,s.width=n,s.height=i,this.updateGeometry()}setCanvasSize(e,t){this._canvasWidth=e,this._canvasHeight=t,this.updateGeometry(),this._controller&&this._controller.setViewportSize(e,t)}setBuiltInCamera(e,t){this._camera?this._camera.setProjection(e):(this._camera=new id(e),this._camera.matrixAutoUpdate=!1),void 0!==t&&(this._camera.setPreset(t),this.overlay.setLabel(ty.TopRight,"view",td[t],"ff-label-box"))}unsetBuiltInCamera(){this._camera=null,this._controller=null,this.overlay.unsetLabel(ty.TopRight,"view")}enableCameraControl(e){return!e&&this._controller?this._controller=null:e&&this._camera&&(this._controller||(this._controller=new Wu(this._camera),this._controller.setViewportSize(this.width,this.height),this._controller.updateController())),this._controller}zoomExtents(e){const t=this._camera,n=this._controller;t&&n&&(n.zoomExtents(e),n.updateCamera(null,!0))}isInside(e){return this.isPointInside(e.localX,e.localY)}isPointInside(e,t){const n=this._absRect;return t=this.canvasHeight-t,e>=n.x&&e=n.y&&te.dispose()))}get canvasWidth(){return this.canvas.width}get canvasHeight(){return this.canvas.height}attach(){const e=this.canvasWidth,t=this.canvasHeight;this.viewports.forEach((n=>n.setCanvasSize(e,t))),this.renderer.setSize(e,t,!1),this.rendererComponent=this.system.getComponent(Ae,!0),this.rendererComponent.attachView(this)}detach(){this.rendererComponent=this.system.getComponent(Ae,!0),this.rendererComponent.detachView(this),this.rendererComponent=null}renderImage(e,t,n,i){const s=this.canvas.width,r=this.canvas.height;this.setRenderSize(e,t),this.render();const o=this.canvas.toDataURL(n,i);return this.setRenderSize(s,r),o}render(){const e=this.rendererComponent.activeSceneComponent;if(!e)return;let t=e.scene,n=e.activeCamera;t&&n||(t=this.defaultScene,n=this.defaultCamera);const i=this.renderer;i.clear(),i.__view=this;const s=this.viewports;for(let e=0,r=s.length;en.setCanvasSize(e,t))),this.renderer.xr.isPresenting||this.renderer.setSize(e,t,!1)}resize(){this.setRenderSize(this.canvas.clientWidth,this.canvas.clientHeight),this.renderer.xr.isPresenting||this.render()}setViewportCount(e){const t=this.viewports;for(let n=e;n=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let uy=cy=class extends Zr{constructor(){super(),this.direction="horizontal",this.width=5,this.margin=20,this.detached=!1,this._isActive=!1,this._offset=0,this._position=0,this.addEventListener("pointerdown",(e=>this.onPointerDown(e))),this.addEventListener("pointermove",(e=>this.onPointerMove(e))),this.addEventListener("pointerup",(e=>this.onPointerUpOrCancel(e))),this.addEventListener("pointercancel",(e=>this.onPointerUpOrCancel(e)))}get position(){return this._position}isHorizontal(){return"horizontal"===this.direction}update(e){super.update(e);const t=this.isHorizontal(),n=this.width;this.setStyle({padding:t?`0 ${n}px`:`${n}px 0`,margin:t?`0 ${-n}px`:-n+"px 0",cursor:t?"col-resize":"row-resize"})}firstUpdated(){this.classList.add("ff-splitter"),this.setAttribute("touch-action","none"),this.setStyle({position:"relative",display:"block",zIndex:"1",touchAction:"none"})}onPointerDown(e){if(e.isPrimary){e.stopPropagation(),e.preventDefault(),this._isActive=!0,this.setPointerCapture(e.pointerId);const t=this.getBoundingClientRect();this._offset=this.isHorizontal()?t.left+.5*t.width-e.clientX:t.top+.5*t.height-e.clientY}}onPointerMove(e){if(e.isPrimary&&this._isActive){e.stopPropagation(),e.preventDefault();const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect(),i=this.isHorizontal(),s=i?n.width:n.height;let r=this._offset+(i?e.clientX-n.left:e.clientY-n.top),o=r/s;if(!this.detached){const e=this.previousElementSibling,n=this.nextElementSibling;if(e instanceof HTMLElement&&n instanceof HTMLElement){const a=Array.from(t.children);let l=0,c=s,h=!1;a.forEach((t=>{if(t instanceof cy)return;if(t===e||t===n)return void(h=!0);const s=t.getBoundingClientRect(),r=i?s.width:s.height;c-=r,h||(l+=r)}));const u=this.margin,d=c-u;r-=l,r=rd?d:r;const p=(c-r)/s;o=r/s,e.style.flexBasis=(100*o).toFixed(3)+"%",n.style.flexBasis=(100*p).toFixed(3)+"%",setTimeout((()=>window.dispatchEvent(new CustomEvent("resize"))),0)}}this._position=o,this.dispatchEvent(new CustomEvent(cy.changeEvent,{detail:{direction:this.direction,position:this._position,isDragging:!0}}))}}onPointerUpOrCancel(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),this._isActive=!1,this.dispatchEvent(new CustomEvent(cy.changeEvent,{detail:{direction:this.direction,position:this._position,isDragging:!1}})))}};uy.changeEvent="ff-splitter-change",hy([Or({type:String})],uy.prototype,"direction",void 0),hy([Or({type:Number})],uy.prototype,"width",void 0),hy([Or({type:Number})],uy.prototype,"margin",void 0),hy([Or({type:Boolean})],uy.prototype,"detached",void 0),uy=cy=hy([Qr("ff-splitter")],uy);var dy,py=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};!function(e){e[e.Single=0]="Single",e[e.HorizontalSplit=1]="HorizontalSplit",e[e.VerticalSplit=2]="VerticalSplit",e[e.Quad=3]="Quad"}(dy||(dy={}));let my=class extends Zr{constructor(){super(...arguments),this.layout=dy.Single,this.horizontalPosition=.5,this.verticalPosition=.5}firstConnected(){this.classList.add("ff-quad-splitter")}render(){const e=this.layout;if(e===dy.Single)return _r``;const t=[];return e!==dy.HorizontalSplit&&e!==dy.Quad||t.push(_r` -
-
- -
-
- `),e!==dy.VerticalSplit&&e!==dy.Quad||t.push(_r` -
-
- -
-
- `),_r`${t}`}onSplitterChange(e){"horizontal"===e.detail.direction?this.horizontalPosition=e.detail.position:this.verticalPosition=e.detail.position,this.onChange&&this.onChange({layout:this.layout,horizontalSplit:this.horizontalPosition,verticalSplit:this.verticalPosition,isDragging:e.detail.isDragging})}};py([Or({attribute:!1})],my.prototype,"layout",void 0),py([Or({attribute:!1})],my.prototype,"horizontalPosition",void 0),py([Or({attribute:!1})],my.prototype,"verticalPosition",void 0),my=py([Qr("ff-quad-splitter")],my);const fy=my;var gy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let vy=class extends cm{constructor(e){super(e),this.view=null,this.canvas=null,this.overlay=null,this.splitter=null,this.resizeObserver=null,this.pointerEventsEnabled=!1,this.manipTarget=new pf,this.addEventListener("pointerdown",this.manipTarget.onPointerDown),this.addEventListener("pointermove",this.manipTarget.onPointerMove),this.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.addEventListener("wheel",this.manipTarget.onWheel),this.addEventListener("contextmenu",this.manipTarget.onContextMenu),this.pointerEventsEnabled=!0}firstConnected(){this.classList.add("sv-scene-view"),this.style.touchAction="none",this.setAttribute("touch-action","none"),this.canvas=this.appendElement("canvas",{display:"block",width:"100%",height:"100%"}),this.overlay=this.appendElement("div",{position:"absolute",top:"0",bottom:"0",left:"0",right:"0",overflow:"hidden"}),this.overlay.classList.add("sv-content-overlay"),this.splitter=this.appendElement(fy,{position:"absolute",top:"0",bottom:"0",left:"0",right:"0",overflow:"hidden"}),this.splitter.onChange=e=>{this.view.horizontalSplit=e.horizontalSplit,this.view.verticalSplit=e.verticalSplit},this.view=new ly(this.system,this.canvas,this.overlay),this.view.on("layout",(e=>this.splitter.layout=e.layout)),this.view.layout=dy.Single,this.splitter.layout=dy.Single,this.manipTarget.next=this.view}connected(){this.view.attach(),this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>this.view.resize()))),this.resizeObserver.observe(this.view.renderer.domElement),this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.on("value",this.enablePointerEvents,this)}disconnected(){this.resizeObserver.disconnect(),this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.off("value",this.enablePointerEvents,this),this.view.detach()}enablePointerEvents(){const e=this.system.getMainComponent(em).activeComponent.setup.navigation.ins.pointerEnabled.value;e&&!this.pointerEventsEnabled?(this.addEventListener("pointerdown",this.manipTarget.onPointerDown),this.addEventListener("pointermove",this.manipTarget.onPointerMove),this.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.addEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.addEventListener("wheel",this.manipTarget.onWheel),this.addEventListener("contextmenu",this.manipTarget.onContextMenu),this.style.touchAction="none",this.setAttribute("touch-action","none"),this.pointerEventsEnabled=!0):!e&&this.pointerEventsEnabled&&(this.removeEventListener("pointerdown",this.manipTarget.onPointerDown),this.removeEventListener("pointermove",this.manipTarget.onPointerMove),this.removeEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.removeEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.removeEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.removeEventListener("pointerup",this.manipTarget.onPointerUpOrCancel),this.ownerDocument.removeEventListener("pointercancel",this.manipTarget.onPointerUpOrCancel),this.removeEventListener("wheel",this.manipTarget.onWheel),this.removeEventListener("contextmenu",this.manipTarget.onContextMenu),this.style.touchAction="auto",this.setAttribute("touch-action","auto"),this.pointerEventsEnabled=!1)}};vy=gy([Qr("sv-scene-view")],vy);const yy=vy;var by,xy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let _y=by=class extends Zr{constructor(){super(...arguments),this.visible=!1}firstConnected(){super.firstConnected(),this.classList.add("sv-spinner")}render(){return this.style.visibility=this.visible?"visible":"hidden",by.template}};_y.template=_r`
`,xy([Or({type:Boolean})],_y.prototype,"visible",void 0),_y=by=xy([Qr("sv-spinner")],_y);var wy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Sy=class extends hm{constructor(){super(...arguments),this.reader=null,this.language=null,this.firstRender=!0}firstConnected(){super.firstConnected(),this.classList.add("sv-reader-view")}renderMenuEntry(e,t){const n=e.article;return _r`
this.onKeyDown(e,n.id)} class="sv-entry" @click=${e=>this.onClickArticle(e,n.id)}> -

${n.title}

-

${n.lead}

-
`}render(){const e=this.reader,t=this.language;if(!e)return _r`
Please select a document to display its articles.
`;if(!e.activeArticle){const n=e.articles;return _r`
- - ${n.map(((e,t)=>this.renderMenuEntry(e,t)))} -
`}return _r`
this.onKeyDown(t,e.activeArticle.id)} > - - -
-
`}onClickMenu(e){e.stopPropagation(),this.reader.ins.articleId.setValue(""),this.reader.ins.focus.setValue(!0)}onClickClose(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("close"))}onClickArticle(e,t){this.reader.ins.articleId.setValue(t)}updated(e){super.updated(e);const t=this.reader;if(t){if(t.activeArticle){const e=this.getElementsByClassName("sv-container").item(0);e.innerHTML=t.outs.content.value,this.firstRender&&(setTimeout((()=>{e.insertAdjacentHTML("beforeend","
-end of article-
")}),200),this.firstRender=!1)}t.ins.focus.value&&(this.setFocus(),t.ins.focus.setValue(!1,!0))}}onActiveDocument(e,t){e&&(e.setup.language.outs.language.off("value",this.onUpdate,this),this.reader.outs.content.off("value",this.onUpdate,this),this.reader.outs.article.off("value",this.onUpdate,this),this.language=null,this.reader=null),t&&(this.reader=t.setup.reader,this.language=t.setup.language,this.reader.outs.content.on("value",this.onUpdate,this),this.reader.outs.article.on("value",this.onUpdate,this),t.setup.language.outs.language.on("value",this.onUpdate,this))}onKeyDown(e,t){const n=this.reader;if("Space"!==e.code&&"Enter"!==e.code||!n||n.activeArticle){if("Escape"===e.code)e.preventDefault(),n.activeArticle?(n.ins.articleId.setValue(""),n.ins.focus.setValue(!0)):this.dispatchEvent(new CustomEvent("close"));else if("Tab"===e.code)Wm(Gm(this),e);else if(("ArrowUp"===e.code||"ArrowDown"===e.code)&&n&&!n.activeArticle){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}}else e.preventDefault(),this.reader.ins.articleId.setValue(t),this.reader.ins.focus.setValue(!0)}setFocus(){(this.reader.activeArticle?this.getElementsByClassName("sv-nav-button").item(1):this.getElementsByClassName("sv-entry").item(0)).focus()}};Sy=wy([Qr("sv-reader-view")],Sy);var My=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ey=class extends hm{get arManager(){return this.system.getMainComponent(gp)}firstConnected(){super.firstConnected()}render(){const e=this.arManager.outs;return!e.isPlaced.value&&e.isPresenting.value?_r`
-
-
- Move the device to place your Smithsonian object!

**BETA** -
-
`:null}onActiveDocument(e,t){e&&(this.arManager.outs.isPlaced.off("value",this.onUpdate,this),this.arManager.outs.isPresenting.off("value",this.onUpdate,this)),t&&(this.arManager.outs.isPlaced.on("value",this.onUpdate,this),this.arManager.outs.isPresenting.on("value",this.onUpdate,this)),this.requestUpdate()}};Ey=My([Qr("sv-ar-prompt-container")],Ey);const Ty=Ey;var Cy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ay=class extends hm{constructor(){super(...arguments),this.documentProps=new df("value",this.onUpdate,this),this.shareButtonSelected=!1}get analytics(){return this.system.getMainComponent(Dh)}get arManager(){return this.system.getMainComponent(gp)}firstConnected(){super.firstConnected(),this.classList.add("sv-ar-menu-container")}connected(){super.connected()}disconnected(){super.disconnected()}render(){const e=this.activeDocument;if(!e)return _r``;const t=this.arManager.outs,n=e.setup,i=n.viewer.ins.annotationsVisible.value,s=n.audio.outs.narrationEnabled.value,r=n.audio.outs.narrationPlaying.value;return t.isPlaced.value&&t.isPresenting.value?_r`
- ${_r``} - ${s?_r``:null} -
`:null}onToggleReader(){const e=this.activeDocument.setup.reader.ins;e.enabled.setValue(!e.enabled.value),this.analytics.sendProperty("Reader.Enabled",e.enabled.value)}onToggleNarration(){const e=this.activeDocument.setup.audio;e.setupAudio(),e.ins.playNarration.set()}onToggleAnnotations(){const e=this.activeDocument.setup.viewer.ins;e.annotationsVisible.setValue(!e.annotationsVisible.value),this.analytics.sendProperty("Annotations.Visible",e.annotationsVisible.value)}onActiveDocument(e,t){if(e&&(this.documentProps.off(),this.arManager.outs.isPlaced.off("value",this.onUpdate,this),this.arManager.outs.isPresenting.off("value",this.onUpdate,this)),t){const e=t.setup;this.documentProps.on(e.viewer.ins.annotationsVisible,e.audio.outs.narrationPlaying),this.arManager.outs.isPlaced.on("value",this.onUpdate,this),this.arManager.outs.isPresenting.on("value",this.onUpdate,this)}this.requestUpdate()}};Ay=Cy([Qr("sv-ar-menu")],Ay);const Py=Ay;var Ry=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ly=class extends hm{constructor(){super(...arguments),this.sceneView=null,this.documentProps=new df("value",this.onUpdate,this),this.isMobile=null}get analytics(){return this.system.getMainComponent(Dh)}get assetManager(){return this.system.getMainComponent(Ch)}get reader(){return this.activeDocument?this.activeDocument.setup.reader:null}get tours(){return this.activeDocument?this.activeDocument.setup.tours:null}get renderer(){return this.system.getMainComponent(Ae)}get arManager(){return this.system.getMainComponent(gp)}firstConnected(){this.classList.add("sv-content-view"),this.sceneView=new yy(this.system),this.isMobile=this.mobileCheck()}connected(){super.connected(),this.assetManager.outs.busy.on("value",this.onUpdate,this)}disconnected(){this.assetManager.outs.busy.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.system,t=this.assetManager.outs.busy.value,n=this.assetManager.initialLoad;let i=!1,s=ra.Overlay,r=!1;const o=this.reader,a=this.tours,l=this.arManager.shadowRoot.querySelector("ff-viewport-overlay");l&&(null===this.arManager.shadowRoot.querySelector("sv-ar-prompt-container")&&l.append(new Ty(this.system)),null===this.arManager.shadowRoot.querySelector("sv-ar-menu")&&l.append(new Py(this.system))),a&&(r=a.ins.enabled.value&&-1===a.outs.tourIndex.value),o&&(i=!r&&o.ins.enabled.value,s=o.ins.position.value,!0===this.isMobile&&(s=ra.Overlay));const c=this.sceneView;if(i&&s===ra.Overlay||r?c.classList.contains("sv-blur")||setTimeout((()=>{c.classList.add("sv-blur"),this.renderer.views[0].render()}),1):c.classList.remove("sv-blur"),!t&&n&&(this.analytics.sendProperty("Loading.Time",this.analytics.getTimerTime()/1e3),this.analytics.resetTimer(),this.assetManager.initialLoad=!1),i){if(s===ra.Right)return _r`
-
- ${c} -
- -
-
- -
-
-
- `;if(s===ra.Overlay)return _r`
${c} -
- -
-
`}return _r`
${c}
- `}onReaderClose(){this.reader.ins.enabled.setValue(!1),this.reader.ins.closed.set()}onActiveDocument(e,t){e&&this.documentProps.off(),t&&this.documentProps.on(t.setup.reader.ins.position,t.setup.reader.ins.enabled,t.setup.tours.outs.tourIndex),this.requestUpdate()}mobileCheck(){var e,t=!1;return e=navigator.userAgent||navigator.vendor,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t}};Ly=Ry([Qr("sv-content-view")],Ly);const Ny=Ly;var Dy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Oy=class extends Zr{constructor(){super(),this.mode="radio",this.selectionIndex=-1,this.observer=new MutationObserver(this.onObserver),this.selectedButton=null,this.addEventListener("click",(e=>this.onClick(e)))}firstConnected(){this.classList.add("ff-button-group"),this.parseChildren()}connected(){this.observer.observe(this,{childList:!0})}disconnected(){this.observer.disconnect()}onObserver(e){e.forEach((e=>{"childList"===e.type&&this.parseChildren()}))}onClick(e){let t=e.target;for(;t&&t!==this&&!(t instanceof $h);)t=t.parentElement;t instanceof $h&&(t.selected?"exclusive"===this.mode&&(t.selected=!1,this.selectedButton=null,this.selectionIndex=-1):(this.selectedButton&&(this.selectedButton.selected=!1),this.selectedButton=t,this.selectedButton.selected=!0,this.selectionIndex=this.getButtons().indexOf(t)))}parseChildren(){const e=this.getButtons();this.selectedButton&&(this.selectionIndex=e.indexOf(this.selectedButton),this.selectionIndex<0&&(this.selectedButton.selected=!1,this.selectedButton=null)),(this.selectionIndex<0||this.selectionIndex>=e.length)&&(this.selectionIndex="radio"===this.mode?0:-1),this.selectionIndex>=0&&(this.selectedButton=e[this.selectionIndex],this.selectedButton.selected=!0)}getButtons(){return this.getChildrenArray().filter((e=>e instanceof $h))}};Dy([Or({type:String})],Oy.prototype,"mode",void 0),Dy([Or({type:Number})],Oy.prototype,"selectionIndex",void 0),Oy=Dy([Qr("ff-button-group")],Oy);var Iy,ky=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let zy=Iy=class extends Zr{firstConnected(){super.firstConnected(),this.classList.add("sv-logo")}render(){return _r`
${Iy.sunburst}
${Iy.sunburst}${Iy.smithsonian}
`}};zy.sunburst=_r`
si-sunburst
`,zy.smithsonian=_r`
si-text-neg
`,zy=Iy=ky([Qr("sv-logo")],zy);var Uy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Vy=class extends Zr{constructor(){super(),this.anchor=null,this.portal=null,this.position=void 0,this.align=void 0,this.justify=void 0,this.positionX=0,this.positionY=0,this.offsetX=0,this.offsetY=0,this.keepVisible=!1,this.modal=!1,this._modalPlane=null,this.onResize=this.onResize.bind(this),this.onCaptureEvent=this.onCaptureEvent.bind(this),this.onEatEvent=this.onEatEvent.bind(this)}close(){this.dispatchEvent(new CustomEvent("close"))}connected(){if(this.calculatePosition(),window.addEventListener("resize",this.onResize),this.modal){const e=this._modalPlane=this.createElement("div");e.classList.add("ff-modal-plane"),e.addEventListener("mousedown",this.onEatEvent),e.addEventListener("contextmenu",this.onEatEvent),e.addEventListener("pointerdown",this.onEatEvent),this.parentElement.appendChild(e),setTimeout((()=>e.classList.add("ff-transition")))}else document.addEventListener("mousedown",this.onCaptureEvent,{capture:!0,passive:!0})}disconnected(){window.removeEventListener("resize",this.onResize),this._modalPlane?(this._modalPlane.remove(),this._modalPlane=null):document.removeEventListener("mousedown",this.onCaptureEvent)}firstConnected(){super.firstConnected(),this.setStyle({position:"fixed",zIndex:"1000"}),this.classList.add("ff-popup")}updated(){this.isConnected&&this.calculatePosition()}calculatePosition(){let e,t;const n=this.getBoundingClientRect();let i;if(t=this.portal?this.portal.getBoundingClientRect():{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight,width:window.innerWidth,height:window.innerHeight},"center"===this.position)i=this.center(n,t);else if("anchor"===this.position){const s=this.anchor||this.parentElement;s&&(e=s.getBoundingClientRect(),i=this.positionToAnchor(n,e,t))}else i={x:this.positionX,y:this.positionY};this.keepVisible&&"center"!==this.position&&(i=this.keepElementVisible(i,n,t)),this.style.left=Math.round(i.x)+"px",this.style.top=Math.round(i.y)+"px"}center(e,t){return{x:Math.round(.5*(t.width-e.width)),y:Math.round(.5*(t.height-e.height))}}positionToAnchor(e,t,n){const i=this.align,s=this.justify,r=this.offsetX,o=this.offsetY,a={x:0,y:0};switch(i){case"start":a.x="start"!==s&&"end"!==s?t.left-e.width-r:t.left;break;case"end":a.x="start"!==s&&"end"!==s?t.right+r:t.right-e.width;break;case"fixed":a.x=this.positionX;break;default:a.x=t.left+.5*(t.width-e.width)}switch(s){case"start":a.y=t.top-e.height-o;break;case"end":a.y=t.bottom+o;break;case"fixed":a.y=this.positionY;break;default:a.y=t.top+.5*(t.height-e.height)}return a.x+=this.offsetX,a.y+=this.offsetY,a}keepElementVisible(e,t,n){const i=this.offsetX,s=this.offsetY;return t.width>n.width?e.x=.5*(n.width-t.width):e.xn.right&&(e.x=n.right-t.width-i),t.height>n.height?e.y=.5*(n.height-t.height):e.yn.bottom&&(e.y=n.bottom-t.height-s),e}onResize(){this.calculatePosition()}onCaptureEvent(e){e.target instanceof Node&&this.contains(e.target)||this.close()}onEatEvent(e){console.log("Popup.onEatEvent"),e.stopPropagation(),e.preventDefault()}};Uy([Or({attribute:!1})],Vy.prototype,"anchor",void 0),Uy([Or({attribute:!1})],Vy.prototype,"portal",void 0),Uy([Or({type:String})],Vy.prototype,"position",void 0),Uy([Or({type:String})],Vy.prototype,"align",void 0),Uy([Or({type:String})],Vy.prototype,"justify",void 0),Uy([Or({type:Number})],Vy.prototype,"positionX",void 0),Uy([Or({type:Number})],Vy.prototype,"positionY",void 0),Uy([Or({type:Number})],Vy.prototype,"offsetX",void 0),Uy([Or({type:Number})],Vy.prototype,"offsetY",void 0),Uy([Or({type:Boolean})],Vy.prototype,"keepVisible",void 0),Uy([Or({type:Boolean})],Vy.prototype,"modal",void 0),Vy=Uy([Qr("ff-popup")],Vy);const Fy=Vy;var By=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let jy=class extends Zr{constructor(){super(...arguments),this.name="",this.index=0,this.text="",this.placeholder="",this.readonly=!1,this.align="left",this.initialValue=""}get textArea(){return this.getElementsByTagName("textarea").item(0)}select(){const e=this.textArea;e&&e.select()}focus(){const e=this.textArea;e&&e.focus()}blur(){const e=this.textArea;e&&e.blur()}hasFocus(){const e=document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement;return this.textArea===e}firstConnected(){this.classList.add("ff-control","ff-text-edit")}shouldUpdate(e){return!this.hasFocus()&&super.shouldUpdate(e)}render(){var e;return _r``}onKeyDown(e){const t=e.target;"Escape"===e.key&&(this.revert(t),t.blur())}onChange(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!1)}onInput(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!0)}onFocus(e){this.initialValue=e.target.value}onBlur(e){this.commit(e.target),this.requestUpdate()}revert(e){e.value=this.initialValue,this.dispatchChangeEvent(e.value,!1)}commit(e){this.initialValue=e.value,this.dispatchChangeEvent(e.value,!1)}dispatchChangeEvent(e,t){this.dispatchEvent(new CustomEvent("change",{detail:{text:e,isEditing:t}}))}};By([Or({type:String})],jy.prototype,"name",void 0),By([Or({type:Number})],jy.prototype,"index",void 0),By([Or({type:String})],jy.prototype,"text",void 0),By([Or({type:String})],jy.prototype,"placeholder",void 0),By([Or({type:Boolean})],jy.prototype,"readonly",void 0),By([Or({type:String})],jy.prototype,"align",void 0),jy=By([Qr("ff-text-edit")],jy);var $y,Hy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Gy=$y=class extends Fy{constructor(e){super(),this.language=null,this.needsFocus=!1,this.language=e,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t){const n=new $y(t);return e.appendChild(n),new Promise(((e,t)=>{n.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-share-menu"),this.needsFocus=!0}render(){const e=encodeURIComponent(this.url),t=encodeURI("Smithsonian Voyager"),n=this.language,i=`http://twitter.com/share?text=${t}&url=${e}`,s=`https://www.facebook.com/sharer/sharer.php?u=${e}`,r=`https://www.linkedin.com/shareArticle?url=${e}&mini=true&title=${t}`,o=``,a=`mailto:?subject=${t}&body=${e}`,l=n.getLocalizedString("Share Experience");return _r` -
this.onKeyDown(e)}> -
-
${l}
- -
-
- - - - -
-
${n.getLocalizedString("Embed Link")}
- -
- `}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-share-button-twitter").item(0).focus(),this.needsFocus=!1}}onClickCopy(){this.getElementsByTagName("ff-text-edit").item(0).select(),document.execCommand("copy")}onKeyDown(e){"Escape"===e.code?(e.preventDefault(),this.close()):"Tab"===e.code&&Wm(Gm(this),e)}};Gy=$y=Hy([Qr("sv-share-menu")],Gy);const Wy=Gy;var qy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Xy=class extends hm{constructor(){super(...arguments),this.documentProps=new df("value",this.onUpdate,this),this.shareButtonSelected=!1,this.resizeObserver=null,this.isClipped=!1}get fullscreen(){return this.system.getMainComponent($)}get toolProvider(){return this.system.getMainComponent(fm)}get analytics(){return this.system.getMainComponent(Dh)}get arManager(){return this.system.getMainComponent(gp)}get sceneNode(){return this.system.getComponent(op)}firstConnected(){super.firstConnected(),this.classList.add("sv-main-menu")}connected(){super.connected(),this.fullscreen.outs.fullscreenActive.on("value",this.onUpdate,this),this.toolProvider.ins.visible.on("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.on("value",this.onUpdate,this),this.activeDocument.setup.tours.ins.closed.on("value",this.setTourFocus,this),this.activeDocument.setup.reader.ins.closed.on("value",this.setReaderFocus,this),this.toolProvider.ins.closed.on("value",this.setToolsFocus,this),this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>this.onResize()))),this.resizeObserver.observe(this)}disconnected(){this.resizeObserver.disconnect(),this.toolProvider.ins.closed.off("value",this.setToolsFocus,this),this.activeDocument.setup.reader.ins.closed.off("value",this.setReaderFocus,this),this.activeDocument.setup.tours.ins.closed.off("value",this.setTourFocus,this),this.activeDocument.setup.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.ins.visible.off("value",this.onUpdate,this),this.fullscreen.outs.fullscreenActive.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.activeDocument;if(!e)return _r``;const t=!!this.system.getComponent("CVStoryApplication",!0),n=e.setup,i=this.sceneNode,s=n.tours.outs.count.value>0,r=n.tours.ins.enabled.value,o=r&&!t,a=n.reader.articles.length>0,l=n.reader.ins.enabled.value,c=i.getGraphComponents(Tu).some((e=>e.hasAnnotations)),h=n.viewer.ins.annotationsVisible.value,u=this.fullscreen,d=u.outs.fullscreenAvailable.value,p=u.outs.fullscreenActive.value,m=n.interface.ins.tools.value,f=this.toolProvider.ins.visible.value,g=n.audio.outs.narrationEnabled.value,v=n.audio.outs.narrationPlaying.value,y=n.language,b=i.getGraphComponents(Zd),x=b[0]?b[0].derivatives.getByQuality(Wo.AR):[],_=this.arManager.outs.available.value&&x.length>0&&b.length>=1;return _r` - ${_?_r``:null} - ${g?_r``:null} - ${s?_r``:null} - ${a?_r``:null} - ${c?_r``:null} - - ${d?_r``:null} - ${m?_r``:null}`}onToggleReader(){const e=this.activeDocument.setup.reader.ins;e.enabled.setValue(!e.enabled.value),e.focus.setValue(e.enabled.value),this.analytics.sendProperty("Reader.Enabled",e.enabled.value)}onToggleTours(){const e=this.activeDocument.setup.tours.ins,t=this.activeDocument.setup.reader.ins;e.enabled.value?e.enabled.setValue(!1):(t.enabled.value&&t.enabled.setValue(!1),e.enabled.setValue(!0),e.tourIndex.setValue(-1)),this.analytics.sendProperty("Tours.Enabled",e.enabled.value)}onToggleAnnotations(){const e=this.toolProvider.ins,t=this.activeDocument.setup.viewer.ins;e.visible.value&&e.visible.setValue(!1),t.annotationsVisible.setValue(!t.annotationsVisible.value),this.analytics.sendProperty("Annotations.Visible",t.annotationsVisible.value)}onToggleShare(){this.shareButtonSelected||(this.shareButtonSelected=!0,this.requestUpdate(),Wy.show(this,this.activeDocument.setup.language).then((()=>{this.shareButtonSelected=!1,this.requestUpdate(),this.setElementFocus("share-btn")})),this.analytics.sendProperty("Menu.Share"))}onToggleFullscreen(){this.fullscreen.toggle(),this.analytics.sendProperty("Menu.Fullscreen")}onToggleTools(){const e=this.toolProvider.ins,t=this.activeDocument.setup.viewer.ins;t.annotationsVisible.value&&t.annotationsVisible.setValue(!1),e.visible.setValue(!e.visible.value),this.analytics.sendProperty("Tools.Visible",e.visible.value)}onEnterAR(){this.arManager.ins.enabled.setValue(!0)}onToggleNarration(){const e=this.activeDocument.setup.audio;e.setupAudio(),e.ins.playNarration.set()}setTourFocus(){this.setElementFocus("tour-btn")}setReaderFocus(){this.setElementFocus("reader-btn")}setToolsFocus(){this.setElementFocus("tools-btn")}setElementFocus(e){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).find((t=>t.id===e));void 0!==n?n.focus():console.warn("Can't focus. Element ["+e+"] not found.")}onActiveDocument(e,t){if(e&&this.documentProps.off(),t){const e=t.setup;this.documentProps.on(e.interface.ins.tools,e.reader.ins.enabled,e.reader.outs.count,e.tours.ins.enabled,e.tours.outs.count,e.viewer.ins.annotationsVisible,e.audio.outs.narrationPlaying,this.toolProvider.ins.visible)}this.requestUpdate()}onResize(){const e=this.scrollHeight>this.clientHeight;this.isClipped!==e&&(e&&this.scrollTo({top:this.scrollTop+this.scrollHeight,behavior:"smooth"}),this.isClipped=e)}};Xy=qy([Qr("sv-main-menu")],Xy);var Yy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ky=class extends cm{constructor(){super(...arguments),this.needsFocus=!1}get toolProvider(){return this.system.getMainComponent(fm)}get language(){return this.system.getComponent(Lh)}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tool-bar"),this.needsFocus=!0}connected(){super.connected(),this.toolProvider.on("active-component",this.onUpdate,this),this.language.outs.language.on("value",this.onUpdate,this)}disconnected(){this.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.off("active-component",this.onUpdate,this),super.disconnected()}render(){const e=this.toolProvider.scopedComponents,t=this.toolProvider.activeComponent,n=this.language,i=(t&&_r`
`,e.map((e=>_r`this.onSelectTool(e)}>`)));return _r`
this.onKeyDownTool(e)}>${t?t.createView():null}
-
`}onSelectTool(e){this.toolProvider.activeComponent=e}onClose(e){this.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-tool-button").item(0).focus(),this.needsFocus=!1}}onKeyDownMain(e){if("Escape"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("close"));else if("Tab"===e.code){const t=Array.from(this.getElementsByTagName("div")).find((e=>"mainmenu"===e.id));Wm(Gm(t),e)}}onKeyDownTool(e){if("Escape"===e.code)e.preventDefault(),this.closeTool();else if("Tab"===e.code){const t=Array.from(this.getElementsByTagName("div")).find((e=>"toolmenu"===e.id));Wm(Gm(t),e)}}closeTool(){const e=this.getElementsByTagName("ff-button");Array.from(e).find((e=>e.getAttribute("text")===this.language.getLocalizedString(this.toolProvider.activeComponent.text))).focus(),this.toolProvider.activeComponent=null}};Ky=Yy([Qr("sv-tool-bar")],Ky);var Jy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Zy=class extends hm{constructor(){super(...arguments),this.needsFocus=!1,this.firstRender=!0,this.stepTitle=""}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tour-navigator","sv-transition"),setTimeout((()=>this.classList.remove("sv-transition")),1),this.needsFocus=!0}render(){const e=this.tours,t=this.language,n=e.activeTour;let i,s;if(e&&n){const n=e.outs.stepIndex.value+1,r=e.outs.stepCount.value;i=r>0?e.stepTitle:e.title,s=r>0?`${t.getLocalizedString("Step")} ${n} ${t.getLocalizedString("of")} ${r}`:t.getLocalizedString("No tour steps defined")}else i=t.getLocalizedString("No tour selected"),s="---";return this.stepTitle=i,_r`
this.onKeyDown(e)}>
- -
-
${i}
-
${s}
-
- - - -
`}updated(e){if(super.updated(e),this.needsFocus){this.getElementsByClassName("sv-section-trail").item(2).focus(),this.needsFocus=!1}const t=this.getElementsByClassName("sv-title").item(0);t&&(t.innerHTML=this.stepTitle,this.firstRender&&(setTimeout((()=>{t.innerHTML=`
${this.stepTitle}
`}),100),this.firstRender=!1))}onClickExit(){this.tours.ins.enabled.setValue(!1),this.tours.ins.closed.set()}onClickMenu(){this.tours.ins.tourIndex.setValue(-1)}onClickPrevious(){this.tours.ins.previous.set()}onClickNext(){this.tours.ins.next.set()}onActiveDocument(e,t){e&&(this.tours.outs.tourIndex.off("value",this.onUpdate,this),this.tours.outs.stepIndex.off("value",this.onUpdate,this),this.language.outs.language.off("value",this.onUpdate,this)),t&&(this.tours=t.setup.tours,this.language=t.setup.language,this.tours.outs.tourIndex.on("value",this.onUpdate,this),this.tours.outs.stepIndex.on("value",this.onUpdate,this),this.language.outs.language.on("value",this.onUpdate,this)),this.requestUpdate()}onKeyDown(e){"Escape"===e.code?(e.preventDefault(),this.tours.ins.tourIndex.setValue(-1)):"Tab"===e.code&&Wm(Gm(this),e)}};Zy=Jy([Qr("sv-tour-navigator")],Zy);var Qy=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let eb=class extends Zr{constructor(){super(...arguments),this.needsFocus=!1,this.focusableElements=[]}firstConnected(){super.firstConnected(),this.classList.add("sv-document-overlay","sv-article","sv-tour-menu"),this.needsFocus=!0}renderEntry(e,t){return _r`
this.onKeyDown(e,t)} class="sv-entry" @click=${e=>this.onClickTour(e,t)}> -

${Object.keys(e.titles).length>0?e.titles[vs[this.activeLanguage]]:e.title}

-

${Object.keys(e.leads).length>0?e.leads[vs[this.activeLanguage]]:e.lead}

-
`}render(){const e=this.tours;return 0===e.length?_r`
-

No tours available.

-
`:_r`
- ${e.map(((e,t)=>this.renderEntry(e,t)))} -
`}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-entry").item(0).focus(),this.needsFocus=!1}}onClickTour(e,t){e.stopPropagation(),this.dispatchEvent(new CustomEvent("select",{detail:{index:t}}))}onKeyDown(e,t){if("Space"===e.code||"Enter"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("select",{detail:{index:t}}));else if("Escape"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{index:t}}));else if("Tab"===e.code)0===this.focusableElements.length&&(this.focusableElements=Gm(this)),Wm(this.focusableElements,e);else if("ArrowUp"===e.code||"ArrowDown"===e.code){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}}};Qy([Or({attribute:!1})],eb.prototype,"tours",void 0),Qy([Or({attribute:!1})],eb.prototype,"activeLanguage",void 0),eb=Qy([Qr("sv-tour-menu")],eb);var tb,nb=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let ib=tb=class extends Fy{constructor(e){super(),this.language=null,this.language=e,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t){const n=new tb(t);return e.appendChild(n),new Promise(((e,t)=>{n.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-language-menu","sv-option-menu")}renderEntry(e,t){const n=e.name===this.language.toString();return _r`
this.onClickLanguage(e,t)} @keydown=${e=>this.onKeyDownEntry(e,t)} ?selected=${n}> - ${e.name} -
`}render(){const e=this.language;return _r` -
this.onKeyDownMain(e)}> -
-
${e.getLocalizedString("Set Language")}
- -
-
-
- ${e.activeLanguages.map(((e,t)=>this.renderEntry(e,t)))} -
-
-
- `}firstUpdated(e){super.firstUpdated(e),Array.from(this.getElementsByClassName("sv-entry")).find((e=>"0"===e.getAttribute("tabIndex"))).focus()}onClickLanguage(e,t){const n=this.language;e.stopPropagation(),n.ins.language.setValue(n.activeLanguages[t].id),this.close()}onKeyDownEntry(e,t){const n=this.language;if("Space"===e.code||"Enter"===e.code)e.preventDefault(),e.stopPropagation(),n.ins.language.setValue(n.activeLanguages[t].id),this.close();else if("ArrowUp"===e.code||"ArrowDown"===e.code){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}else"Tab"===e.code&&this.addEventListener("blur",this.tabReset,{once:!0,capture:!0})}onKeyDownMain(e){"Escape"===e.code?this.close():"Tab"===e.code&&Wm(Gm(this),e)}tabReset(e){const t=e.target instanceof Element?e.target:null;if(t){const e=Array.from(t.parentElement.children).find((e=>e.hasAttribute("selected")));e!==t&&(t.setAttribute("tabIndex","-1"),e.setAttribute("tabIndex","0"))}}};ib=tb=nb([Qr("sv-language-menu")],ib);const sb=ib;var rb=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let ob=class extends hm{get activeTags(){return this.viewer?this.viewer.ins.activeTags.value.split(",").map((e=>e.trim())).filter((e=>!!e)):[]}get tagCloud(){return this.viewer?this.viewer.outs.tagCloud.value.split(",").map((e=>e.trim())).filter((e=>!!e)):[]}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tag-cloud","sv-transition"),setTimeout((()=>this.classList.remove("sv-transition")),1)}render(){const e=this.activeTags,t=this.tagCloud.map((t=>_r`=0} - @click=${e=>this.onSelectTag(t)}>`));return _r`
- -
${t}
-
`}onClickClose(){this.viewer.ins.annotationsVisible.setValue(!1)}onSelectTag(e){let t=this.activeTags;const n=this.viewer.ins.radioTags.value,i=t.indexOf(e);i>=0&&!n?t.splice(i,1):i<0&&(n?t=[e]:t.push(e)),this.viewer.ins.activeTags.setValue(t.join(", "))}onActiveDocument(e,t){e&&(this.viewer.ins.activeTags.off("value",this.onUpdate,this),this.viewer.outs.tagCloud.off("value",this.onUpdate,this)),t&&(this.viewer=t.setup.viewer,this.viewer.ins.activeTags.on("value",this.onUpdate,this),this.viewer.outs.tagCloud.on("value",this.onUpdate,this))}};ob=rb([Qr("sv-tag-cloud")],ob);var ab=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let lb=class extends hm{constructor(){super(...arguments),this.documentProps=new df("value",this.onUpdate,this)}get toolProvider(){return this.system.getMainComponent(fm)}firstConnected(){this.style.pointerEvents="none",this.setAttribute("pointer-events","none"),this.classList.add("sv-chrome-view")}connected(){super.connected(),this.toolProvider.ins.visible.on("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.on("value",this.onUpdate,this),this.titleElement=this.createElement("div",null),this.titleElement.classList.add("ff-ellipsis")}disconnected(){this.activeDocument.setup.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.ins.visible.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.activeDocument,t=this.titleElement;if(!e)return _r``;const n=e.setup,i=n.interface.ins.visible.value,s=n.interface.ins.logo.value&&n.interface.isShowing(Pu.logo),r=n.interface.ins.menu.value&&n.interface.isShowing(Pu.menu),o=n.interface.ins.visibleElements.value&&n.interface.isShowing(Pu.title),a=n.reader.ins.enabled.value,l=n.tours.tours,c=n.tours.ins.enabled.value,h=n.tours.outs.tourIndex.value>=0,u=n.language,d=u.activeLanguages,p=u.outs.language.value,m=d.length>1&&n.interface.isShowing(Pu.language),f=!!this.system.getComponent("CVStoryApplication",!0)||!c,g=n.viewer.ins.annotationsVisible.value&&n.viewer.outs.tagCloud.value,v=!a&&this.toolProvider.ins.visible.value,y=this.activeDocument.setup.tours.outs.ending.value;if(this.activeDocument.setup.tours.outs.ending.setValue(!1),!i)return _r``;let b;return b=c?h?u.getLocalizedString("Tour")+": "+n.tours.outs.tourTitle.value:u.getLocalizedString("Interactive Tours"):e.outs.title.value||"Missing Title",t.innerHTML=b,_r`${y?_r``:null} -
-
- ${r?_r``:null} -
-
- ${o?_r`
${t}
`:null} - ${s?_r``:null} -
-
-
- ${c&&h?_r``:null} - ${c&&!h?_r``:null} - ${g&&f?_r``:null} - ${v&&f?_r`
`:null} - `}onSelectTour(e){this.activeDocument.setup.tours.ins.tourIndex.setValue(e.detail.index)}closeTours(){const e=this.activeDocument.setup.tours;e.ins.enabled.setValue(!1),e.ins.closed.set()}openLanguageMenu(){const e=this.activeDocument.setup.language;e.ins.enabled.value||(e.ins.enabled.setValue(!0),sb.show(this,this.activeDocument.setup.language).then((()=>{e.ins.enabled.setValue(!1),this.getElementsByClassName("sv-language-display")[0].focus()})))}closeTools(){const e=this.toolProvider.ins;e.visible.setValue(!1),e.closed.set()}onActiveDocument(e,t){if(e&&this.documentProps.off(),t){const e=t.setup;this.documentProps.on(t.outs.title,t.outs.assetPath,e.interface.ins.visible,e.interface.ins.logo,e.interface.ins.menu,e.viewer.ins.annotationsVisible,e.reader.ins.enabled,e.tours.ins.enabled,e.tours.outs.tourIndex)}this.requestUpdate()}};lb=ab([Qr("sv-chrome-view")],lb);const cb=lb;var hb=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};io.add("globe",_r``),io.add("cog",_r``),io.add("eye",_r``),io.add("palette",_r``),io.add("comment",_r``),io.add("article",_r``),io.add("document",_r``),io.add("share",_r``),io.add("expand",_r``),io.add("zoom",_r``),io.add("tools",_r``),io.add("environment",_r``),io.add("bulb",_r``),io.add("tape",_r``),io.add("knife",_r``),io.add("bars",_r``),io.add("triangle-left",_r``),io.add("triangle-right",_r``),io.add("twitter",_r``),io.add("facebook",_r``),io.add("instagram",_r``),io.add("linkedin",_r``),io.add("email",_r``),io.add("copy",_r``),io.add("ar",_r``),io.add("device-move",_r``),io.add("audio",_r``);let ub=class extends Zr{constructor(e){super(),this.application=null,e&&(this.application=e),this.addEventListener("focus",this.onFocus)}static get observedAttributes(){return["root"]}get fullscreen(){return this.application.system.getMainComponent($)}get arManager(){return this.application.system.getMainComponent(gp)}get viewer(){return this.application.system.getComponent(Lu)}firstConnected(){if(super.firstConnected(),!this.application){const e={root:this.getAttribute("root"),dracoRoot:this.getAttribute("dracoRoot"),resourceRoot:this.getAttribute("resourceRoot"),document:this.getAttribute("document"),model:this.getAttribute("model"),geometry:this.getAttribute("geometry"),texture:this.getAttribute("texture"),quality:this.getAttribute("quality"),uiMode:this.getAttribute("uiMode"),bgColor:this.getAttribute("bgColor"),bgStyle:this.getAttribute("bgStyle"),controls:this.getAttribute("controls"),lang:this.getAttribute("lang")};this.application=new uf(null,e)}this.attachShadow({mode:"open"});const e=this.shadowRoot;this.arManager.shadowRoot=e;var t=document.createElement("style");t.innerText='/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:normal;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.ff-fullsize{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.ff-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden}.ff-fullsize{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.ff-caret-down{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(180deg);transition:transform 0.05s}.ff-caret-up{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(0deg);transition:transform 0.05s}.ff-caret-right{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(90deg);transition:transform 0.05s}.ff-caret-left{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(270deg);transition:transform 0.05s}html{color:#c8c8c8}button,input{display:block;padding:0;margin:0;border:none;background-color:inherit;color:inherit;font-size:inherit;cursor:inherit}*:focus{outline:1px solid #0089bf;outline-offset:0}*:focus:not(:focus-visible){outline:0}*:focus-visible{outline:1px solid #0089bf;outline-offset:0}.ff-fullscreen{position:fixed;left:0;right:0;top:0;bottom:0}.ff-noselect{user-select:none;-moz-user-select:none;-webkit-user-select:none}.ff-off{user-select:none;-moz-user-select:none;-webkit-user-select:none;pointer-events:none}.ff-on{user-select:auto;-webkit-user-select:none;pointer-events:auto}.ff-focusable{tab-index:0}.ff-flex-row{display:flex}.ff-flex-column{display:flex;flex-direction:column}.ff-flex-wrap{flex-wrap:wrap}.ff-flex-centered{align-items:center}.ff-flex-item-fixed{flex:0 0 auto;position:relative}.ff-flex-item-stretch,.ff-flex-spacer{flex:1 1 auto;position:relative}.ff-scroll-y{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow-y:auto}.ff-position-above{position:absolute;bottom:0}.ff-position-below{position:absolute;top:100%}.ff-position-left{position:absolute;right:0}.ff-position-right{position:absolute;left:100%}.ff-position-above.ff-align-left,.ff-position-below.ff-align-left{left:0}.ff-position-above.ff-align-right,.ff-position-below.ff-align-right{right:0}.ff-position-left.ff-align-top,.ff-position-right.ff-align-top{top:0}.ff-position-left.ff-align-bottom,.ff-position-right.ff-align-bottom{bottom:0}.ff-ellipsis{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ff-placeholder{flex:1 1 auto;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.ff-splitter-section{flex:1 1 auto;position:relative;box-sizing:border-box;overflow:hidden}.ff-splitter[direction="vertical"]+.ff-splitter-section{border-top:2px solid #1b1b1b}.ff-splitter:not([direction="vertical"])+.ff-splitter-section{border-left:2px solid #1b1b1b}.ff-frame{padding:4px}.ff-frame .ff-control{margin:4px}.ff-icon{display:inline-block;position:relative;height:1rem;fill:#a0a0a0}.ff-icon svg{width:inherit;height:inherit}.ff-button{cursor:pointer}.ff-button[vertical]{flex-direction:column}.ff-button.ff-inline .ff-icon+.ff-text{padding-left:0.5em}.ff-button.ff-inline .ff-icon{display:inline}.ff-button.ff-inline .ff-text{display:inline}.ff-button.ff-transparent{position:relative;display:flex;justify-content:center;align-items:center;flex:0 1 auto;flex-wrap:wrap;padding:5px;background:transparent;fill:#a0a0a0;transition:fill 0.2s}.ff-button.ff-transparent:hover,.ff-button.ff-transparent:focus{fill:#c8c8c8}.ff-button.ff-transparent[selected]{fill:#c8c8c8}.ff-button.ff-transparent>.ff-text{margin:3px;white-space:nowrap}.ff-button.ff-transparent>.ff-icon{margin:3px;height:1.3em}.ff-button.ff-transparent>.ff-caret-down{margin:3px}.ff-button.ff-transparent.ff-disabled{color:gray;fill:#606060;user-select:none;pointer-events:none}.ff-button.ff-control{position:relative;display:flex;justify-content:center;align-items:center;flex:1 1 auto;flex-wrap:wrap;padding:5px;background:#4e4e4e;transition:background-color 0.2s}.ff-button.ff-control:hover,.ff-button.ff-control:focus{background-color:#676767}.ff-button.ff-control[selected]{background-color:#0089bf}.ff-button.ff-control[selected]:hover,.ff-button.ff-control[selected]:focus{background-color:#00a6e8}.ff-button.ff-control>.ff-text{margin:3px;white-space:nowrap}.ff-button.ff-control>.ff-icon{margin:3px;height:1.3em}.ff-button.ff-control>.ff-caret-down{margin:3px}.ff-button.ff-control.ff-disabled{color:gray;fill:#606060;user-select:none;pointer-events:none}.ff-button.ff-control.ff-disabled>.ff-icon{fill:#606060}.ff-menu{background-color:#4e4e4e;z-index:100;display:flex;flex-direction:column}.ff-menu .ff-divider{height:1px;padding:0;background:#a0a0a0}.ff-menu .ff-button{justify-content:flex-start;margin:0;padding:4px 4px}.ff-menu .ff-button .ff-icon{height:1.2em;width:2.2em;margin-right:4px}.ff-dropdown .ff-menu{min-width:100%;margin-top:3px}.ff-modal-plane{position:fixed;left:0;right:0;top:0;bottom:0;background-color:rgba(0,0,0,0.6);opacity:0;transition:opacity .3s;z-index:990;pointer-events:auto}.ff-modal-plane.ff-transition{opacity:1}ff-dialog{box-sizing:border-box;background:#343434;border:1px solid #4e4e4e;box-shadow:3px 3px 24px rgba(0,0,0,0.4)}ff-title-bar{background:#1b1b1b;padding:2px}ff-title-bar .ff-text{flex:1 1 auto;padding-right:8px}ff-title-bar .ff-icon{padding:2px}ff-popup-button .ff-content{transition:opacity .15s}.ff-line-edit{display:block;overflow:hidden;background-color:#1b1b1b;min-height:1.2em}.ff-line-edit input{padding:2px}.ff-text-edit{box-sizing:border-box;flex:1 1 auto;display:flex;background-color:#1b1b1b}.ff-text-edit textarea{display:block;box-sizing:border-box;width:100%;padding:2px;resize:none;background:transparent;color:inherit;border:none}.ff-color-edit{font-size:0.8rem}.ff-color-edit .ff-control{margin:0}.ff-color-edit .ff-slider-controls{align-items:stretch;flex:1 1 auto}.ff-color-edit .ff-numeric-controls{flex:0 0 auto;align-items:center;margin-top:6px}.ff-color-edit .ff-text{color:#a0a0a0;margin:0 3px}.ff-color-edit .ff-line-edit{flex:4 5 auto}.ff-color-edit .ff-line-edit.ff-wide{flex:5 4 auto}.ff-color-edit .ff-knob{margin:-2px 0 0 -2px;border:2px solid white;box-shadow:0 0 5px rgba(0,0,0,0.5)}.ff-color-edit .ff-vector-slider{flex:1 0 auto;padding:0 10px 10px 0;background-image:linear-gradient(to bottom, transparent, black),linear-gradient(to right, white, red)}.ff-color-edit .ff-vector-slider .ff-knob{width:10px;height:10px}.ff-color-edit .ff-linear-slider{flex:0 0 24px;margin-left:6px;padding-bottom:10px}.ff-color-edit .ff-linear-slider .ff-knob{width:100%;height:10px}.ff-color-edit .ff-hue-slider{background:linear-gradient(to bottom, red, #ff0, lime, cyan, blue, #f0f, red)}.ff-color-edit .ff-alpha-slider{color:#4e4e4e}.ff-quad-splitter .ff-left{box-sizing:border-box;border-right:1px solid #343434}.ff-quad-splitter .ff-top{box-sizing:border-box;border-bottom:1px solid #343434}#ff-notification-stack{position:fixed;z-index:100;bottom:0;right:0;width:30%;min-width:250px;max-width:500px}.ff-notification{position:relative;left:0;display:flex;margin:8px;padding:4px;background:#4e4e4e;box-shadow:0 0 20px rgba(0,0,0,0.35)}.ff-notification.ff-info>.ff-icon{fill:#73adff}.ff-notification.ff-success>.ff-icon{fill:#8ae65c}.ff-notification.ff-warning>.ff-icon{fill:#e6a345}.ff-notification.ff-error>.ff-icon{fill:#e64545}.ff-notification>.ff-icon{height:2em;padding:8px}.ff-notification.ff-out{transition:left 0.5s ease-in;left:100%}.ff-notification .ff-text{flex:1;padding:8px;text-overflow:ellipsis;overflow:hidden}.ff-notification .ff-button{flex:0;padding:8px}.ff-message-box{position:relative;min-width:350px;max-width:450px;width:90%;padding:16px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);opacity:0;transition:opacity .15s}.ff-message-box.ff-transition{opacity:1}.ff-message-box .ff-title{align-items:flex-start}.ff-message-box .ff-title .ff-type-icon{margin:0 16px 0 0;height:2.5em}.ff-message-box .ff-title .ff-type-icon[name="prompt"]{fill:#e6cf5c}.ff-message-box .ff-title .ff-type-icon[name="info"]{fill:#73adff}.ff-message-box .ff-title .ff-type-icon[name="warning"]{fill:#e6a345}.ff-message-box .ff-title .ff-type-icon[name="error"]{fill:#e64545}.ff-message-box .ff-title .ff-content{flex:1 1 auto;margin:0 0 2em 0}.ff-message-box .ff-title .ff-caption{font-size:1.5em}.ff-message-box .ff-title .ff-text{margin:2em 0 1em 0}.ff-message-box .ff-title .ff-line-edit{margin:0 0 1em 0}.ff-message-box .ff-title .ff-line-edit input{padding:4px}.ff-message-box .ff-title .ff-close-button{margin:0 0 0 16px;padding:0}.ff-message-box .ff-button+.ff-button{margin-left:8px}.ff-popup-options{box-sizing:border-box;background:#343434;border:1px solid #4e4e4e;box-shadow:3px 3px 24px rgba(0,0,0,0.4);min-width:6rem}.ff-popup-options button{padding:4px 8px;text-align:start;user-select:none}.ff-popup-options button+button{margin-top:1px}.ff-popup-options button:hover{background-color:#4e4e4e}.ff-popup-options button:focus{outline:none;background-color:#0089bf}.ff-list{flex:1 1 auto;background-color:#272727}.ff-list .ff-list-item{cursor:pointer;user-select:none;padding:2px}.ff-list .ff-list-item:hover{background-color:#343434}.ff-list .ff-list-item[selected]{background-color:#0089bf}.ff-list .ff-list-item+.ff-list-item{border-top:1px solid #343434}.ff-table{position:relative;box-sizing:border-box;width:100%}.ff-table table{box-sizing:border-box;width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0}.ff-table tr[selected]{background-color:#0089bf}.ff-table th,.ff-table td{padding:4px}.ff-table th{background-color:#1b1b1b;color:#a0a0a0;text-align:start}.ff-table .ff-table-sort-icon{height:0.8em;margin-left:4px;color:#a0a0a0}.ff-tree{position:relative;overflow-y:auto}.ff-tree .ff-tree-node-container{margin-left:-501px;border-top:1px solid #3e3e3e;border-bottom:1px solid #3e3e3e;margin-bottom:-1px}.ff-tree .ff-tree-node{margin-left:500px}.ff-tree .ff-tree-node.ff-inner{background-color:#2f2f2f}.ff-tree .ff-tree-node.ff-leaf{background-color:#3c3c3c}.ff-tree .ff-tree-node.ff-root{background-color:#272727}.ff-tree .ff-tree-node[selected]{background-color:#0089bf}.ff-tree .ff-tree-node .ff-header{position:relative;cursor:pointer;padding-left:14px}.ff-tree .ff-tree-node .ff-header .ff-text{user-select:none}.ff-tree .ff-tree-node.ff-drop-target>.ff-header{outline:1px dashed #0089bf}.ff-tree .ff-tree-node.ff-inner[expanded]>.ff-header:before{content:\'\';position:absolute;top:0.6em;left:3px;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #a0a0a0;transform:rotate(180deg);transition:transform 0.05s}.ff-tree .ff-tree-node.ff-inner:not([expanded])>.ff-header:before{content:\'\';position:absolute;top:0.6em;left:3px;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #a0a0a0;transform:rotate(90deg);transition:transform 0.05s}.ff-tree .ff-tree-node.ff-leaf .ff-header{cursor:default}.ff-tree .ff-tree-node .ff-content{margin-left:10px}.ff-tree .ff-tree-node:not([expanded])>.ff-content{display:none}ff-tab-container{background:#343434}ff-tab-container,ff-dock-stack{background:#272727;border:1px solid #1b1b1b}ff-tab-container header,ff-dock-stack header{background:#1b1b1b}ff-tab-header,ff-dock-panel-header{background:#1b1b1b;color:#c8c8c8;padding:1px 3px 2px 2px}ff-tab-header[active],ff-dock-panel-header[active]{background:linear-gradient(#626262, #343434);color:#c8c8c8}ff-tab-header label,ff-dock-panel-header label{pointer-events:none}ff-tab-header .ff-text,ff-dock-panel-header .ff-text{padding:0 1px}ff-tab-header .ff-icon,ff-dock-panel-header .ff-icon{top:1px;height:0.8rem;padding:0 1px}.ff-dock-drop-marker{box-sizing:border-box;background:rgba(0,137,191,0.3);border:1px solid #0089bf}.ff-viewport-overlay{padding:6px;font-size:0.75rem}.ff-viewport-overlay .ff-row{display:flex;justify-content:space-between}.ff-viewport-overlay .ff-labels{display:flex;flex-direction:column}.ff-viewport-overlay .ff-top-left,.ff-viewport-overlay .ff-bottom-left{align-items:flex-start}.ff-viewport-overlay .ff-top-center,.ff-viewport-overlay .ff-bottom-center{align-items:center}.ff-viewport-overlay .ff-top-right,.ff-viewport-overlay .ff-bottom-right{align-items:flex-end}.ff-viewport-overlay .ff-label-box{box-sizing:border-box;padding:1px 8px 2px 8px;background:rgba(0,0,0,0.5);border-radius:2em}.sv-article h1{margin:0.3em 0;font-family:"Amiri", serif;font-size:2.3em;font-weight:normal;color:#e8e8e8}.sv-article h1:before{content:"";position:absolute;top:0;left:0;width:75px;height:5px;background-color:#0089bf}.sv-article p,.sv-article h2,.sv-article h3,.sv-article h4,.sv-article h5,.sv-article h6,.sv-article ul,.sv-article ol,.sv-article li{font-family:"Hind Siliguri", sans-serif;color:#c8c8c8}.sv-article h2,.sv-article h3,.sv-article h4,.sv-article h5,.sv-article h6{font-size:1.3em;margin:1.2em 0 0.8em 0}.sv-article p,.sv-article ul,.sv-article ol{font-size:1.15em;margin:0.8em 0}.sv-article p{line-height:1.55em}.sv-article ul{padding-left:0.5em;list-style:square inside}.sv-article ol{padding-left:0.5em;list-style:decimal inside}.sv-article a:link,.sv-article a:visited,.sv-article a:hover,.sv-article a:active{color:#0089bf}.sv-article img{max-width:100%}.sv-content-view{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.85em;line-height:1.35;color:#c8c8c8;background-color:#343434;position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-logo{flex:0 50 180px;min-width:40px;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;overflow:hidden;height:40px;user-select:none}.sv-logo .sv-short{flex-grow:1;width:0;max-width:40px}.sv-logo .sv-full{flex:1 0 180px;display:flex}.sv-logo .sv-full .sv-sunburst{flex:0 0 14%}.sv-logo .sv-full .sv-smithsonian{flex:0 0 83%;margin-left:3%}.ff-flex-spacer{user-select:none;-moz-user-select:none;-webkit-user-select:none}.sr-only{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}@keyframes spin{100%{transform:rotate(360deg)}}.sv-spinner{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;display:flex;justify-content:center;align-items:center;pointer-events:none}.sv-spinner-wheel{height:120px;width:120px;animation:spin 5s linear infinite}*{scrollbar-color:#676767 #1b1b1b;scrollbar-width:thin}* ::-webkit-scrollbar{width:8px;height:8px}* ::-webkit-scrollbar-track{background-color:#1b1b1b}* ::-webkit-scrollbar-thumb{background-color:#676767;border-radius:8px}voyager-explorer{font-size:16px}.sv-content-only .sv-scene-view,.sv-content-stack .sv-scene-view{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.sv-reader-container{overflow-y:auto}.sv-content-stack .sv-reader-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;margin-top:52px}.sv-content-stack .sv-reader-view{pointer-events:auto;display:flex;justify-content:center}.sv-content-stack .sv-reader-view .sv-left{flex:0 0 52px}.sv-content-stack .sv-reader-view .sv-article{flex:0 2 720px;background-color:rgba(27,34,38,0.5);padding-bottom:35px}.sv-content-stack .sv-reader-view .sv-right{flex:0 3 16px;background-color:rgba(27,34,38,0.5)}.sv-content-split{display:flex}.sv-content-split .sv-reader-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;margin-top:52px}.sv-content-split .sv-scene-view{flex:1 1 60%}.sv-content-split .sv-reader-view{pointer-events:auto;flex:1 1 40%;padding:0 20px}.sv-content-split .sv-reader-view .sv-left{flex:0 0 52px}.sv-content-split .sv-reader-view .sv-article{flex:0 2 720px;background-color:rgba(27,34,38,0.5);padding-bottom:35px;padding-right:16px}.sv-content-split .sv-reader-view .sv-right{flex:0 3 16px;background-color:rgba(27,34,38,0.5)}.sv-article{position:relative;padding:5px 8px 0 16px}.ff-viewport-overlay{font-size:1.0em}.sv-scene-view{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden}.sv-scene-view.sv-blur{filter:brightness(60%) blur(5px);transition:filter 0.5s}.sv-annotation{box-sizing:border-box;position:absolute;z-index:1;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-annotation-img{max-width:100%}.sv-circle-annotation{width:16%;min-width:160px;max-width:260px;padding:4px 8px;background-color:rgba(0,0,0,0.7);border-radius:4px}.sv-circle-annotation.sv-align-right{transform:translateX(-100%)}.sv-circle-annotation.sv-align-bottom{transform:translateY(-100%)}.sv-circle-annotation .sv-title{padding:0 0 2px 0;font-weight:bold}.sv-circle-annotation p{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.88em;line-height:1.35;color:#c8c8c8;margin:0.5em 0}.sv-circle-annotation .ff-button{background:rgba(0,0,0,0.01)}.sv-circle-annotation .ff-button .ff-icon{fill:#a0a0a0}.sv-circle-annotation .ff-button:hover{text-decoration:underline}.sv-circle-annotation .sv-content{overflow:hidden;overflow-wrap:break-word}.sv-pin-annotation{padding:0 4px;background-color:rgba(0,0,0,0.5);color:#c8c8c8;transform:translate(-50%, -100%)}.sv-standard-annotation,.sv-extended-annotation{max-width:20%;padding:0 4px;background-color:rgba(0,0,0,0.5);color:#c8c8c8;pointer-events:auto}.sv-standard-annotation.sv-expanded,.sv-extended-annotation.sv-expanded{width:20%;min-width:180px;background-color:rgba(0,0,0,0.8)}.sv-standard-annotation.sv-q0,.sv-extended-annotation.sv-q0{transform:translate(0, -100%);border-bottom-style:solid;border-bottom-width:1px;text-align:left}.sv-standard-annotation.sv-q1,.sv-extended-annotation.sv-q1{transform:translate(-100%, -100%);border-bottom-style:solid;border-bottom-width:1px;text-align:right}.sv-standard-annotation.sv-q2,.sv-extended-annotation.sv-q2{transform:translate(-100%, 0);border-top-style:solid;border-top-width:1px;text-align:right}.sv-standard-annotation.sv-q3,.sv-extended-annotation.sv-q3{transform:translate(0, 0);border-top-style:solid;border-top-width:1px;text-align:left}.sv-standard-annotation.sv-static-width,.sv-extended-annotation.sv-static-width{width:fit-content}.sv-standard-annotation .sv-title,.sv-extended-annotation .sv-title{padding:1px 0 2px 0;font-weight:bold}.sv-standard-annotation .sv-content,.sv-extended-annotation .sv-content{padding:2px 0;height:0;overflow:hidden;overflow-wrap:break-word;transition:height 0.2s}.sv-standard-annotation p,.sv-extended-annotation p{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.88em;line-height:1.35;color:#c8c8c8;margin:0.5em 0}.sv-standard-annotation .ff-button,.sv-extended-annotation .ff-button{background:rgba(0,0,0,0.01)}.sv-standard-annotation .ff-button .ff-icon,.sv-extended-annotation .ff-button .ff-icon{fill:#a0a0a0}.sv-standard-annotation .ff-button:hover,.sv-extended-annotation .ff-button:hover{text-decoration:underline}.sv-extended-annotation .sv-title{cursor:pointer}.sv-standard-annotation{pointer-events:none}.sv-ar-prompt{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;text-align:center;border-radius:20px;margin:30% 0 0 0;overflow:hidden;background-color:rgba(54,61,64,0.6)}.sv-ar-prompt .sv-content{flex:1;width:100%;margin:10px 10px;text-align:center;-webkit-user-select:none;-ms-user-select:none;user-select:none}.sv-ar-prompt .sv-content .sv-ar-icon{height:10em}.sv-ar-menu{display:flex;position:absolute;bottom:0px;flex-direction:row;margin:0 0 6px 6px}.sv-ar-menu>.ff-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;width:38px;height:38px;margin:0 6px 2px 0;background-color:rgba(74,82,87,0.5);border-radius:20px;font-size:17px;transition:all .15s;pointer-events:auto}.sv-ar-menu>.ff-button:hover,.sv-ar-menu>.ff-button:focus{outline:none;background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-ar-menu>.ff-button[selected]{background-color:#0089bf;color:#f0f0f0}.sv-ar-menu>.ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-ar-menu>.ff-button[selected]:hover,.sv-ar-menu>.ff-button[selected]:focus{background-color:#00a6e8}.sv-chrome-view{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.85em;line-height:1.35;color:#c8c8c8;position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;background:linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.15) 10%, transparent 25%);z-index:1}.sv-chrome-view .ff-button{flex:0 1 auto;box-sizing:border-box}.sv-chrome-view .ff-button:focus{outline:none;box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-view .ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-chrome-view .ff-button:focus-visible{outline:none;box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-view .ff-button:hover{outline:none}.sv-chrome-view .ff-button:hover>.ff-icon{fill:#c8c8c8}.sv-chrome-view .ff-button[selected]{background-color:#0089bf}.sv-chrome-view .ff-button[selected][disabled]{background-color:#4e4e4e}.sv-chrome-view .ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-chrome-header{display:flex;align-items:flex-start;height:100%;position:relative}.sv-chrome-header .sv-top-bar{flex:1 1 auto;display:flex;align-items:flex-start;height:40px;margin:9px 9px 0 0;overflow:hidden}.sv-chrome-header .sv-main-title{flex:1 1 auto;margin:6px 8px;font-family:"Hind Siliguri", sans-serif;font-weight:normal;font-size:1.412em;white-space:pre;color:#e8e8e8;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-chrome-header .sv-main-title span{color:transparent}.sv-chrome-footer{display:block;position:absolute;bottom:0;right:0;z-index:-1}.sv-chrome-footer .sv-bottom-bar{flex:1 1 auto;display:flex;align-items:flex-end;text-align:right;overflow:hidden}.sv-chrome-footer .sv-language-display{flex:1 1 auto;margin:6px 8px;font-family:"Hind Siliguri", sans-serif;font-weight:normal;font-size:1.176em;white-space:pre;color:#e8e8e8;pointer-events:auto;background:rgba(31,36,38,0.8);border-radius:4px;padding:4px 6px;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-chrome-footer .sv-language-display:hover,.sv-chrome-footer .sv-language-display:focus{outline:none;background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-chrome-footer .sv-language-display span{color:transparent}.sv-main-menu-wrapper{position:relative;height:100%;min-width:50px}.sv-main-menu{display:flex;flex-direction:column;padding:6px 9px 6px 6px;height:100%;overflow-y:auto;overflow-x:hidden;pointer-events:auto;position:absolute;box-sizing:border-box;overscroll-behavior-y:contain}.sv-main-menu>.ff-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;width:38px;height:38px;margin:2px 0;background-color:rgba(31,36,38,0.8);border-radius:20px;font-size:17px;transition:all .15s;pointer-events:auto}.sv-main-menu>.ff-button:focus{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-main-menu>.ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-main-menu>.ff-button:focus-visible{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-main-menu>.ff-button:hover{background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-main-menu>.ff-button[selected]{background-color:#0089bf;color:#f0f0f0}.sv-main-menu>.ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-main-menu>.ff-button[selected]:hover,.sv-main-menu>.ff-button[selected]:focus{background-color:#00a6e8}.sv-main-menu .sv-scroll-btn{border-radius:2px;font-size:10px;height:19px;background-color:#343434;z-index:2;padding:0px;position:sticky}.sv-main-menu .sv-scroll-btn.up{top:0px;margin-top:0px}.sv-main-menu .sv-scroll-btn.down{bottom:12px;margin-top:12px}.sv-main-menu .sv-scroll-btn:hover{background-color:#676767;fill:#c8c8c8}.sv-main-menu .sv-scroll-btn:focus,.sv-main-menu .sv-scroll-btn:focus-visible{background-color:#343434}.sv-share-menu{position:relative;width:450px;max-width:85%;padding:8px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);pointer-events:auto}.sv-share-menu .ff-title{margin:0.5em 0 1em 0}.sv-share-menu .ff-button{flex:0 0 auto}.sv-share-menu .ff-text-edit{height:6.5em}.sv-share-menu .sv-share-buttons .ff-button{width:48px;height:48px;border-radius:48px;margin:0 1em 1em 0;padding:0}.sv-share-menu .sv-share-buttons .ff-button .ff-icon{height:30px;fill:#f0f0f0}.sv-share-menu .sv-share-button-twitter{background-color:#00aced}.sv-share-menu .sv-share-button-twitter:focus{outline:none;background-color:#00aced;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-twitter:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-twitter:focus-visible{outline:none;background:#00aced;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-twitter:hover{background-color:#21c2ff}.sv-share-menu .sv-share-button-facebook{background-color:#3c5a99}.sv-share-menu .sv-share-button-facebook:focus{outline:none;background-color:#3c5a99;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-facebook:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-facebook:focus-visible{outline:none;background:#3c5a99;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-facebook:hover{background-color:#4e71ba}.sv-share-menu .sv-share-button-linkedin{background-color:#0077B5}.sv-share-menu .sv-share-button-linkedin:focus{outline:none;background-color:#0077B5;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-linkedin:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-linkedin:focus-visible{outline:none;background:#0077B5;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-linkedin:hover{background-color:#0099e8}.sv-share-menu .sv-share-button-email{background-color:#d28842}.sv-share-menu .sv-share-button-email:focus{outline:none;background-color:#d28842;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-email:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-email:focus-visible{outline:none;background:#d28842;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-email:hover{background-color:#dca26b}.sv-document-overlay{position:absolute;left:52px;top:52px;right:6px;bottom:0;pointer-events:auto}.sv-tour-menu .sv-article,.sv-reader-view .sv-article{position:relative}.sv-tour-menu .sv-article .sv-nav-button,.sv-reader-view .sv-article .sv-nav-button{float:right;margin:1em 0.5em;padding:2px}.sv-tour-menu .sv-article .sv-nav-button .ff-icon,.sv-reader-view .sv-article .sv-nav-button .ff-icon{height:1.5em}.sv-tour-menu .sv-entry,.sv-reader-view .sv-entry{position:relative;cursor:pointer;padding:5px 0 5px 15px;margin:2px 2px 16px 2px;max-width:960px;background-color:rgba(27,34,38,0.5)}.sv-tour-menu .sv-entry:hover,.sv-reader-view .sv-entry:hover{background-color:rgba(51,59,64,0.5)}.sv-option-menu{position:relative;width:225px;max-width:85%;height:200px;max-height:85%;padding:8px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);pointer-events:auto}.sv-option-menu .ff-title{margin:0.3em 0 0.3em 0.3em}.sv-option-menu .ff-header{padding:0.3em 0 0.3em 0.3em;background:rgba(31,36,38,0.8)}.sv-option-menu .ff-button{flex:0 0 auto}.sv-option-menu .sv-scroll-offset{top:50px}.sv-option-menu .sv-centered{justify-content:center;padding:0.3em 0 0.3em 0.3em}.sv-option-menu .sv-entry{position:relative;cursor:pointer;padding:5px 0 5px 15px;margin-bottom:2px;max-width:960px;background-color:rgba(27,34,38,0.5);user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-option-menu .sv-entry:focus{outline:2px solid #bfedff;outline-offset:-2px;background-color:rgba(27,34,38,0.5)}.sv-option-menu .sv-entry:focus:not(:focus-visible){outline:0}.sv-option-menu .sv-entry:focus-visible{outline:2px solid #bfedff;outline-offset:-2px;background-color:rgba(27,34,38,0.5)}.sv-option-menu .sv-entry:hover{background-color:rgba(51,59,64,0.5);fill:#c8c8c8}.sv-option-menu .sv-entry[selected]{background-color:#0089bf;color:#f0f0f0}.sv-option-menu .sv-entry[selected]:hover,.sv-option-menu .sv-entry[selected]:focus{background-color:#00a6e8}.sv-bottom-bar-container{position:relative;display:flex;justify-content:center;transition:transform .3s ease-out,opacity .15s ease-out}.sv-bottom-bar-container.sv-transition{transform:translateY(40px);opacity:0}.sv-bottom-bar-container .ff-button{transition:all .15s}.sv-blue-bar{flex:0 1 960px;display:flex;flex-direction:column;background-color:rgba(5,7,8,0.85);border-left:1px solid rgba(0,137,191,0.5);border-right:1px solid rgba(0,137,191,0.5);margin:0 -1px 0 -1px;min-width:0px;pointer-events:auto;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-blue-bar .sv-group{display:flex;flex-direction:column}.sv-blue-bar .sv-section{position:relative;display:flex;flex-direction:row;border-top:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-section-lead,.sv-blue-bar .sv-section-trail{flex:0 0 auto;padding:6px;width:38px}.sv-blue-bar .sv-section-lead:hover,.sv-blue-bar .sv-section-trail:hover{background-color:rgba(74,82,87,0.5)}.sv-blue-bar .sv-section-lead{border-right:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-section-trail{border-left:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-transparent-button{flex:0 1 auto;padding:6px;border-radius:2px}.sv-blue-bar .sv-transparent-button .ff-text{margin:1px 2px}.sv-blue-bar .sv-transparent-button .ff-icon{height:22px;margin:1px 2px}.sv-tour-navigator{color:#c8c8c8}.sv-tour-navigator .sv-content{flex:1;margin:2px 8px;text-align:center}.sv-tour-navigator .sv-title{font-size:1.1em}.sv-tour-navigator .sv-text{font-size:0.9em}.sv-target-navigator .sv-content{flex:1;margin:2px 8px;text-align:center}.sv-target-navigator .sv-title{font-size:1.1em}.sv-tag-cloud .sv-tag-buttons{flex:1 1 auto;display:flex;flex-wrap:wrap;justify-content:center;margin:4px}.sv-tag-cloud .sv-tag-button{flex:0 1 auto;margin:3px 3px;padding:2px 4px;background-color:rgba(31,36,38,0.8);border-radius:3px;font-size:0.88em}.sv-tag-cloud .sv-tag-button:hover{background-color:rgba(74,82,87,0.5)}.sv-tag-cloud .sv-tag-button[selected]{background-color:#0089bf}.sv-tag-cloud .sv-tag-button .ff-text{margin:1px 2px}.sv-tag-cloud .sv-tag-button .ff-icon{height:22px;margin:1px 2px}.sv-tool-bar{color:#c8c8c8;pointer-events:auto}.sv-tool-bar .sv-tool-buttons{flex:1 1 auto;display:flex;margin:4px;overflow-x:auto}.sv-tool-bar .sv-tool-buttons .sv-tool-button:first-child{margin-left:auto}.sv-tool-bar .sv-tool-buttons .sv-tool-button:last-child{margin-right:auto}.sv-tool-bar .sv-tool-button{flex:0 1 auto;margin:2px;padding:1px 2px;border-radius:3px;font-size:0.882em}.sv-tool-bar .sv-tool-button .ff-text{margin:1px 2px}.sv-tool-bar .sv-tool-button .ff-icon{height:22px;margin:1px 2px}.sv-tool-bar-container{position:relative;bottom:0px;width:100%}.sv-tool-controls{flex:1 1 auto;display:flex;justify-content:center;align-items:center;font-size:0.882em}.sv-tool-controls .sv-property-view{flex:0 1 auto;align-self:start;display:flex;flex-direction:column;margin:4px}.sv-tool-controls .sv-property-view label{height:1.25em}.sv-tool-controls .sv-property-view.sv-nogap{margin:4px 0 !important}.sv-tool-controls .sv-property-slider{flex:0 2 180px}.sv-tool-controls .sv-property-slider .ff-linear-slider{height:6px;margin:12px 2px;padding-right:16px;border-radius:2px;background-color:#4e4e4e}.sv-tool-controls .sv-property-slider .ff-linear-slider .ff-knob{width:16px;height:26px;margin:-10px 0 0 0;border-radius:2px;background-color:#0089bf;box-shadow:0 0 6px black}.sv-tool-controls .sv-property-color>.ff-button{width:28px;box-sizing:border-box;border:1px solid #343434}.sv-tool-controls .sv-property-color .ff-color-edit{position:absolute;width:200px;height:180px;right:8px;top:-188px}.sv-tool-controls .sv-options{display:flex}.sv-tool-controls .ff-label{margin:2px}.sv-tool-controls .ff-string{flex:0 1 auto;height:26px;margin:2px;font-size:1.34em}.sv-tool-controls .ff-button{height:26px;margin:2px;padding:0 4px;background:#343434;border-radius:2px}.sv-tool-controls .ff-button:focus{outline:none;background:#343434;box-shadow:0 0 3pt 2pt #bfedff}.sv-tool-controls .ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-tool-controls .ff-button:focus-visible{outline:none;background:#343434;box-shadow:0 0 3pt 2pt #bfedff}.sv-tool-controls .ff-button:hover{background-color:#676767;fill:#c8c8c8}.sv-view-tool-view .sv-options,.sv-render-tool-view .sv-options,.sv-light-tool-view .sv-options{flex-wrap:wrap}.sv-tape-tool-view .sv-tool-controls,.sv-slice-tool-view .sv-tool-controls,.sv-environment-tool-view .sv-tool-controls{flex-wrap:wrap}\n',e.appendChild(t);const n=this.application.system;e.appendChild(new Ny(n)),e.appendChild(new cb(n));const i=document.createElement("div");i.setAttribute("id",ho.stackId),e.appendChild(i),ho.shadowRootNode=e;const s=document.createElement("div");s.classList.add("sr-only"),s.setAttribute("id","sr-intro"),s.setAttribute("aria-live","polite"),e.appendChild(s)}connected(){this.fullscreen.fullscreenElement=this,this.viewer.rootElement=this}disconnected(){this.fullscreen.fullscreenElement=null,this.viewer.rootElement=null,this.application.dispose(),this.application=null}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),this.application&&"root"===e?(this.application.props.root=this.getAttribute("root"),this.application.evaluateProps()):this.application&&"controls"===e&&this.application.enableNavigation(n)}onFocus(){this.shadowRoot.getElementById("sr-intro").innerText="The Voyager web application allows you to view and interact with a 3D model from the Smithsonian collection. Use the tab key to move through interactive elements, enter or spacebar keys to activate, and the escape key to exit menus."}toggleAnnotations(){this.application&&this.application.toggleAnnotations()}toggleReader(){this.application&&this.application.toggleReader()}toggleTours(){this.application&&this.application.toggleTours()}toggleTools(){this.application&&this.application.toggleTools()}toggleMeasurement(){this.application&&this.application.toggleMeasurement()}enableAR(){this.application&&this.application.enableAR()}getArticles(){if(this.application){return this.application.getArticles()}}getAnnotations(){if(this.application){return this.application.getAnnotations()}}getCameraOrbit(){if(this.application){return this.application.getCameraOrbit()}}setCameraOrbit(e,t){this.application&&this.application.setCameraOrbit(e,t)}getCameraOffset(){if(this.application){return this.application.getCameraOffset()}}setCameraOffset(e,t,n){this.application&&this.application.setCameraOffset(e,t,n)}setBackgroundColor(e,t){this.application&&this.application.setBackgroundColor(e,t||null)}setBackgroundStyle(e){this.application&&this.application.setBackgroundStyle(e)}setActiveAnnotation(e){this.application&&this.viewer.ins.activeAnnotation.setValue(e)}setTourStep(e,t,n){this.application&&this.application.setTourStep(e,t,void 0===n||n)}setLanguage(e){this.application&&this.application.setLanguage(e)}};ub=hb([Qr("voyager-explorer")],ub);const db=ub},338:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},360:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};n(8500)})(); diff --git a/previewers/betatest/lib/voyager-explorer.min.v0.42.1.gdcc.js b/previewers/betatest/lib/voyager-explorer.min.v0.42.1.gdcc.js new file mode 100644 index 0000000..513fe00 --- /dev/null +++ b/previewers/betatest/lib/voyager-explorer.min.v0.42.1.gdcc.js @@ -0,0 +1,381 @@ +/*! For license information please see voyager-explorer.min.js.LICENSE.txt */ +(()=>{var e={93523:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n\n// #include \n// replaced with\nvarying vec2 vUv;\n\n//#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\n vec2 coords = vUv * 2.0 - 1.0;\n float f = dot(coords, coords);\n\tgl_FragColor = vec4(outgoingLight, mix(diffuseColor.a, 0.0, f));\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n\n"},62001:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n\n//#include \n// replaced with\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\n//#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t// replaced with\n\tvUv = ( vec3( uv, 1 ) ).xy;\n\n\t//#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n\n"},8669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="//#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n\n#include \n#include \n#include \n#include \n\n#include \n\n// Zone map support\n#if defined(USE_ZONEMAP)\n\tvarying vec2 vZoneUv;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_ZONEMAP\n\tuniform sampler2D zoneMap;\n#endif\n\n#ifdef USE_AOMAP\n uniform vec3 aoMapMix;\n#endif\n\n#ifdef MODE_XRAY\n varying float vIntensity;\n#endif\n\n#ifdef CUT_PLANE\n\t#if !defined(USE_TRANSMISSION)\n \tvarying vec3 vWorldPosition;\n\t#endif\n uniform vec4 cutPlaneDirection;\n uniform vec3 cutPlaneColor;\n#endif\n\nvoid main() {\n #ifdef CUT_PLANE\n if (dot(vWorldPosition, cutPlaneDirection.xyz) < -cutPlaneDirection.w) {\n discard;\n }\n #endif\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#ifdef CUT_PLANE\n\t // on the cut surface (back facing fragments revealed), replace normal with cut plane direction\n if (!gl_FrontFacing) {\n normal = -cutPlaneDirection.xyz;\n diffuseColor.rgb = cutPlaneColor.rgb;\n }\n\t#endif\n\n #include \n #include \n #include \n\t\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t//#include \n\t// REPLACED WITH\n\t#ifdef USE_AOMAP\n\t // if cut plane is enabled, disable ambient occlusion on back facing fragments\n\t #ifdef CUT_PLANE\n if (gl_FrontFacing) {\n\t #endif\n\n \t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n \tvec3 aoSample = vec3(texture2D(aoMap, vAoMapUv).r,texture2D(aoMap, vAoMapUv).r,texture2D(aoMap, vAoMapUv).r);\n \tvec3 aoFactors = mix(vec3(1.0), aoSample, clamp(aoMapMix * aoMapIntensity, 0.0, 1.0));\n \tfloat ambientOcclusion = aoFactors.x * aoFactors.y * aoFactors.z;\n \tfloat ambientOcclusion2 = ambientOcclusion * ambientOcclusion;\n \treflectedLight.directDiffuse *= ambientOcclusion2;\n \treflectedLight.directSpecular *= ambientOcclusion;\n \t//reflectedLight.indirectDiffuse *= ambientOcclusion;\n\n \t#if defined( USE_CLEARCOAT ) \n\t\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t\t#endif\n\n\t\t#if defined( USE_SHEEN ) \n\t\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t\t#endif\n\n\t\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n\t\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\n\t\t#endif\n\n \t#ifdef CUT_PLANE\n \t }\n \t#endif\n #endif\n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n #ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\n\t#endif\n\n\t#ifdef CUT_PLANE\n\tif (!gl_FrontFacing) {\n\t\toutgoingLight = cutPlaneColor.rgb;\n\t}\n\t#endif\n\n\t#include \n\n\t#ifdef USE_ZONEMAP\n\t\tvec4 zoneColor = texture2D(zoneMap, vZoneUv);\n\t\tgl_FragColor += mix(vec4(0.0, 0.0, 0.0, 1.0), vec4(zoneColor.rgb, 1.0), zoneColor.a);\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n #ifdef MODE_NORMALS\n gl_FragColor = vec4(vec3(normal * 0.5 + 0.5), 1.0);\n #endif\n\n #ifdef MODE_XRAY\n gl_FragColor = vec4(vec3(0.4, 0.7, 1.0) * vIntensity, 1.0);\n #endif\n}\n"},9849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i="//#define PHYSICAL\n//#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#if defined(USE_TRANSMISSION) || defined(CUT_PLANE)\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n// Zone map support\n#if defined(USE_ZONEMAP)\t\n\tvarying vec2 vZoneUv;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef MODE_XRAY\n varying float vIntensity;\n#endif\n\n//#ifdef CUT_PLANE\n// varying vec3 vWorldPosition;\n//#endif\n\nvoid main() {\n\n\t#include \n\n// Zone map support\n#if defined(USE_ZONEMAP)\n\t#if defined(USE_MAP)\n\t\tvZoneUv = (mapTransform * vec3(vMapUv, 1)).xy;\n\t#else\n\t\tvZoneUv = uv;\n\t#endif\n#endif\n\n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifdef MODE_XRAY\n vIntensity = pow(abs(1.0 - abs(dot(vNormal, vec3(0.0, 0.0, 1.0)))), 3.0);\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t// #include \n\t// REPLACED WITH\n\t#if defined(USE_ENVMAP) || defined(DISTANCE) || defined(USE_SHADOWMAP) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 || defined(CUT_PLANE)\n \tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n\n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n\n#ifdef CUT_PLANE\n vWorldPosition = worldPosition.xyz / worldPosition.w;\n#endif\n\n#ifdef MODE_NORMALS\n vNormal = normal;\n#endif\n}"},75310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const i=n(72206),s=n(610),r=n(73348),o=n(90360),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends i.default{_addVocabularies(){super._addVocabularies(),s.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var h=n(43750);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var d=n(56110);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}})},6657:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends n{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=i;class s extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof i&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function r(e,...t){const n=[e[0]];let i=0;for(;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const i=n(6657),s=n(32715);var r=n(6657);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var o=n(32715);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),t.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?s.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=L(this.rhs,e,t)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof i.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=L(this.rhs,e,t),this}get names(){return R(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class h extends c{constructor(e,t,n,i){super(e,n,i),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class u extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class p extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=L(this.code,e,t),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,n)=>t+n.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:n}=this;let i=n.length;for(;i--;){const s=n[i];s.optimizeNames(e,t)||(N(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>P(e,t.names)),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends f{}class y extends g{}y.kind="else";class b extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof b?t:t.nodes:this.nodes.length?this:new b(D(e),t instanceof b?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var n;if(this.else=null===(n=this.else)||void 0===n?void 0:n.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=L(this.condition,e,t),this}get names(){const e=super.names;return R(e,this.condition),this.else&&P(e,this.else.names),e}}b.kind="if";class _ extends g{}_.kind="for";class x extends _{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=L(this.iteration,e,t),this}get names(){return P(super.names,this.iteration.names)}}class w extends _{constructor(e,t,n,i){super(),this.varKind=e,this.name=t,this.from=n,this.to=i}render(e){const t=e.es5?s.varKinds.var:this.varKind,{name:n,from:i,to:r}=this;return`for(${t} ${n}=${i}; ${n}<${r}; ${n}++)`+super.render(e)}get names(){const e=R(super.names,this.from);return R(e,this.to)}}class S extends _{constructor(e,t,n,i){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=L(this.iterable,e,t),this}get names(){return P(super.names,this.iterable.names)}}class M extends g{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}M.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class T extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var n,i;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(i=this.finally)||void 0===i||i.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&P(e,this.catch.names),this.finally&&P(e,this.finally.names),e}}class C extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}C.kind="catch";class A extends g{render(e){return"finally"+super.render(e)}}A.kind="finally";function P(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function R(e,t){return t instanceof i._CodeOrName?P(e,t.names):e}function L(e,t,n){return e instanceof i.Name?r(e):(s=e)instanceof i._Code&&s._items.some((e=>e instanceof i.Name&&1===t[e.str]&&void 0!==n[e.str]))?new i._Code(e._items.reduce(((e,t)=>(t instanceof i.Name&&(t=r(t)),t instanceof i._Code?e.push(...t._items):e.push(t),e)),[])):e;var s;function r(e){const i=n[e.str];return void 0===i||1!==t[e.str]?e:(delete t[e.str],i)}}function N(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function D(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:i._`!${k(e)}`}t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new s.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,i){const s=this._scope.toName(t);return void 0!==n&&i&&(this._constants[s.str]=n),this._leafNode(new l(e,s,n)),s}const(e,t,n){return this._def(s.varKinds.const,e,t,n)}let(e,t,n){return this._def(s.varKinds.let,e,t,n)}var(e,t,n){return this._def(s.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new h(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==i.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[n,s]of e)t.length>1&&t.push(","),t.push(n),(n!==s||this.opts.es5)&&(t.push(":"),(0,i.addCodeArg)(t,s));return t.push("}"),new i._Code(t)}if(e,t,n){if(this._blockNode(new b(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new b(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(b,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new x(e),t)}forRange(e,t,n,i,r=(this.opts.es5?s.varKinds.var:s.varKinds.let)){const o=this._scope.toName(e);return this._for(new w(r,o,t,n),(()=>i(o)))}forOf(e,t,n,r=s.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof i.Name?t:this.var("_arr",t);return this.forRange("_i",0,i._`${e}.length`,(t=>{this.var(o,i._`${e}[${t}]`),n(o)}))}return this._for(new S("of",r,o,t),(()=>n(o)))}forIn(e,t,n,r=(this.opts.es5?s.varKinds.var:s.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,i._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new S("in",r,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(_)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new u(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new T;if(this._blockNode(i),this.code(e),t){const e=this.name("e");this._currNode=i.catch=new C(e),t(e)}return n&&(this._currNode=i.finally=new A,this.code(n)),this._endBlockNode(C,A)}throw(e){return this._leafNode(new p(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=i.nil,n,s){return this._blockNode(new M(e,t,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(M)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=D;const I=U(t.operators.AND);t.and=function(...e){return e.reduce(I)};const O=U(t.operators.OR);function U(e){return(t,n)=>t===i.nil?n:n===i.nil?t:i._`${k(t)} ${e} ${k(n)}`}function k(e){return e instanceof i.Name?e:i._`(${e})`}t.or=function(...e){return e.reduce(O)}},32715:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const i=n(6657);class s extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var r;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(r=t.UsedValueState||(t.UsedValueState={})),t.varKinds={const:new i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof i.Name?e:this.name(e)}name(e){return new i.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,n;if((null===(n=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===n?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class a extends i.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=i._`.${new i.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=i._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:i.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(e),{prefix:s}=i,r=null!==(n=t.key)&&void 0!==n?n:t.ref;let o=this._values[s];if(o){const e=o.get(r);if(e)return e}else o=this._values[s]=new Map;o.set(r,i);const a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,i.setValue(t,{property:s,itemIndex:l}),i}getValue(e,t){const n=this._values[e];if(n)return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return i._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,n){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,n)}_reduceValues(e,n,o={},a){let l=i.nil;for(const c in e){const h=e[c];if(!h)continue;const d=o[c]=o[c]||new Map;h.forEach((e=>{if(d.has(e))return;d.set(e,r.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=i._`${l}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new s(e);l=i._`${l}${o}${this.opts._n}`}d.set(e,r.Completed)}))}return l}}},16257:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const i=n(56110),s=n(20530),r=n(17748);function o(e,t){const n=e.const("err",t);e.if(i._`${r.default.vErrors} === null`,(()=>e.assign(r.default.vErrors,i._`[${n}]`)),i._`${r.default.vErrors}.push(${n})`),e.code(i._`${r.default.errors}++`)}function a(e,t){const{gen:n,validateName:s,schemaEnv:r}=e;r.$async?n.throw(i._`new ${e.ValidationError}(${t})`):(n.assign(i._`${s}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>i.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?i.str`"${e}" keyword must be ${t} ($data)`:i.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,s,r){const{it:l}=e,{gen:h,compositeRule:d,allErrors:u}=l,p=c(e,n,s);(null!=r?r:d||u)?o(h,p):a(l,i._`[${p}]`)},t.reportExtraError=function(e,n=t.keywordError,i){const{it:s}=e,{gen:l,compositeRule:h,allErrors:d}=s;o(l,c(e,n,i)),h||d||a(s,r.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(r.default.errors,t),e.if(i._`${r.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(i._`${r.default.vErrors}.length`,t)),(()=>e.assign(r.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:s,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",o,r.default.errors,(o=>{e.const(l,i._`${r.default.vErrors}[${o}]`),e.if(i._`${l}.instancePath === undefined`,(()=>e.assign(i._`${l}.instancePath`,(0,i.strConcat)(r.default.instancePath,a.errorPath)))),e.assign(i._`${l}.schemaPath`,i.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(i._`${l}.schema`,n),e.assign(i._`${l}.data`,s))}))};const l={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function c(e,t,n){const{createErrors:s}=e.it;return!1===s?i._`{}`:function(e,t,n={}){const{gen:s,it:o}=e,a=[h(o,n),d(e,n)];return function(e,{params:t,message:n},s){const{keyword:o,data:a,schemaValue:c,it:h}=e,{opts:d,propertyName:u,topSchemaRef:p,schemaPath:m}=h;s.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||i._`{}`]),d.messages&&s.push([l.message,"function"==typeof n?n(e):n]);d.verbose&&s.push([l.schema,c],[l.parentSchema,i._`${p}${m}`],[r.default.data,a]);u&&s.push([l.propertyName,u])}(e,t,a),s.object(...a)}(e,t,n)}function h({errorPath:e},{instancePath:t}){const n=t?i.str`${e}${(0,s.getErrorPath)(t,s.Type.Str)}`:e;return[r.default.instancePath,(0,i.strConcat)(r.default.instancePath,n)]}function d({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let o=r?t:i.str`${t}/${e}`;return n&&(o=i.str`${o}${(0,s.getErrorPath)(n,s.Type.Str)}`),[l.schemaPath,o]}},59336:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const i=n(56110),s=n(97939),r=n(17748),o=n(66184),a=n(20530),l=n(43750),c=n(55858);class h{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function d(e){const t=p.call(this,e);if(t)return t;const n=(0,o.getFullPath)(e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:h}=this.opts,d=new i.CodeGen(this.scope,{es5:a,lines:c,ownProperties:h});let u;e.$async&&(u=d.scopeValue("Error",{ref:s.default,code:i._`require("ajv/dist/runtime/validation_error").default`}));const m=d.scopeName("validate");e.validateName=m;const f={gen:d,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,i.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:u,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:i.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:i._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),d.optimize(this.opts.code.optimize);const t=d.toString();g=`${d.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:n}),n.errors=null,n.schema=e.schema,n.schemaEnv=e,e.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:m,validateCode:t,scopeValues:d._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof i.Name?void 0:e,items:t instanceof i.Name?void 0:t,dynamicProps:e instanceof i.Name,dynamicItems:t instanceof i.Name},n.source&&(n.source.evaluated=(0,i.stringify)(n.evaluated))}return e.validate=n,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function u(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:d.call(this,e)}function p(e){for(const i of this._compilations)if(n=e,(t=i).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return i;var t,n}function m(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||f.call(this,e,t)}function f(e,t){const n=c.parse(t),i=(0,o._getFullPath)(n);let s=(0,o.getFullPath)(e.baseId);if(Object.keys(e.schema).length>0&&i===s)return v.call(this,n,e);const r=(0,o.normalizeId)(i),a=this.refs[r]||this.schemas[r];if("string"==typeof a){const t=f.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return v.call(this,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||d.call(this,a),r===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,i=t[n];return i&&(s=(0,o.resolveUrl)(s,i)),new h({schema:t,schemaId:n,root:e,baseId:s})}return v.call(this,n,a)}}t.SchemaEnv=h,t.compileSchema=d,t.resolveRef=function(e,t,n){var i;n=(0,o.resolveUrl)(t,n);const s=e.refs[n];if(s)return s;let r=m.call(this,e,n);if(void 0===r){const s=null===(i=e.localRefs)||void 0===i?void 0:i[n],{schemaId:o}=this.opts;s&&(r=new h({schema:s,schemaId:o,root:e,baseId:t}))}return void 0!==r?e.refs[n]=u.call(this,r):void 0},t.getCompilingSchema=p,t.resolveSchema=f;const g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(e,{baseId:t,schema:n,root:i}){var s;if("/"!==(null===(s=e.fragment)||void 0===s?void 0:s[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(i)];if(void 0===e)return;const s="object"==typeof(n=e)&&n[this.opts.schemaId];!g.has(i)&&s&&(t=(0,o.resolveUrl)(t,s))}let r;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,o.resolveUrl)(t,n.$ref);r=f.call(this,i,e)}const{schemaId:l}=this.opts;return r=r||new h({schema:n,schemaId:l,root:i,baseId:t}),r.schema!==r.root.schema?r:void 0}},17748:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")};t.default=s},33482:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(66184);class s extends Error{constructor(e,t,n){super(n||`can't resolve reference ${t} from id ${e}`),this.missingRef=(0,i.resolveUrl)(e,t),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(this.missingRef))}}t.default=s},66184:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const i=n(20530),s=n(28926),r=n(68125),o=n(55858),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&h(e)<=t)};const l=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(l.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(c))return!0;if("object"==typeof n&&c(n))return!0}return!1}function h(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!a.has(n)&&("object"==typeof e[n]&&(0,i.eachItem)(e[n],(e=>t+=h(e))),t===1/0))return 1/0}return t}function d(e="",t){!1!==t&&(e=m(e));return u(o.parse(e))}function u(e){return o.serialize(e).split("#")[0]+"#"}t.getFullPath=d,t._getFullPath=u;const p=/#\/?$/;function m(e){return e?e.replace(p,""):""}t.normalizeId=m,t.resolveUrl=function(e,t){return t=m(t),o.resolve(e,t)};const f=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n}=this.opts,i=m(e[n]||t),a={"":i},l=d(i,!1),c={},h=new Set;return r(e,{allKeys:!0},((e,t,i,s)=>{if(void 0===s)return;const r=l+t;let d=a[s];function g(t){if(t=m(d?o.resolve(d,t):t),h.has(t))throw p(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?u(e,n.schema,t):t!==m(r)&&("#"===t[0]?(u(e,c[t],t),c[t]=e):this.refs[t]=r),t}function v(e){if("string"==typeof e){if(!f.test(e))throw new Error(`invalid anchor "${e}"`);g.call(this,`#${e}`)}}"string"==typeof e[n]&&(d=g.call(this,e[n])),v.call(this,e.$anchor),v.call(this,e.$dynamicAnchor),a[t]=d})),c;function u(e,t,n){if(void 0!==t&&!s(e,t))throw p(n)}function p(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},46754:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const n=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&n.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},20530:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const i=n(56110),s=n(6657);function r(e,t=e.schema){const{opts:n,self:i}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const s=i.RULES.keywords;for(const n in t)s[n]||m(e,`unknown keyword: "${n}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const n in e)if(t[n])return!0;return!1}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:s}){return(r,o,a,l)=>{const c=void 0===a?o:a instanceof i.Name?(o instanceof i.Name?e(r,o,a):t(r,o,a),a):o instanceof i.Name?(t(r,a,o),o):n(o,a);return l!==i.Name||c instanceof i.Name?c:s(r,c)}}function h(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",i._`{}`);return void 0!==t&&d(e,n,t),n}function d(e,t,n){Object.keys(n).forEach((n=>e.assign(i._`${t}${(0,i.getProperty)(n)}`,!0)))}t.toHash=function(e){const t={};for(const n of e)t[n]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!o(t,e.self.RULES.all))},t.checkUnknownRules=r,t.schemaHasRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,s,r){if(!r){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return i._`${n}`}return i._`${e}${t}${(0,i.getProperty)(s)}`},t.unescapeFragment=function(e){return l(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=l,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>{e.if(i._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,i._`${n} || {}`).code(i._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,i._`${n} || {}`),d(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:h}),items:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,i._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>e.assign(n,!0===t||i._`${n} > ${t} ? ${n} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=h,t.setEvaluated=d;const u={};var p;function m(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:u[t.code]||(u[t.code]=new s._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(p=t.Type||(t.Type={})),t.getErrorPath=function(e,t,n){if(e instanceof i.Name){const s=t===p.Num;return n?s?i._`"[" + ${e} + "]"`:i._`"['" + ${e} + "']"`:s?i._`"/" + ${e}`:i._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=m},87177:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>i(e,t)))}function i(e,t){var n;return void 0!==e[t.keyword]||(null===(n=t.definition.implements)||void 0===n?void 0:n.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},i){const s=t.RULES.types[i];return s&&!0!==s&&n(e,s)},t.shouldUseGroup=n,t.shouldUseRule=i},42971:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const i=n(16257),s=n(56110),r=n(17748),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:s}=e,r={gen:n,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,i.reportError)(r,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:i}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(r.default.data):(t.assign(s._`${i}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:i}=e;!1===i?(n.var(t,!1),a(e)):n.var(t,!0)}},97349:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const i=n(46754),s=n(87177),r=n(16257),o=n(56110),a=n(20530);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(i.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l=t.DataType||(t.DataType={})),t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:i,opts:r}=e,a=function(e,t){return t?e.filter((e=>h.has(e)||"array"===t&&"array"===e)):[]}(t,r.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,s.schemaHasRulesForType)(e,t[0]));if(c){const s=u(t,i,r.strictNumbers,l.Wrong);n.if(s,(()=>{a.length?function(e,t,n){const{gen:i,data:s,opts:r}=e,a=i.let("dataType",o._`typeof ${s}`),l=i.let("coerced",o._`undefined`);"array"===r.coerceTypes&&i.if(o._`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,(()=>i.assign(s,o._`${s}[0]`).assign(a,o._`typeof ${s}`).if(u(t,s,r.strictNumbers),(()=>i.assign(l,s)))));i.if(o._`${l} !== undefined`);for(const e of n)(h.has(e)||"array"===e&&"array"===r.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void i.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${s}`).elseIf(o._`${s} === null`).assign(l,o._`""`);case"number":return void i.elseIf(o._`${a} == "boolean" || ${s} === null + || (${a} == "string" && ${s} && ${s} == +${s})`).assign(l,o._`+${s}`);case"integer":return void i.elseIf(o._`${a} === "boolean" || ${s} === null + || (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(l,o._`+${s}`);case"boolean":return void i.elseIf(o._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(l,!1).elseIf(o._`${s} === "true" || ${s} === 1`).assign(l,!0);case"null":return i.elseIf(o._`${s} === "" || ${s} === 0 || ${s} === false`),void i.assign(l,null);case"array":i.elseIf(o._`${a} === "string" || ${a} === "number" + || ${a} === "boolean" || ${s} === null`).assign(l,o._`[${s}]`)}}i.else(),m(e),i.endIf(),i.if(o._`${l} !== undefined`,(()=>{i.assign(s,l),function({gen:e,parentData:t,parentDataProperty:n},i){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,i)))}(e,l)}))}(e,t,a):m(e)}))}return c};const h=new Set(["string","number","integer","boolean","null"]);function d(e,t,n,i=l.Correct){const s=i===l.Correct?o.operators.EQ:o.operators.NEQ;let r;switch(e){case"null":return o._`${t} ${s} null`;case"array":r=o._`Array.isArray(${t})`;break;case"object":r=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":r=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":r=a();break;default:return o._`typeof ${t} ${s} ${e}`}return i===l.Correct?r:(0,o.not)(r);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function u(e,t,n,i){if(1===e.length)return d(e[0],t,n,i);let s;const r=(0,a.toHash)(e);if(r.array&&r.object){const e=o._`typeof ${t} != "object"`;s=r.null?e:o._`!${t} || ${e}`,delete r.null,delete r.array,delete r.object}else s=o.nil;r.number&&delete r.integer;for(const e in r)s=(0,o.and)(s,d(e,t,n,i));return s}t.checkDataType=d,t.checkDataTypes=u;const p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:n,schema:i}=e,s=(0,a.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:n,schema:i.type,schemaCode:s,schemaValue:s,parentSchema:i,params:{},it:e}}(e);(0,r.reportError)(t,p)}t.reportTypeError=m},15944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const i=n(56110),s=n(20530);function r(e,t,n){const{gen:r,compositeRule:o,data:a,opts:l}=e;if(void 0===n)return;const c=i._`${a}${(0,i.getProperty)(t)}`;if(o)return void(0,s.checkStrictMode)(e,`default is ignored for: ${c}`);let h=i._`${c} === undefined`;"empty"===l.useDefaults&&(h=i._`${h} || ${c} === null || ${c} === ""`),r.if(h,i._`${c} = ${(0,i.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:i}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(i)&&i.forEach(((t,n)=>r(e,n,t.default)))}},43750:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const i=n(42971),s=n(97349),r=n(87177),o=n(97349),a=n(15944),l=n(42e3),c=n(35678),h=n(56110),d=n(17748),u=n(66184),p=n(20530),m=n(16257);function f({gen:e,validateName:t,schema:n,schemaEnv:i,opts:s},r){s.code.es5?e.func(t,h._`${d.default.data}, ${d.default.valCxt}`,i.$async,(()=>{e.code(h._`"use strict"; ${g(n,s)}`),function(e,t){e.if(d.default.valCxt,(()=>{e.var(d.default.instancePath,h._`${d.default.valCxt}.${d.default.instancePath}`),e.var(d.default.parentData,h._`${d.default.valCxt}.${d.default.parentData}`),e.var(d.default.parentDataProperty,h._`${d.default.valCxt}.${d.default.parentDataProperty}`),e.var(d.default.rootData,h._`${d.default.valCxt}.${d.default.rootData}`),t.dynamicRef&&e.var(d.default.dynamicAnchors,h._`${d.default.valCxt}.${d.default.dynamicAnchors}`)}),(()=>{e.var(d.default.instancePath,h._`""`),e.var(d.default.parentData,h._`undefined`),e.var(d.default.parentDataProperty,h._`undefined`),e.var(d.default.rootData,d.default.data),t.dynamicRef&&e.var(d.default.dynamicAnchors,h._`{}`)}))}(e,s),e.code(r)})):e.func(t,h._`${d.default.data}, ${function(e){return h._`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?h._`, ${d.default.dynamicAnchors}={}`:h.nil}}={}`}(s)}`,i.$async,(()=>e.code(g(n,s)).code(r)))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?h._`/*# sourceURL=${n} */`:h.nil}function v(e,t){b(e)&&(_(e),y(e))?function(e,t){const{schema:n,gen:i,opts:s}=e;s.$comment&&n.$comment&&w(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const r=i.const("_errs",d.default.errors);x(e,r),i.var(t,h._`${r} === ${d.default.errors}`)}(e,t):(0,i.boolOrEmptySchema)(e,t)}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function b(e){return"boolean"!=typeof e.schema}function _(e){(0,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:i,self:s}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function x(e,t){if(e.opts.jtd)return S(e,[],!1,t);const n=(0,s.getSchemaTypes)(e.schema);S(e,n,!(0,s.coerceAndCheckDataType)(e,n),t)}function w({gen:e,schemaEnv:t,schema:n,errSchemaPath:i,opts:s}){const r=n.$comment;if(!0===s.$comment)e.code(h._`${d.default.self}.logger.log(${r})`);else if("function"==typeof s.$comment){const n=h.str`${i}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code(h._`${d.default.self}.opts.$comment(${r}, ${n}, ${s}.schema)`)}}function S(e,t,n,i){const{gen:s,schema:a,data:l,allErrors:c,opts:u,self:m}=e,{RULES:f}=m;function g(p){(0,r.shouldUseGroup)(a,p)&&(p.type?(s.if((0,o.checkDataType)(p.type,l,u.strictNumbers)),M(e,p),1===t.length&&t[0]===p.type&&n&&(s.else(),(0,o.reportTypeError)(e)),s.endIf()):M(e,p),c||s.if(h._`${d.default.errors} === ${i||0}`))}!a.$ref||!u.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(u.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{T(e.dataTypes,t)||C(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),e.dataTypes=e.dataTypes.filter((e=>T(t,e)))})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&C(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const i in n){const s=n[i];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:n}=s.definition;n.length&&!n.some((e=>E(t,e)))&&C(e,`missing type "${n.join(",")}" for keyword "${i}"`)}}}(e,e.dataTypes)}(e,t),s.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):s.block((()=>P(e,"$ref",f.all.$ref.definition)))}function M(e,t){const{gen:n,schema:i,opts:{useDefaults:s}}=e;s&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,r.shouldUseRule)(i,n)&&P(e,n.keyword,n.definition,t.type)}))}function E(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function T(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function C(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){b(e)&&(_(e),y(e))?function(e){const{schema:t,opts:n,gen:i}=e;f(e,(()=>{n.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),i.let(d.default.vErrors,null),i.let(d.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",h._`${n}.evaluated`),t.if(h._`${e.evaluated}.dynamicProps`,(()=>t.assign(h._`${e.evaluated}.props`,h._`undefined`))),t.if(h._`${e.evaluated}.dynamicItems`,(()=>t.assign(h._`${e.evaluated}.items`,h._`undefined`)))}(e),x(e),function(e){const{gen:t,schemaEnv:n,validateName:i,ValidationError:s,opts:r}=e;n.$async?t.if(h._`${d.default.errors} === 0`,(()=>t.return(d.default.data)),(()=>t.throw(h._`new ${s}(${d.default.vErrors})`))):(t.assign(h._`${i}.errors`,d.default.vErrors),r.unevaluated&&function({gen:e,evaluated:t,props:n,items:i}){n instanceof h.Name&&e.assign(h._`${t}.props`,n);i instanceof h.Name&&e.assign(h._`${t}.items`,i)}(e),t.return(h._`${d.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,i.topBoolOrEmptySchema)(e)))};class A{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",N(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,n){this.failResult((0,h.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,h.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(h._`${t} !== undefined && (${(0,h.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_error(e,t){(e?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=h.nil){this.gen.block((()=>{this.check$data(e,n),t()}))}check$data(e=h.nil,t=h.nil){if(!this.$data)return;const{gen:n,schemaCode:i,schemaType:s,def:r}=this;n.if((0,h.or)(h._`${i} === undefined`,t)),e!==h.nil&&n.assign(e,!0),(s.length||r.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==h.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:n,def:i,it:s}=this;return(0,h.or)(function(){if(n.length){if(!(t instanceof h.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return h._`${(0,o.checkDataTypes)(e,t,s.opts.strictNumbers,o.DataType.Wrong)}`}return h.nil}(),function(){if(i.validateSchema){const n=e.scopeValue("validate$data",{ref:i.validateSchema});return h._`!${n}(${t})`}return h.nil}())}subschema(e,t){const n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);const i={...this.it,...n,items:void 0,props:void 0};return v(i,t),i}mergeEvaluated(e,t){const{it:n,gen:i}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(i,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(i,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:i}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return i.if(t,(()=>this.mergeEvaluated(e,h.Name))),!0}}function P(e,t,n,i){const s=new A(e,n,t);"code"in n?n.code(s,i):s.$data&&n.validate?(0,l.funcKeywordCode)(s,n):"macro"in n?(0,l.macroKeywordCode)(s,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(s,n)}t.KeywordCxt=A;const R=/^\/(?:[^~]|~0|~1)*$/,L=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:n,dataPathArr:i}){let s,r;if(""===e)return d.default.rootData;if("/"===e[0]){if(!R.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,r=d.default.rootData}else{const o=L.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(s=o[2],"#"===s){if(a>=t)throw new Error(l("property/index",a));return i[t-a]}if(a>t)throw new Error(l("data",a));if(r=n[t-a],!s)return r}let o=r;const a=s.split("/");for(const e of a)e&&(r=h._`${r}${(0,h.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=h._`${o} && ${r}`);return o;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=N},42e3:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const i=n(56110),s=n(17748),r=n(57111),o=n(16257);function a(e){const{gen:t,data:n,it:s}=e;t.if(s.parentData,(()=>t.assign(n,i._`${s.parentData}[${s.parentDataProperty}]`)))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,i.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:s,schema:r,parentSchema:o,it:a}=e,c=t.macro.call(a.self,r,o,a),h=l(n,s,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const d=n.name("valid");e.subschema({schema:c,schemaPath:i.nil,errSchemaPath:`${a.errSchemaPath}/${s}`,topSchemaRef:h,compositeRule:!0},d),e.pass(d,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:h,schema:d,parentSchema:u,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const f=!p&&t.compile?t.compile.call(m.self,d,u,m):t.validate,g=l(c,h,f),v=c.let("valid");function y(n=(t.async?i._`await `:i.nil)){const o=m.opts.passContext?s.default.this:s.default.self,a=!("compile"in t&&!p||!1===t.schema);c.assign(v,i._`${n}${(0,r.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var n;c.if((0,i.not)(null!==(n=t.valid)&&void 0!==n?n:v),e)}e.block$data(v,(function(){if(!1===t.errors)y(),t.modifying&&a(e),b((()=>e.error()));else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>y(i._`await `)),(t=>c.assign(v,!1).if(i._`${t} instanceof ${m.ValidationError}`,(()=>c.assign(e,i._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=i._`${g}.errors`;return c.assign(e,null),y(i.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:n}=e;n.if(i._`Array.isArray(${t})`,(()=>{n.assign(s.default.vErrors,i._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`).assign(s.default.errors,i._`${s.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:v)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:i},s,r){if(Array.isArray(s.keyword)?!s.keyword.includes(r):s.keyword!==r)throw new Error("ajv implementation error");const o=s.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${r}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[r])){const e=`keyword "${r}" value is invalid at path "${i}": `+n.errorsText(s.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}}},35678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const i=n(56110),s=n(20530);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==r)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const r=e.schema[t];return void 0===n?{schema:r,schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:r[n],schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}${(0,i.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,s.escapeFragment)(n)}`}}if(void 0!==r){if(void 0===o||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:l,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:a,propertyName:l}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:l}=t;h(c.let("data",i._`${t.data}${(0,i.getProperty)(n)}`,!0)),e.errorPath=i.str`${o}${(0,s.getErrorPath)(n,r,l.jsPropertySyntax)}`,e.parentDataProperty=i._`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}if(void 0!==o){h(o instanceof i.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)}function h(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:i,createErrors:s,allErrors:r}){void 0!==i&&(e.compositeRule=i),void 0!==s&&(e.createErrors=s),void 0!==r&&(e.allErrors=r),e.jtdDiscriminator=t,e.jtdMetadata=n}},72206:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var i=n(43750);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return i.KeywordCxt}});var s=n(56110);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return s.CodeGen}});const r=n(97939),o=n(33482),a=n(46754),l=n(59336),c=n(56110),h=n(66184),d=n(97349),u=n(20530),p=n(338),m=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function y(e){var t,n,i,s,r,o,a,l,c,h,d,u,p,m,f,g,v,y,b,_,x,w;const S=e.strict,M=null===(t=e.code)||void 0===t?void 0:t.optimize,E=!0===M||void 0===M?1:M||0;return{strictSchema:null===(i=null!==(n=e.strictSchema)&&void 0!==n?n:S)||void 0===i||i,strictNumbers:null===(r=null!==(s=e.strictNumbers)&&void 0!==s?s:S)||void 0===r||r,strictTypes:null!==(a=null!==(o=e.strictTypes)&&void 0!==o?o:S)&&void 0!==a?a:"log",strictTuples:null!==(c=null!==(l=e.strictTuples)&&void 0!==l?l:S)&&void 0!==c?c:"log",strictRequired:null!==(d=null!==(h=e.strictRequired)&&void 0!==h?h:S)&&void 0!==d&&d,code:e.code?{...e.code,optimize:E}:{optimize:E},loopRequired:null!==(u=e.loopRequired)&&void 0!==u?u:200,loopEnum:null!==(p=e.loopEnum)&&void 0!==p?p:200,meta:null===(m=e.meta)||void 0===m||m,messages:null===(f=e.messages)||void 0===f||f,inlineRefs:null===(g=e.inlineRefs)||void 0===g||g,schemaId:null!==(v=e.schemaId)&&void 0!==v?v:"$id",addUsedSchema:null===(y=e.addUsedSchema)||void 0===y||y,validateSchema:null===(b=e.validateSchema)||void 0===b||b,validateFormats:null===(_=e.validateFormats)||void 0===_||_,unicodeRegExp:null===(x=e.unicodeRegExp)||void 0===x||x,int32range:null===(w=e.int32range)||void 0===w||w}}class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...y(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:f,es5:t,lines:n}),this.logger=function(e){if(!1===e)return T;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),_.call(this,g,e,"NOT SUPPORTED"),_.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=E.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&M.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let i=p;"id"===n&&(i={...p},i.id=i.$id,delete i.$id),t&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let n;if("string"==typeof e){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);const i=n(t);return"$async"in n||(this.errors=n.errors),i}compile(e,t){const n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:n}=this.opts;return i.call(this,e,t);async function i(e,t){await s.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||r.call(this,n)}async function s(e){e&&!this.getSchema(e)&&await i.call(this,{$ref:e},!0)}async function r(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),r.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){const n=await c.call(this,e);this.refs[e]||await s.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,i);return this}let s;if("object"==typeof e){const{schemaId:t}=this.opts;if(s=e[t],void 0!==s&&"string"!=typeof s)throw new Error(`schema ${t} must be string`)}return t=(0,h.normalizeId)(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,i,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let n;if(n=e.$schema,void 0!==n&&"string"!=typeof n)throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(n,e);if(!i&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return i}getSchema(e){let t;for(;"string"==typeof(t=x.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,i=new l.SchemaEnv({schema:{},schemaId:n});if(t=l.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=x.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,h.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(A.call(this,n,t),!t)return(0,u.eachItem)(n,(e=>P.call(this,e))),this;L.call(this,t);const i={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,0===i.type.length?e=>P.call(this,e,i):e=>i.type.forEach((t=>P.call(this,e,i,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const n of t.rules){const t=n.rules.findIndex((t=>t.keyword===e));t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){return e&&0!==e.length?e.map((e=>`${n}${e.instancePath} ${e.message}`)).reduce(((e,n)=>e+t+n)):"No errors"}$dataMetaSchema(e,t){const n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const i of t){const t=i.split("/").slice(1);let s=e;for(const e of t)s=s[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:i}=t.definition,r=s[e];i&&r&&(s[e]=D(r))}}return e}_removeAllSchemas(e,t){for(const n in e){const i=e[n];t&&!t.test(n)||("string"==typeof i?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,t,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let r;const{schemaId:o}=this.opts;if("object"==typeof e)r=e[o];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;n=(0,h.normalizeId)(r||n);const c=h.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),i&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function _(e,t,n,i="error"){for(const s in e){const r=s;r in t&&this.logger[i](`${n}: option ${s}. ${e[r]}`)}}function x(e){return e=(0,h.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function M(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}}function E(){const e={...this.opts};for(const t of m)delete e[t];return e}t.default=b,b.ValidationError=r.default,b.MissingRefError=o.default;const T={log(){},warn(){},error(){}};const C=/^[a-z_$][a-z0-9_$:-]*$/i;function A(e,t){const{RULES:n}=this;if((0,u.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!C.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function P(e,t,n){var i;const s=null==t?void 0:t.post;if(n&&s)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:r}=this;let o=s?r.post:r.rules.find((({type:e})=>e===n));if(o||(o={type:n,rules:[]},r.rules.push(o)),r.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?R.call(this,o,a,t.before):o.rules.push(a),r.all[e]=a,null===(i=t.implements)||void 0===i||i.forEach((e=>this.addKeyword(e)))}function R(e,t,n){const i=e.rules.findIndex((e=>e.keyword===n));i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function L(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=D(t)),e.validateSchema=this.compile(t,!0))}const N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D(e){return{anyOf:[e,N]}}},18062:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(28926);i.code='require("ajv/dist/runtime/equal").default',t.default=i},75842:(e,t)=>{"use strict";function n(e){const t=e.length;let n,i=0,s=0;for(;s=55296&&n<=56319&&s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=n},81600:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const i=n(56110),s=n(20530),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:i}=t;Array.isArray(i)?o(e,i):(0,s.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:r,data:o,keyword:a,it:l}=e;l.items=!0;const c=n.const("len",i._`${o}.length`);if(!1===r)e.setParams({len:t.length}),e.pass(i._`${c} <= ${t.length}`);else if("object"==typeof r&&!(0,s.alwaysValidSchema)(l,r)){const r=n.var("valid",i._`${c} <= ${t.length}`);n.if((0,i.not)(r),(()=>function(r){n.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:s.Type.Num},r),l.allErrors||n.if((0,i.not)(r),(()=>n.break()))}))}(r))),e.ok(r)}}t.validateAdditionalItems=o,t.default=r},88183:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(57111),s=n(56110),r=n(17748),o=n(20530),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>s._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:l,errsCount:c,it:h}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:d,opts:u}=h;if(h.props=!0,"all"!==u.removeAdditional&&(0,o.alwaysValidSchema)(h,n))return;const p=(0,i.allSchemaProperties)(a.properties),m=(0,i.allSchemaProperties)(a.patternProperties);function f(e){t.code(s._`delete ${l}[${e}]`)}function g(i){if("all"===u.removeAdditional||u.removeAdditional&&!1===n)f(i);else{if(!1===n)return e.setParams({additionalProperty:i}),e.error(),void(d||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(h,n)){const n=t.name("valid");"failing"===u.removeAdditional?(v(i,n,!1),t.if((0,s.not)(n),(()=>{e.reset(),f(i)}))):(v(i,n),d||t.if((0,s.not)(n),(()=>t.break())))}}}function v(t,n,i){const s={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===i&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(s,n)}t.forIn("key",l,(n=>{p.length||m.length?t.if(function(n){let r;if(p.length>8){const e=(0,o.schemaRefOrVal)(h,a.properties,"properties");r=(0,i.isOwnProperty)(t,e,n)}else r=p.length?(0,s.or)(...p.map((e=>s._`${n} === ${e}`))):s.nil;return m.length&&(r=(0,s.or)(r,...m.map((t=>s._`${(0,i.usePattern)(e,t)}.test(${n})`)))),(0,s.not)(r)}(n),(()=>g(n))):g(n)})),e.ok(s._`${c} === ${r.default.errors}`)}};t.default=a},68302:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(20530),s={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:s}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const r=t.name("valid");n.forEach(((t,n)=>{if((0,i.alwaysValidSchema)(s,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},r);e.ok(r),e.mergeEvaluated(o)}))}};t.default=s},50120:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(57111).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=i},97458:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?i.str`must contain at least ${e} valid item(s)`:i.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?i._`{minContains: ${e}}`:i._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:a}=e;let l,c;const{minContains:h,maxContains:d}=r;a.opts.next?(l=void 0===h?1:h,c=d):l=1;const u=t.const("len",i._`${o}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,s.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,s.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,s.alwaysValidSchema)(a,n)){let t=i._`${u} >= ${l}`;return void 0!==c&&(t=i._`${t} && ${u} <= ${c}`),void e.pass(t)}a.items=!0;const p=t.name("valid");function m(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(i._`${e}++`),void 0===c?t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0).break())):(t.if(i._`${e} > ${c}`,(()=>t.assign(p,!1).break())),1===l?t.assign(p,!0):t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,i){t.forRange("i",0,u,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:s.Type.Num,compositeRule:!0},n),i()}))}void 0===c&&1===l?f(p,(()=>t.if(p,(()=>t.break())))):(t.let(p,!1),0===l?t.if(i._`${o}.length > 0`,m,(()=>t.assign(p,!0))):m()),e.result(p,(()=>e.reset()))}};t.default=r},32790:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const i=n(56110),s=n(20530),r=n(57111);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const s=1===t?"property":"properties";return i.str`must have ${s} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:s}})=>i._`{property: ${e}, + missingProperty: ${s}, + depsCount: ${t}, + deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const i in e){if("__proto__"===i)continue;(Array.isArray(e[i])?t:n)[i]=e[i]}return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:s,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const h=(0,r.propertyInData)(n,s,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?n.if(h,(()=>{for(const t of c)(0,r.checkReportMissingProp)(e,t)})):(n.if(i._`${h} && (${(0,r.checkMissingProp)(e,c,a)})`),(0,r.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:i,keyword:o,it:a}=e,l=n.name("valid");for(const c in t)(0,s.alwaysValidSchema)(a,t[c])||(n.if((0,r.propertyInData)(n,i,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},17498:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>i.str`must match "${e.ifClause}" schema`,params:({params:e})=>i._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:r}=e;void 0===n.then&&void 0===n.else&&(0,s.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const a=o(r,"then"),l=o(r,"else");if(!a&&!l)return;const c=t.let("valid",!0),h=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(h,d("then",n),d("else",n))}else a?t.if(h,d("then")):t.if((0,i.not)(h),d("else"));function d(n,s){return()=>{const r=e.subschema({keyword:n},h);t.assign(c,h),e.mergeValidEvaluated(r,c),s?t.assign(s,i._`${n}`):e.setParams({ifClause:n})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,s.alwaysValidSchema)(e,n)}t.default=r},3698:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(81600),s=n(53609),r=n(38223),o=n(62490),a=n(97458),l=n(32790),c=n(13796),h=n(88183),d=n(11935),u=n(98289),p=n(62514),m=n(50120),f=n(16328),g=n(68302),v=n(17498),y=n(96105);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,v.default,y.default,c.default,h.default,l.default,d.default,u.default];return e?t.push(s.default,o.default):t.push(i.default,r.default),t.push(a.default),t}},38223:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const i=n(56110),s=n(20530),r=n(57111),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,s.alwaysValidSchema)(n,t)||e.ok((0,r.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:r,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:i,errSchemaPath:r}=c,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(i.strictTuples&&!a){const e=`"${l}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${r}"`;(0,s.checkStrictMode)(c,e,i.strictTuples)}}(o),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=s.mergeEvaluated.items(r,n.length,c.items));const h=r.name("valid"),d=r.const("len",i._`${a}.length`);n.forEach(((t,n)=>{(0,s.alwaysValidSchema)(c,t)||(r.if(i._`${d} > ${n}`,(()=>e.subschema({keyword:l,schemaProp:n,dataProp:n},h))),e.ok(h))}))}t.validateTuple=a,t.default=o},62490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r=n(57111),o=n(81600),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:i}=e,{prefixItems:a}=n;i.items=!0,(0,s.alwaysValidSchema)(i,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,r.validateArray)(e)))}};t.default=a},62514:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(20530),s={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:s}=e;if((0,i.alwaysValidSchema)(s,n))return void e.fail();const r=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),e.failResult(r,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=s},16328:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>i._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const a=n,l=t.let("valid",!1),c=t.let("passing",null),h=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((n,r)=>{let a;(0,s.alwaysValidSchema)(o,n)?t.var(h,!0):a=e.subschema({keyword:"oneOf",schemaProp:r,compositeRule:!0},h),r>0&&t.if(i._`${h} && ${l}`).assign(l,!1).assign(c,i._`[${c}, ${r}]`).else(),t.if(h,(()=>{t.assign(l,!0),t.assign(c,r),a&&e.mergeEvaluated(a,i.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=r},98289:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(57111),s=n(56110),r=n(20530),o=n(20530),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:l,it:c}=e,{opts:h}=c,d=(0,i.allSchemaProperties)(n),u=d.filter((e=>(0,r.alwaysValidSchema)(c,n[e])));if(0===d.length||u.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;const p=h.strictSchema&&!h.allowMatchingProperties&&l.properties,m=t.name("valid");!0===c.props||c.props instanceof s.Name||(c.props=(0,o.evaluatedPropsToName)(t,c.props));const{props:f}=c;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(n){t.forIn("key",a,(r=>{t.if(s._`${(0,i.usePattern)(e,n)}.test(${r})`,(()=>{const i=u.includes(n);i||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:r,dataPropType:o.Type.Str},m),c.opts.unevaluated&&!0!==f?t.assign(s._`${f}[${r}]`,!0):i||c.allErrors||t.if((0,s.not)(m),(()=>t.break()))}))}))}!function(){for(const e of d)p&&g(e),c.allErrors?v(e):(t.var(m,!0),v(e),t.if(m))}()}};t.default=a},53609:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(38223),s={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,i.validateTuple)(e,"items")};t.default=s},11935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(43750),s=n(57111),r=n(20530),o=n(88183),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new i.KeywordCxt(c,o.default,"additionalProperties"));const h=(0,s.allSchemaProperties)(n);for(const e of h)c.definedProperties.add(e);c.opts.unevaluated&&h.length&&!0!==c.props&&(c.props=r.mergeEvaluated.props(t,(0,r.toHash)(h),c.props));const d=h.filter((e=>!(0,r.alwaysValidSchema)(c,n[e])));if(0===d.length)return;const u=t.name("valid");for(const n of d)p(n)?m(n):(t.if((0,s.propertyInData)(t,l,n,c.opts.ownProperties)),m(n),c.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(u);function p(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},u)}}};t.default=a},13796:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>i._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,s.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",r,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,i.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=r},96105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(20530),s={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,i.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=s},57111:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const i=n(56110),s=n(20530),r=n(17748);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:i._`Object.prototype.hasOwnProperty`})}function a(e,t,n){return i._`${o(e)}.call(${t}, ${n})`}function l(e,t,n,s){const r=i._`${t}${(0,i.getProperty)(n)} === undefined`;return s?(0,i.or)(r,(0,i.not)(a(e,t,n))):r}function c(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:s,it:r}=e;n.if(l(n,s,t,r.opts.ownProperties),(()=>{e.setParams({missingProperty:i._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},s,r){return(0,i.or)(...s.map((s=>(0,i.and)(l(e,t,s,n.ownProperties),i._`${r} = ${s}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=a,t.propertyInData=function(e,t,n,s){const r=i._`${t}${(0,i.getProperty)(n)} !== undefined`;return s?i._`${r} && ${a(e,t,n)}`:r},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(e,t){return c(t).filter((n=>!(0,s.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:s,schemaPath:o,errorPath:a},it:l},c,h,d){const u=d?i._`${e}, ${t}, ${s}${o}`:t,p=[[r.default.instancePath,(0,i.strConcat)(r.default.instancePath,a)],[r.default.parentData,l.parentData],[r.default.parentDataProperty,l.parentDataProperty],[r.default.rootData,r.default.rootData]];l.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const m=i._`${u}, ${n.object(...p)}`;return h!==i.nil?i._`${c}.call(${h}, ${m})`:i._`${c}(${m})`},t.usePattern=function({gen:e,it:{opts:t}},n){const s=t.unicodeRegExp?"u":"";return e.scopeValue("pattern",{key:n,ref:new RegExp(n,s),code:i._`new RegExp(${n}, ${s})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:r,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return l((()=>t.assign(e,!1))),e}return t.var(a,!0),l((()=>t.break())),a;function l(o){const l=t.const("len",i._`${n}.length`);t.forRange("i",0,l,(n=>{e.subschema({keyword:r,dataProp:n,dataPropType:s.Type.Num},a),t.if((0,i.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,s.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>n.forEach(((n,s)=>{const o=e.subschema({keyword:r,schemaProp:s,compositeRule:!0},l);t.assign(a,i._`${a} || ${l}`);e.mergeValidEvaluated(o,l)||t.if((0,i.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},84874:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},59730:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(84874),s=n(45403),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",i.default,s.default];t.default=r},45403:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const i=n(33482),s=n(57111),r=n(56110),o=n(17748),a=n(59336),l=n(20530),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:s}=e,{baseId:o,schemaEnv:l,validateName:c,opts:u,self:p}=s,{root:m}=l;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(l===m)return d(e,c,l,l.$async);const n=t.scopeValue("root",{ref:m});return d(e,r._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new i.default(o,n);return f instanceof a.SchemaEnv?function(t){const n=h(e,t);d(e,n,t,t.$async)}(f):function(i){const s=t.scopeValue("schema",!0===u.code.source?{ref:i,code:(0,r.stringify)(i)}:{ref:i}),o=t.name("valid"),a=e.subschema({schema:i,dataTypes:[],schemaPath:r.nil,topSchemaRef:s,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function h(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function d(e,t,n,i){const{gen:a,it:c}=e,{allErrors:h,schemaEnv:d,opts:u}=c,p=u.passContext?o.default.this:r.nil;function m(e){const t=r._`${e}.errors`;a.assign(o.default.vErrors,r._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,r._`${o.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;const i=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(i&&!i.dynamicProps)void 0!==i.props&&(c.props=l.mergeEvaluated.props(a,i.props,c.props));else{const t=a.var("props",r._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,r.Name)}if(!0!==c.items)if(i&&!i.dynamicItems)void 0!==i.items&&(c.items=l.mergeEvaluated.items(a,i.items,c.items));else{const t=a.var("items",r._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,r.Name)}}i?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(r._`await ${(0,s.callValidateCode)(e,t,p)}`),f(t),h||a.assign(n,!0)}),(e=>{a.if(r._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),m(e),h||a.assign(n,!1)})),e.ok(n)}():e.result((0,s.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=h,t.callRef=d,t.default=c},73348:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(2997),r={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===s.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>i._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:a}=e,{oneOf:l}=o;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");const c=r.propertyName;if("string"!=typeof c)throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const h=t.let("valid",!1),d=t.const("tag",i._`${n}${(0,i.getProperty)(c)}`);function u(n){const s=t.name("valid"),r=e.subschema({keyword:"oneOf",schemaProp:n},s);return e.mergeEvaluated(r,i.Name),s}t.if(i._`typeof ${d} == "string"`,(()=>function(){const n=function(){var e;const t={},n=s(o);let i=!0;for(let t=0;te.error(!1,{discrError:s.DiscrError.Tag,tag:d,tagName:c}))),e.ok(h)}};t.default=r},2997:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(t.DiscrError||(t.DiscrError={}))},610:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(59730),s=n(86020),r=n(3698),o=n(45036),a=n(99275),l=[i.default,s.default,(0,r.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},88997:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match format "${e}"`,params:({schemaCode:e})=>i._`{format: ${e}}`},code(e,t){const{gen:n,data:s,$data:r,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:h,schemaEnv:d,self:u}=l;c.validateFormats&&(r?function(){const r=n.scopeValue("formats",{ref:u.formats,code:c.code.formats}),o=n.const("fDef",i._`${r}[${a}]`),l=n.let("fType"),h=n.let("format");n.if(i._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(l,i._`${o}.type || "string"`).assign(h,i._`${o}.validate`)),(()=>n.assign(l,i._`"string"`).assign(h,o))),e.fail$data((0,i.or)(!1===c.strictSchema?i.nil:i._`${a} && !${h}`,function(){const e=d.$async?i._`(${o}.async ? await ${h}(${s}) : ${h}(${s}))`:i._`${h}(${s})`,n=i._`(typeof ${h} == "function" ? ${e} : ${h}.test(${s}))`;return i._`${h} && ${h} !== true && ${l} === ${t} && !${n}`}()))}():function(){const r=u.formats[o];if(!r)return void function(){if(!1===c.strictSchema)return void u.logger.warn(e());throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${h}"`}}();if(!0===r)return;const[a,l,p]=function(e){const t=e instanceof RegExp?(0,i.regexpCode)(e):c.code.formats?i._`${c.code.formats}${(0,i.getProperty)(o)}`:void 0,s=n.scopeValue("formats",{key:o,ref:e,code:t});if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,i._`${s}.validate`];return["string",e,s]}(r);a===t&&e.pass(function(){if("object"==typeof r&&!(r instanceof RegExp)&&r.async){if(!d.$async)throw new Error("async format in sync schema");return i._`await ${p}(${s})`}return"function"==typeof l?i._`${p}(${s})`:i._`${p}.test(${s})`}())}())}};t.default=s},45036:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=[n(88997).default];t.default=i},99275:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},33103:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r=n(18062),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>i._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(i._`!${(0,s.useFunc)(t,r.default)}(${n}, ${a})`):e.fail(i._`${l} !== ${n}`)}};t.default=o},13139:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r=n(18062),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>i._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const h=a.length>=c.opts.loopEnum,d=(0,s.useFunc)(t,r.default);let u;if(h||o)u=t.let("valid"),e.block$data(u,(function(){t.assign(u,!1),t.forOf("v",l,(e=>t.if(i._`${d}(${n}, ${e})`,(()=>t.assign(u,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);u=(0,i.or)(...a.map(((t,s)=>function(e,t){const s=a[t];return"object"==typeof s&&null!==s?i._`${d}(${n}, ${e}[${t}])`:i._`${n} === ${s}`}(e,s))))}e.pass(u)}};t.default=o},86020:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(20897),s=n(75162),r=n(74905),o=n(22508),a=n(10082),l=n(86846),c=n(57569),h=n(55640),d=n(33103),u=n(13139),p=[i.default,s.default,r.default,o.default,a.default,l.default,c.default,h.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,u.default];t.default=p},57569:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:s}=e,r="maxItems"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`${n}.length ${r} ${s}`)}};t.default=s},74905:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=n(20530),r=n(75842),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,l="maxLength"===t?i.operators.GT:i.operators.LT,c=!1===a.opts.unicode?i._`${n}.length`:i._`${(0,s.useFunc)(e.gen,r.default)}(${n})`;e.fail$data(i._`${c} ${l} ${o}`)}};t.default=o},20897:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s=i.operators,r={maximum:{okStr:"<=",ok:s.LTE,fail:s.GT},minimum:{okStr:">=",ok:s.GTE,fail:s.LT},exclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},exclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}},o={message:({keyword:e,schemaCode:t})=>i.str`must be ${r[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{comparison: ${r[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:n,schemaCode:s}=e;e.fail$data(i._`${n} ${r[t].fail} ${s} || isNaN(${n})`)}};t.default=a},10082:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:s}=e,r="maxProperties"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`Object.keys(${n}).length ${r} ${s}`)}};t.default=s},75162:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(56110),s={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>i.str`must be multiple of ${e}`,params:({schemaCode:e})=>i._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:s,it:r}=e,o=r.opts.multipleOfPrecision,a=t.let("res"),l=o?i._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:i._`${a} !== parseInt(${a})`;e.fail$data(i._`(${s} === 0 || (${a} = ${n}/${s}, ${l}))`)}};t.default=s},22508:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(57111),s=n(56110),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>s.str`must match pattern "${e}"`,params:({schemaCode:e})=>s._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:r,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?s._`(new RegExp(${o}, ${l}))`:(0,i.usePattern)(e,r);e.fail$data(s._`!${c}.test(${t})`)}};t.default=r},86846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(57111),s=n(56110),r=n(20530),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>s.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>s._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:l,it:c}=e,{opts:h}=c;if(!l&&0===n.length)return;const d=n.length>=h.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(s.nil,u);else for(const t of n)(0,i.checkReportMissingProp)(e,t)}():function(){const r=t.let("missing");if(d||l){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,r){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(r,(0,i.propertyInData)(t,a,n,h.ownProperties)),t.if((0,s.not)(r),(()=>{e.error(),t.break()}))}),s.nil)}(r,n))),e.ok(n)}else t.if((0,i.checkMissingProp)(e,n,r)),(0,i.reportMissingProp)(e,r),t.else()}(),h.strictRequired){const t=e.parentSchema.properties,{definedProperties:i}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!i.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(c,t,c.opts.strictRequired)}}function u(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,i.noPropertyInData)(t,a,n,h.ownProperties),(()=>e.error()))}))}}};t.default=o},55640:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(97349),s=n(56110),r=n(20530),o=n(18062),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>s.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>s._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:l,parentSchema:c,schemaCode:h,it:d}=e;if(!a&&!l)return;const u=t.let("valid"),p=c.items?(0,i.getSchemaTypes)(c.items):[];function m(r,o){const a=t.name("item"),l=(0,i.checkDataTypes)(p,a,d.opts.strictNumbers,i.DataType.Wrong),c=t.const("indices",s._`{}`);t.for(s._`;${r}--;`,(()=>{t.let(a,s._`${n}[${r}]`),t.if(l,s._`continue`),p.length>1&&t.if(s._`typeof ${a} == "string"`,s._`${a} += "_"`),t.if(s._`typeof ${c}[${a}] == "number"`,(()=>{t.assign(o,s._`${c}[${a}]`),e.error(),t.assign(u,!1).break()})).code(s._`${c}[${a}] = ${r}`)}))}function f(i,a){const l=(0,r.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(s._`;${i}--;`,(()=>t.for(s._`${a} = ${i}; ${a}--;`,(()=>t.if(s._`${l}(${n}[${i}], ${n}[${a}])`,(()=>{e.error(),t.assign(u,!1).break(c)}))))))}e.block$data(u,(function(){const i=t.let("i",s._`${n}.length`),r=t.let("j");e.setParams({i,j:r}),t.assign(u,!0),t.if(s._`${i} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(i,r)))}),s._`${h} === false`),e.ok(u)}};t.default=a},28926:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,s,r;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(s=i;0!=s--;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(r=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(s=i;0!=s--;)if(!Object.prototype.hasOwnProperty.call(n,r[s]))return!1;for(s=i;0!=s--;){var o=r[s];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},68125:e=>{"use strict";var t=e.exports=function(e,t,i){"function"==typeof t&&(i=t,t={}),n(t,"function"==typeof(i=t.cb||i)?i:i.pre||function(){},i.post||function(){},e,"",e)};function n(e,i,s,r,o,a,l,c,h,d){if(r&&"object"==typeof r&&!Array.isArray(r)){for(var u in i(r,o,a,l,c,h,d),r){var p=r[u];if(Array.isArray(p)){if(u in t.arrayKeywords)for(var m=0;m1){t[0]=t[0].slice(0,-1);for(var i=t.length-1,s=1;s= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=p-m,T=Math.floor,C=String.fromCharCode;function A(e){throw new RangeError(M[e])}function P(e,t){for(var n=[],i=e.length;i--;)n[i]=t(e[i]);return n}function R(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+P((e=e.replace(S,".")).split("."),t).join(".")}function L(e){for(var t=[],n=0,i=e.length;n=55296&&s<=56319&&n>1,e+=T(e/t);e>E*f>>1;i+=p)e=T(e/E);return T(i+(E+1)*e/(e+g))},O=function(e){var t=[],n=e.length,i=0,s=b,r=y,o=e.lastIndexOf(_);o<0&&(o=0);for(var a=0;a=128&&A("not-basic"),t.push(e.charCodeAt(a));for(var l=o>0?o+1:0;l=n&&A("invalid-input");var g=N(e.charCodeAt(l++));(g>=p||g>T((u-i)/h))&&A("overflow"),i+=g*h;var v=d<=r?m:d>=r+f?f:d-r;if(gT(u/x)&&A("overflow"),h*=x}var w=t.length+1;r=I(i-c,w,0==c),T(i/w)>u-s&&A("overflow"),s+=T(i/w),i%=w,t.splice(i++,0,s)}return String.fromCodePoint.apply(String,t)},U=function(e){var t=[],n=(e=L(e)).length,i=b,s=0,r=y,o=!0,a=!1,l=void 0;try{for(var c,h=e[Symbol.iterator]();!(o=(c=h.next()).done);o=!0){var d=c.value;d<128&&t.push(C(d))}}catch(e){a=!0,l=e}finally{try{!o&&h.return&&h.return()}finally{if(a)throw l}}var g=t.length,v=g;for(g&&t.push(_);v=i&&RT((u-s)/N)&&A("overflow"),s+=(x-i)*N,i=x;var O=!0,U=!1,k=void 0;try{for(var V,z=e[Symbol.iterator]();!(O=(V=z.next()).done);O=!0){var F=V.value;if(Fu&&A("overflow"),F==i){for(var B=s,$=p;;$+=p){var j=$<=r?m:$>=r+f?f:$-r;if(B>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function $(e){for(var t="",n=0,i=e.length;n=194&&s<224){if(i-n>=6){var r=parseInt(e.substr(n+4,2),16);t+=String.fromCharCode((31&s)<<6|63&r)}else t+=e.substr(n,6);n+=6}else if(s>=224){if(i-n>=9){var o=parseInt(e.substr(n+4,2),16),a=parseInt(e.substr(n+7,2),16);t+=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a)}else t+=e.substr(n,9);n+=9}else t+=e.substr(n,3),n+=3}return t}function j(e,t){function n(e){var n=$(e);return n.match(t.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,n).replace(t.NOT_USERINFO,B).replace(t.PCT_ENCODED,s)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_HOST,B).replace(t.PCT_ENCODED,s)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,n).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,B).replace(t.PCT_ENCODED,s)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,n).replace(t.NOT_QUERY,B).replace(t.PCT_ENCODED,s)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,n).replace(t.NOT_FRAGMENT,B).replace(t.PCT_ENCODED,s)),e}function H(e){return e.replace(/^0*(.*)/,"$1")||"0"}function G(e,t){var n=e.match(t.IPV4ADDRESS)||[],i=h(n,2)[1];return i?i.split(".").map(H).join("."):e}function Z(e,t){var n=e.match(t.IPV6ADDRESS)||[],i=h(n,3),s=i[1],r=i[2];if(s){for(var o=s.toLowerCase().split("::").reverse(),a=h(o,2),l=a[0],c=a[1],d=c?c.split(":").map(H):[],u=l.split(":").map(H),p=t.IPV4ADDRESS.test(u[u.length-1]),m=p?7:8,f=u.length-m,g=Array(m),v=0;v1){var _=g.slice(0,y.index),x=g.slice(y.index+y.length);b=_.join(":")+"::"+x.join(":")}else b=g.join(":");return r&&(b+="%"+r),b}return e}var W=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,q=void 0==="".match(/(){0}/)[1];function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},i=!1!==t.iri?c:l;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var s=e.match(W);if(s){q?(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5])):(n.scheme=s[1]||void 0,n.userinfo=-1!==e.indexOf("@")?s[3]:void 0,n.host=-1!==e.indexOf("//")?s[4]:void 0,n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=-1!==e.indexOf("?")?s[7]:void 0,n.fragment=-1!==e.indexOf("#")?s[8]:void 0,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?s[4]:void 0)),n.host&&(n.host=Z(G(n.host,i),i)),void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||n.path||void 0!==n.query?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==n.reference&&(n.error=n.error||"URI is not a "+t.reference+" reference.");var r=F[(t.scheme||n.scheme||"").toLowerCase()];if(t.unicodeSupport||r&&r.unicodeSupport)j(n,i);else{if(n.host&&(t.domainHost||r&&r.domainHost))try{n.host=z.toASCII(n.host.replace(i.PCT_ENCODED,$).toLowerCase())}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+e}j(n,l)}r&&r.parse&&r.parse(n,t)}else n.error=n.error||"URI can not be parsed.";return n}function Y(e,t){var n=!1!==t.iri?c:l,i=[];return void 0!==e.userinfo&&(i.push(e.userinfo),i.push("@")),void 0!==e.host&&i.push(Z(G(String(e.host),n),n).replace(n.IPV6ADDRESS,(function(e,t,n){return"["+t+(n?"%25"+n:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(i.push(":"),i.push(String(e.port))),i.length?i.join(""):void 0}var K=/^\.\.?\//,J=/^\/\.(\/|$)/,Q=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(K))e=e.replace(K,"");else if(e.match(J))e=e.replace(J,"/");else if(e.match(Q))e=e.replace(Q,"/"),t.pop();else if("."===e||".."===e)e="";else{var n=e.match(ee);if(!n)throw new Error("Unexpected dot segment condition");var i=n[0];e=e.slice(i.length),t.push(i)}return t.join("")}function ne(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.iri?c:l,i=[],s=F[(t.scheme||e.scheme||"").toLowerCase()];if(s&&s.serialize&&s.serialize(e,t),e.host)if(n.IPV6ADDRESS.test(e.host));else if(t.domainHost||s&&s.domainHost)try{e.host=t.iri?z.toUnicode(e.host):z.toASCII(e.host.replace(n.PCT_ENCODED,$).toLowerCase())}catch(n){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+n}j(e,n),"suffix"!==t.reference&&e.scheme&&(i.push(e.scheme),i.push(":"));var r=Y(e,t);if(void 0!==r&&("suffix"!==t.reference&&i.push("//"),i.push(r),e.path&&"/"!==e.path.charAt(0)&&i.push("/")),void 0!==e.path){var o=e.path;t.absolutePath||s&&s.absolutePath||(o=te(o)),void 0===r&&(o=o.replace(/^\/\//,"/%2F")),i.push(o)}return void 0!==e.query&&(i.push("?"),i.push(e.query)),void 0!==e.fragment&&(i.push("#"),i.push(e.fragment)),i.join("")}function ie(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(e=X(ne(e,n),n),t=X(ne(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=te(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function se(e,t,n){var i=o({scheme:"null"},n);return ne(ie(X(e,i),X(t,i),i,!0),i)}function re(e,t){return"string"==typeof e?e=ne(X(e,t),t):"object"===i(e)&&(e=X(ne(e,t),t)),e}function oe(e,t,n){return"string"==typeof e?e=ne(X(e,n),n):"object"===i(e)&&(e=ne(e,n)),"string"==typeof t?t=ne(X(t,n),n):"object"===i(t)&&(t=ne(t,n)),e===t}function ae(e,t){return e&&e.toString().replace(t&&t.iri?c.ESCAPE:l.ESCAPE,B)}function le(e,t){return e&&e.toString().replace(t&&t.iri?c.PCT_ENCODED:l.PCT_ENCODED,$)}var ce={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var n="https"===String(e.scheme).toLowerCase();return e.port!==(n?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},he={scheme:"https",domainHost:ce.domainHost,parse:ce.parse,serialize:ce.serialize};function de(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var ue={scheme:"ws",domainHost:!0,parse:function(e,t){var n=e;return n.secure=de(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=void 0,n.query=void 0,n},serialize:function(e,t){if(e.port!==(de(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var n=e.resourceName.split("?"),i=h(n,2),s=i[0],r=i[1];e.path=s&&"/"!==s?s:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},pe={scheme:"wss",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize},me={},fe="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ge="[0-9A-Fa-f]",ve=n(n("%[EFef]"+ge+"%"+ge+ge+"%"+ge+ge)+"|"+n("%[89A-Fa-f]"+ge+"%"+ge+ge)+"|"+n("%"+ge+ge)),ye="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),_e="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",xe=new RegExp(fe,"g"),we=new RegExp(ve,"g"),Se=new RegExp(t("[^]",ye,"[\\.]",'[\\"]',be),"g"),Me=new RegExp(t("[^]",fe,_e),"g"),Ee=Me;function Te(e){var t=$(e);return t.match(xe)?t:e}var Ce={scheme:"mailto",parse:function(e,t){var n=e,i=n.to=n.path?n.path.split(","):[];if(n.path=void 0,n.query){for(var s=!1,r={},o=n.query.split("&"),a=0,l=o.length;a{"use strict";n.d(t,{Z:()=>s});const i=function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)},s={text:function(e,t){const n=window.URL.createObjectURL(new Blob([e],{type:"text/plain"}));i(n,t)},json:function(e,t){"object"==typeof e&&(e=JSON.stringify(e));const n=window.URL.createObjectURL(new Blob([e],{type:"text/json"}));i(n,t)},url:function(e,t){i(e,t)}}},56587:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i={json:async function(e,t,n){n&&"string"!=typeof n&&(n=JSON.stringify(n));return fetch(e,{headers:{Accept:"application/json","Content-Type":"application/json"},method:t,credentials:"same-origin",body:n}).then((n=>{if(!n.ok){const i=`fetch.json (${t} at '${e}'), error: ${n.status} - ${n.statusText}`;throw console.warn(i),new Error(i)}return n.json()})).catch((n=>{throw console.warn(`fetch.json (${t} at '${e}'), error: ${n.message}`),n}))},text:async function(e,t,n){return fetch(e,{headers:{Accept:"text/plain","Content-Type":"text/plain"},method:t,credentials:"same-origin",body:n}).then((e=>{if(!e.ok)throw new Error(`status: ${e.status}`);return e.text()})).catch((n=>{throw console.warn(`fetch.text (${t} at '${e}'), error: ${n.message}`),n}))},file:async function(e,t,n,i=!0){const s={method:t,credentials:"include",body:n};return i||(s.headers={"Content-Type":"application/octet-stream"}),fetch(e,s).then((e=>{if(!e.ok)throw new Error(`status: ${e.status}`);return e})).catch((n=>{throw console.warn(`fetch.file (${t} at '${e}'), error: ${n.message}`),n}))},buffer:async function(e,t,n){return fetch(e,{headers:{Accept:"application/octet-stream","Content-Type":"application/octet-stream"},method:t,credentials:"include",body:n}).then((e=>{if(!e.ok)throw new Error(`status: ${e.status}`);return e.arrayBuffer()})).catch((n=>{throw console.warn(`fetch.buffer (${t} at '${e}'), error: ${n.message}`),n}))}}},31741:(e,t,n)=>{"use strict";function i(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");const n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);if(n)return n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):""}n.d(t,{Z:()=>i})},47855:(e,t,n)=>{"use strict";n.d(t,{P:()=>s,ZP:()=>o});var i=n(96368);class s{constructor(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}static makeZeros(){return new s(0,0,0)}static makeOnes(){return new s(1,1,1)}static makeUnitX(){return new s(1,0,0)}static makeUnitY(){return new s(0,1,0)}static makeUnitZ(){return new s(0,0,1)}static makeCopy(e){return new s(e.x,e.y,e.z)}static makeFromScalar(e){return new s(e,e,e)}static makeFromArray(e){return new s(e[0],e[1],e[2])}static toString(e){return`[${e.x}, ${e.y}, ${e.z}]`}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}setFromScalar(e){return this.x=e,this.y=e,this.z=e,this}setFromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}setZeros(){return this.x=0,this.y=0,this.z=0,this}setOnes(){return this.x=1,this.y=1,this.z=1,this}setUnitX(){return this.x=1,this.y=0,this.z=0,this}setUnitY(){return this.x=0,this.y=1,this.z=0,this}setUnitZ(){return this.x=0,this.y=0,this.z=1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}mul(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}div(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}mulScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divScalar(e){return this.x/=e,this.y/=e,this.z/=e,this}translate(e,t,n){return this.x+=e,this.y+=t,this.z+=n,this}rotateX(e){const t=Math.cos(e),n=Math.sin(e),i=this.y,s=this.z;return this.y=t*i-n*s,this.z=n*i+t*s,this}rotateY(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.z;return this.x=t*i+n*s,this.z=-n*i+t*s,this}rotateZ(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.y;return this.x=t*i-n*s,this.y=n*i+t*s,this}scale(e,t,n){return this.x*=e,this.y*=t,this.z*=n,this}invert(){return this.x=1/this.x,this.y=1/this.y,this.z=1/this.z,this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x*=e,this.y*=e,this.z*=e,this}homogenize(){return this.x/=this.z,this.y/=this.z,this.z=1,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){const t=this.y*e.z-this.z*e.y,n=this.z*e.x-this.x*e.z,i=this.x*e.y-this.y*e.x;return this.x=t,this.y=n,this.z=i,this}length(){const e=this.x,t=this.y,n=this.z;return Math.sqrt(e*e+t*t+n*n)}lengthSquared(){const e=this.x,t=this.y,n=this.z;return e*e+t*t+n*n}distanceTo(e){const t=e.x-this.x,n=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+n*n+i*i)}min(){return this.xthis.y?this.x>this.z?this.x:this.z:this.y>this.z?this.y:this.z}isZero(){return 0===this.x&&0===this.y&&0===this.z}clone(){return new s(this.x,this.y,this.z)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e):[this.x,this.y,this.z]}toVector2(e){return e?(e.x=this.x,e.y=this.y,e):new i.Z(this.x,this.y)}toString(){return s.toString(this)}}s.zeros=new s(0,0,0),s.ones=new s(1,1,1),s.unitX=new s(1,0,0),s.unitY=new s(0,1,0),s.unitZ=new s(0,0,1);class r{constructor(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=i||0}static makeZeros(){return new r(0,0,0,0)}static makeOnes(){return new r(1,1,1,1)}static makeUnitX(){return new r(1,0,0,0)}static makeUnitY(){return new r(0,1,0,0)}static makeUnitZ(){return new r(0,0,1,0)}static makeUnitW(){return new r(0,0,0,1)}static makeCopy(e){return new r(e.x,e.y,e.z,e.w)}static makeFromScalar(e){return new r(e,e,e,e)}static makeFromArray(e){return new r(e[0],e[1],e[2],e[3])}static makeFromPosition(e){return new r(e.x,e.y,e.z,1)}static makeFromDirection(e){return new r(e.x,e.y,e.z,0)}static toString(e){return`[${e.x}, ${e.y}, ${e.z}, ${e.w}]`}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=void 0===i?1:i,this}setFromScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setFromArray(e,t=1){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}setPosition(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=1,this}setDirection(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=0,this}setZeros(){return this.x=0,this.y=0,this.z=0,this.w=0,this}setOnes(){return this.x=1,this.y=1,this.z=1,this.w=1,this}setUnitX(){return this.x=1,this.y=0,this.z=0,this.w=0,this}setUnitY(){return this.x=0,this.y=1,this.z=0,this.w=0,this}setUnitZ(){return this.x=0,this.y=0,this.z=1,this.w=0,this}setUnitW(){return this.x=0,this.y=0,this.z=0,this.w=1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}mul(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}div(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}homogenize(){return this.x/=this.w,this.y/=this.w,this.z/=this.w,this.w=1,this}project(e){const t=this.dot(e)/this.lengthSquared();return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}length(){const e=this.x,t=this.y,n=this.z,i=this.w;return Math.sqrt(e*e+t*t+n*n+i*i)}lengthSquared(){const e=this.x,t=this.y,n=this.z,i=this.w;return e*e+t*t+n*n+i*i}isZero(){return 0===this.x&&0===this.y&&0===this.z&&0===this.w}clone(){return new r(this.x,this.y,this.z,this.w)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e):[this.x,this.y,this.z,this.w]}toVector3(e){return e?(e.x=this.x,e.y=this.y,e.z=this.z,e):new s(this.x,this.y,this.z)}toString(){return r.toString(this)}}r.zeros=new r(0,0,0,0),r.ones=new r(1,1,1,1),r.unitX=new r(1,0,0,0),r.unitY=new r(0,1,0,0),r.unitZ=new r(0,0,1,0),r.unitW=new r(0,0,0,1);class o{constructor(e=0,t=0,n=0,i=1){e instanceof o?(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):Array.isArray(e)?(this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0,this.w=void 0!==e[3]?e[3]:1):"string"==typeof e?this.setString(e):(this.x=e,this.y=t,this.z=n,this.w=i)}static fromString(e){return(new o).setString(e)}static fromArray(e){return new o(e)}get r(){return this.x}get g(){return this.y}get b(){return this.z}get a(){return this.w}set r(e){this.x=e}set g(e){this.y=e}set b(e){this.z=e}set a(e){this.w=e}get red(){return this.x}get green(){return this.y}get blue(){return this.z}get alpha(){return this.w}set red(e){this.x=e}set green(e){this.y=e}set blue(e){this.z=e}set alpha(e){this.w=e}get redByte(){return Math.floor(255*this.x)}get greenByte(){return Math.floor(255*this.y)}get blueByte(){return Math.floor(255*this.z)}get alphaByte(){return Math.floor(255*this.w)}set redByte(e){this.x=e/255}set greenByte(e){this.y=e/255}set blueByte(e){this.z=e/255}set alphaByte(e){this.w=e/255}inverseMultiply(e){return this.x=this.x*(1-e)+e,this.y=this.y*(1-e)+e,this.z=this.z*(1-e)+e,this}multiply(e){return this.x*=e,this.y*=e,this.z*=e,this}copy(e){this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w}clone(){return new o(this.x,this.y,this.z,this.w)}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=void 0===i?1:i,this}setBytes(e,t,n,i){return this.x=e/255,this.y=t/255,this.z=n/255,this.w=void 0===i?1:i/255,this}setUInt24RGB(e){return this.x=e>>16&255,this.y=e>>8&255,this.z=255&e,this.w=1,this}setUInt32RGBA(e){return this.x=e>>24&255,this.y=e>>16&255,this.z=e>>8&255,this.w=255&e,this.w=1,this}setRed(e){return this.x=e,this}setGreen(e){return this.y=e,this}setBlue(e){return this.z=e,this}setAlpha(e){return this.w=e,this}setRedByte(e){return this.x=e/255,this}setGreenByte(e){return this.y=e/255,this}setBlueByte(e){return this.z=e/255,this}setAlphaByte(e){return this.w=e/255,this}setHSV(e,t=1,n=1,i){"object"==typeof e&&(t=e.y,n=e.z,i=void 0!==e.w?e.w:i,e=e.x);const s=Math.floor(e/60),r=e/60-s,o=n*(1-t),a=n*(1-r*t),l=n*(1-(1-r)*t);let c,h,d;switch(s%6){case 0:c=n,h=l,d=o;break;case 1:c=a,h=n,d=o;break;case 2:c=o,h=n,d=l;break;case 3:c=o,h=a,d=n;break;case 4:c=l,h=o,d=n;break;case 5:c=n,h=o,d=a}return this.x=c,this.y=h,this.z=d,void 0!==i&&(this.w=i),this}setHSL(e,t=1,n=1,i){if("object"==typeof e&&(t=e.y,n=e.z,i=void 0!==e.w?e.w:i,e=e.x),0===t)this.x=this.y=this.z=n;else{function o(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}e/=360;var s=n<.5?n*(1+t):n+t-n*t,r=2*n-s;this.x=o(r,s,e+1/3),this.y=o(r,s,e),this.z=o(r,s,e-1/3)}return void 0!==i&&(this.w=i),this}fromArray(e){this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0,this.w=void 0!==e[3]?e[3]:1}setString(e,t=1,n=!0){e=e.trim().toLowerCase();let i=(e=o.presets[e]||e).match(/^#?([0-9a-f]{3})$/i);if(i){const e=i[1],n=1/15;return this.x=Number.parseInt(e.charAt(0),16)*n,this.y=Number.parseInt(e.charAt(1),16)*n,this.z=Number.parseInt(e.charAt(2),16)*n,this.w=t,this}if(i=e.match(/^#?([0-9a-f]{6})$/i),i){const e=i[1],n=1/255;return this.x=Number.parseInt(e.substr(0,2),16)*n,this.y=Number.parseInt(e.substr(2,2),16)*n,this.z=Number.parseInt(e.substr(4,2),16)*n,this.w=t,this}if(0===e.indexOf("rgb")){let n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n){const e=1/255;return this.x=Number.parseInt(n[1])*e,this.y=Number.parseInt(n[2])*e,this.z=Number.parseInt(n[3])*e,this.w=t,this}if(n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+.*\d*)\s*\)$/i),n){const e=1/255;return this.x=Number.parseInt(n[1])*e,this.y=Number.parseInt(n[2])*e,this.z=Number.parseInt(n[3])*e,this.w=Number.parseFloat(n[4]),this}}if(0===e.indexOf("hsl")){let n=e.match(/(\d+(\.\d+)?)/g);return n&&this.setHSL(Number.parseFloat(n[0]),.01*Number.parseFloat(n[1]),.01*Number.parseFloat(n[2]),void 0!==n[3]?Number.parseFloat(n[3]):t),this}if(n)throw new RangeError("failed to parse color from string: "+e);return this}toUInt24RGB(){return Math.floor(255*this.x)<<16+Math.floor(255*this.y)<<8+Math.floor(255*this.z)}toUInt32RGBA(){return Math.floor(255*this.x)<<24+Math.floor(255*this.y)<<16+Math.floor(255*this.z)<<8+Math.floor(255*this.w)}toVector3(e){return e?(e.x=this.r,e.y=this.g,e.z=this.b,e):new s(this.r,this.g,this.b)}toVector4(e){return e?(e.x=this.r,e.y=this.g,e.z=this.b,e.w=this.a,e):new r(this.r,this.g,this.b,this.a)}toHSV(e){let t=this.x,n=this.y,i=this.z,r=Math.min(t,n,i),o=Math.max(t,n,i),a=o-r,l=0,c=0===o?0:a/o,h=o;return 0!==a&&(l=60*(t===o?(n-i)/a+(n.5?a/(2-o-r):a/(o+r),l=60*(t===o?(n-i)/a+(n{"use strict";n.d(t,{Z:()=>r});var i=n(82942);class s{constructor(e,t){this._args=e,this._props=t,this._args=e,this._state=null}get name(){return this._props.name||this._props.do.name.replace(/([A-Z])/g," $1").replace(/^./,(e=>e.toUpperCase()))}do(){if(this._state)throw new Error("undo should be called before execute can be applied again");this._state=this._props.do.apply(this._props.target,this._args)}undo(){if(!this._props.undo)throw new Error("can't undo this command");if(!this._state)throw new Error("execute should be called before undo can be applied");this._props.undo.call(this._props.target,this._state),this._state=null}canDo(){return!this._props.canDo||this._props.canDo()}canUndo(){return!!this._props.undo}}class r extends i.Z{constructor(e){super(),this.addEvent("update"),this.stack=[],this.pointer=-1,this.capacity=void 0!==e?e:r.defaultCapacity}register(e){let t;t="function"==typeof e?e:t=>new s(t,e);return(...e)=>{const n=t(e);this.do(n)}}setCapacity(e){for(this.capacity=e;this.stack.length>e;)this.stack.shift(),this.pointer--;this.pointer<0&&(this.stack=[],this.pointer=-1)}do(e){console.log(`Commander.do - '${e.name}'`),e.do(),e.canUndo()&&(this.stack.splice(this.pointer+1),this.stack.push(e),this.stack.length>this.capacity&&this.stack.shift(),this.pointer=this.stack.length-1,this.emit("update"))}undo(){if(this.pointer>=0){this.stack[this.pointer].undo(),this.pointer--,this.emit("update")}}redo(){if(this.pointer0&&(this.stack=[],this.pointer=-1,this.emit("update"))}canUndo(){return this.pointer>=0}canRedo(){return this.pointer=0?"Undo "+this.stack[this.pointer].name:"Can't Undo"}getRedoText(){return this.pointer{"use strict";n.d(t,{Z:()=>r});var i=n(82942),s=n(84292);class r extends i.Z{constructor(e){super(),this.addEvents("update","dispose"),e?this.fromJSON(e):this._data=this.init()}static generateId(){return(0,s.Z)()}get id(){return this._data.id}get data(){return this._data}set(e,t){this._data[e]=t,this.update()}get(e){return this._data[e]}update(){this.emit({type:"update",document:this})}dispose(){this.emit({type:"dispose",document:this}),this._data=null}fromJSON(e){return this._data={},this.inflate(e,this._data),this.update(),this}toJSON(e){return e=e||{},this.deflate(this._data,e),e}init(){return{}}inflate(e,t){Object.assign(t,e)}deflate(e,t){t=t||{},Object.assign(t,this._data)}}},97444:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(82942);const s=[];class r extends i.Z{constructor(e){super({knownEvents:!1});const t=e.typeName;if(!t)throw new Error("root type must have a 'typeName' member");this._rootTypeName=t,this._objLists={[this._rootTypeName]:[]},this._objTags={},this._objDict={}}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e}add(e){const t=e.id;if("string"==typeof t){if(void 0!==this._objDict[t])throw new Error("object already registered");this._objDict[t]=e}let n,i=e;const s=this._rootTypeName,r={type:"",add:!0,remove:!1,object:e};do{i=Object.getPrototypeOf(i),n=i.constructor.typeName,n&&((this._objLists[n]||(this._objLists[n]=[])).push(e),r.type=n,this.emit(r))}while(n!==s)}remove(e){const t=e.id;if("string"==typeof t){if(this._objDict[t]!==e)throw new Error("object not registered");delete this._objDict[t]}let n,i=e;const s=this._rootTypeName,r={type:"",add:!1,remove:!0,object:e};do{if(i=Object.getPrototypeOf(i),n=i.constructor.typeName,n){r.type=n;const t=this._objLists[n];t.splice(t.indexOf(e),1),this.emit(r)}}while(n!==s)}addByTag(e,t){if(!e||"tag"===e)throw new Error("illegal tag name");(this._objTags[e]||(this._objTags[e]=[])).push(t);const n={type:"tag",add:!0,remove:!1,object:t,tag:e};this.emit(n),n.type=e,this.emit(n)}removeByTag(e,t){if(!e||"tag"===e)throw new Error("illegal tag name");const n=this._objTags[e];if(n){const i=n.indexOf(t);if(i>=0){const s={type:"tag",add:!1,remove:!0,object:t,tag:e};return this.emit(s),s.type=e,this.emit(s),n.splice(i,1),!0}}return!1}clear(){this.cloneArray().forEach((e=>this.remove(e)))}get length(){return this._objLists[this._rootTypeName].length}count(e){const t=this._objLists[this.getTypeName(e)];return t?t.length:0}has(e){if("function"==typeof e){const t=this._objLists[e.typeName];return!!t&&t.length>0}if("string"==typeof e){const t=this._objLists[e];return!!t&&t.length>0}const t=this._objLists[e.constructor.typeName];return t&&t.indexOf(e)>=0}contains(e){const t=e.id;if("string"==typeof t)return!!this._objDict[t];const n=this._objLists[e.constructor.typeName];return n&&n.indexOf(e)>=0}get(e,t=!1){const n=this.getTypeName(e),i=this._objLists[n],s=i?i[0]:void 0;if(!t&&!s)throw new Error(`no instances of class '${n}' in object registry`);return s}getArray(e){return this._objLists[this.getTypeName(e)]||s}cloneArray(e){return this.getArray(e).slice()}getById(e){return this._objDict[e]}getDictionary(){return this._objDict}getByTag(e){return this._objTags[e]||s}on(e,t,n){super.on(this.getTypeName(e),t,n)}once(e,t,n){super.once(this.getTypeName(e),t,n)}off(e,t,n){super.off(this.getTypeName(e),t,n)}getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||this._rootTypeName}}},82942:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const i=Symbol("Publisher private data"),s=Symbol("Publisher strict option");class r{constructor(e){const t=!e||e.knownEvents;this[i]={[s]:t}}on(e,t,n){if(Array.isArray(e))return void e.forEach((e=>{this.on(e,t,n)}));if(!t)throw new Error("missing callback function");let r=this[i][e];if(!r){if(this[i][s])throw new Error(`can't subscribe; unknown event: '${e}'`);r=this[i][e]=[]}let o={callback:t,context:n};r.push(o)}addEventListener(e,t,n){this.on(e,t,n)}once(e,t,n){if(Array.isArray(e))return void e.forEach((e=>{this.once(e,t,n)}));const i=s=>{this.off(e,i,n),t.call(n,s)};i.cb=t,this.on(e,i,n)}off(e,t,n){if("object"==typeof e){if(Array.isArray(e))e.forEach((e=>{this.off(e,t,n)}));else{const t=this[i];for(let n=0,i=Object.keys(t).length;n{this[i][e]||(this[i][e]=[])}))}hasEvent(e){return!!this[i][e]}listEvents(){return Object.getOwnPropertyNames(this[i])}}},25976:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});class i{constructor(e,t,n){this._type=e,this._callback=t,this._context=n,this._publishers=[]}on(...e){return e.forEach((e=>{this._publishers.push(e),e.on(this._type,this._callback,this._context)})),this}off(){return this._publishers.forEach((e=>e.off(this._type,this._callback,this._context))),this._publishers.length=0,this}}},26041:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(82942);class s extends i.Z{constructor(){super(),this._dict={},this.addEvent("type")}add(e){if(Array.isArray(e))return void e.forEach((e=>this.add(e)));const t=e.typeName;if(!t)throw new Error("type must have a 'typeName' member");if(this._dict[t])throw new Error(`type '${t}' already registered`);this._dict[t]=e,this.emit({type:"type",add:!0,remove:!1,classType:e})}remove(e){if(Array.isArray(e))return void e.forEach((e=>this.remove(e)));const t=e.typeName;if(!t)throw new Error("type must have a 'typeName' member");if(!this._dict[t])throw new Error(`type '${t}' not registered`);delete this._dict[t],this.emit({type:"type",add:!1,remove:!0,classType:e})}getType(e){let t=e;return"function"==typeof e?t=e.typeName:"object"==typeof e&&(t=e.constructor.typeName),this._dict[t]}createInstance(e,...t){const n=this.getType(e);if(!n)throw new Error(`type '${e}' not registered`);return new n(...t)}}},96368:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});class i{constructor(e,t){this.x=e||0,this.y=t||0}static makeZeros(){return new i(0,0)}static makeOnes(){return new i(1,1)}static makeUnitX(){return new i(1,0)}static makeUnitY(){return new i(0,1)}static makeCopy(e){return new i(e.x,e.y)}static makeFromScalar(e){return new i(e,e)}static makeFromArray(e){return new i(e[0],e[1])}static toString(e){return`[${e.x}, ${e.y}]`}copy(e){return this.x=e.x,this.y=e.y,this}set(e,t){return this.x=e,this.y=t,this}setFromScalar(e){return this.x=e,this.y=e,this}setFromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}setZeros(){return this.x=0,this.y=0,this}setOnes(){return this.x=1,this.y=1,this}setUnitX(){return this.x=1,this.y=0,this}setUnitY(){return this.x=0,this.y=1,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}mul(e){return this.x*=e.x,this.y*=e.y,this}div(e){return this.x/=e.x,this.y/=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}subScalar(e){return this.x-=e,this.y-=e,this}mulScalar(e){return this.x*=e,this.y*=e,this}divScalar(e){return this.x/=e,this.y/=e,this}translate(e,t){return this.x+=e,this.y+=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.x,s=this.y;return this.x=t*i-n*s,this.y=n*i+t*s,this}scale(e,t){return this.x*=e,this.y*=t,this}invert(){return this.x=1/this.x,this.y=1/this.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){const e=1/Math.sqrt(this.x*this.x+this.y*this.y);return this.x*=e,this.y*=e,this}dot(e){return this.x*e.x+this.y*e.y}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}lengthSquared(){const e=this.x,t=this.y;return e*e+t*t}distanceTo(e){const t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)}angle(){return Math.atan2(this.y,this.x)}angleTo(e){const t=this.x,n=this.y,i=e.x,s=e.y;return Math.acos((t*i+n*s)/(Math.sqrt(t*t+n*n)+Math.sqrt(i*i+s*s)))}min(){return this.xthis.y?this.x:this.y}isZero(){return 0===this.x&&0===this.y}clone(){return new i(this.x,this.y)}toArray(e,t){return e?(void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e):[this.x,this.y]}toString(){return i.toString(this)}}i.zeros=new i(0,0),i.ones=new i(1,1),i.unitX=new i(1,0),i.unitY=new i(0,1)},28581:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});const i={PI:3.141592653589793,DOUBLE_PI:6.283185307179586,HALF_PI:1.5707963267948966,QUARTER_PI:.7853981633974483,DEG2RAD:.017453292519943295,RAD2DEG:57.29577951308232,limit:(e,t,n)=>en?n:e,limitInt:function(e,t,n){return(e=Math.trunc(e))n?n:e},normalize:(e,t,n)=>(e-t)/(n-t),normalizeLimit:(e,t,n)=>(e=(e-t)/(n-t))<0?0:e>1?1:e,denormalize:(e,t,n)=>(t+e)*(n-t),scale:(e,t,n,i,s)=>i+(e-t)/(n-t)*(s-i),scaleLimit:(e,t,n,i,s)=>i+((e=en?n:e)-t)/(n-t)*(s-i),deg2rad:function(e){return.017453292519943295*e},rad2deg:function(e){return 57.29577951308232*e},deltaRadians:function(e,t){return e=(e%=i.DOUBLE_PI)<0?e+i.DOUBLE_PI:e,(t=(t%=i.DOUBLE_PI)<0?t+i.DOUBLE_PI:t)-e>i.PI&&(e+=i.DOUBLE_PI),t-e},deltaDegrees:function(e,t){return e=(e%=i.DOUBLE_PI)<0?e+i.DOUBLE_PI:e,(t=(t%=i.DOUBLE_PI)<0?t+i.DOUBLE_PI:t)-e>i.PI&&(e+=i.DOUBLE_PI),t-e},curves:{linear:e=>e,easeIn:e=>Math.sin(e*i.HALF_PI),easeOut:e=>Math.cos(e*i.HALF_PI-i.PI)+1,ease:e=>.5*Math.cos(e*i.PI-i.PI)+.5,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e}},s=i},82507:(e,t,n)=>{"use strict";n.d(t,{q:()=>i});const i=function(e){return Object.keys(e).filter((e=>isNaN(Number(e))))}},84292:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});function i(e,t){let n;e&&"number"==typeof e||(e=12);do{n="";for(let t=0;t{"use strict";n.d(t,{ZP:()=>c,V5:()=>s.V5});var i=n(82942),s=n(31181),r=n(84292);class o extends i.Z{constructor(e){super(),this.addEvent("property"),this.linkable=e,this.properties=[]}get customProperties(){return this.properties.filter((e=>e.custom))}dispose(){this.unlinkAllProperties()}isInputGroup(){return this===this.linkable.ins}isOutputGroup(){return this===this.linkable.outs}createProperties(e,t){return Object.keys(e).forEach(((n,i)=>{const s=void 0===t?void 0:t+i,r=e[n];this.createProperty(r.path,r.schema,n,s)})),this}createProperty(e,t,n,i){const r=new s.ZP(e,t);return this.addProperty(r,n,i),r}createCustomProperty(e,t,n){const i=new s.ZP(e,t,!0);return this.addCustomProperty(i,n),i}addCustomProperty(e,t){const n=(0,r.Z)(5);this.addProperty(e,n,t)}addProperty(e,t,n){if(e.group)throw new Error("can't add, property already part of a group");if(this[t])throw new Error(`key '${t}' already exists in group`);e._group=this,e._key=t,void 0===n?this.properties.push(e):this.properties.splice(n,0,e),this[t]=e,this.emit({type:"property",add:!0,remove:!1,property:e})}removeProperty(e){if(e.group!==this)throw new Error("can't remove, property not in this group");if(e.hasLinks())throw new Error("can't remove, property has links");if(this[e.key]!==e)throw new Error(`property key '${e.key}' not found in group`);this.properties.slice(this.properties.indexOf(e),1),delete this[e.key],e._group=null,e._key="",this.emit({type:"property",add:!1,remove:!0,property:e})}getProperty(e){const t=this[e];if(!t)throw new Error(`no property found with key '${e}'`);return t}getKeys(e=!1){const t=[];return this.properties.forEach((n=>{(e||"object"!==n.type)&&t.push(n.key)})),t}getValues(e=!1){const t=[];return this.properties.map((n=>{(e||"object"!==n.type)&&t.push(n.value)})),t}cloneValues(e=!1){const t=[];return this.properties.map((n=>{(e||"object"!==n.type)&&t.push(n.cloneValue())})),t}setValues(e){Object.keys(e).forEach((t=>this.getProperty(t).value=e[t]))}copyValues(e){Object.keys(e).forEach((t=>this.getProperty(t).copyValue(e[t])))}unlinkAllProperties(){this.properties.forEach((e=>e.unlink()))}toJSON(){let e=null;return this.properties.forEach((t=>{const n=t.toJSON();n&&(e=e||{},e[t.key]=n)})),e}fromJSON(e){Object.keys(e).forEach((t=>{const n=e[t];if(n.schema){const e=new s.ZP(n.path,n.schema,!0);this.addProperty(e,t)}}))}linksFromJSON(e,t){Object.keys(e).forEach((n=>{this[n].fromJSON(e[n],t)}))}}var a=n(52226);class l{constructor(e,t){this._typeName=t?c.getTypeName(t):null,this._id=t instanceof c?t.id:void 0,this._system=e}get component(){return this._id&&this._system.components.getById(this._id)||null}set component(e){if(e&&this._typeName&&!(e instanceof this._system.registry.getType(this._typeName)))throw new Error(`can't assign component of class '${e.constructor.name||"unknown"}' to link of class '${this._typeName}'`);this._id=e?e.id:void 0}}n(90199);class c extends i.Z{constructor(e,t){super({knownEvents:!1}),this.ins=new o(this),this.outs=new o(this),this.changed=!0,this.updated=!1,this._name="",this._tags=new Set,this._trackers=[],this.node=e,this.id=t}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||c.typeName}create(){this.node._addComponent(this),this.graph.isActive&&this.activate&&this.activate()}dispose(){this.graph.isActive&&this.deactivate&&this.deactivate(),this.emit({type:"dispose",component:this}),this.ins.dispose(),this.outs.dispose(),this._trackers.forEach((e=>e.dispose())),this.node&&(this.node._removeComponent(this),this.node=null)}get isNodeSingleton(){return this.constructor.isNodeSingleton}get isGraphSingleton(){return this.constructor.isGraphSingleton}get isSystemSingleton(){return this.constructor.isSystemSingleton}get typeName(){return this.constructor.typeName}get displayTypeName(){const e=this.typeName;return"Component"===e?e:e.substr(1)}get text(){return this.constructor.text}get icon(){return this.constructor.icon}get name(){return this._name}get displayName(){return this._name||this.text||this.displayTypeName}set name(e){this._name=e,this.emit({type:"change",component:this,what:"name"})}get tags(){return this._tags}addTag(e){this._tags.has(e)||(this._tags.add(e),this.node._addComponentTag(e,this))}removeTag(e){this._tags.has(e)&&(this._tags.delete(e),this.node._removeComponentTag(e,this))}get graph(){return this.node.graph}get system(){return this.node.system}get components(){return this.node.components}get isActive(){return this.graph.isActive}getComponent(e,t=!1){return this.node.components.get(e,t)}getComponents(e){return this.node.components.getArray(e)}getComponentsByTag(e){return this.node.components.getByTag(e)}createComponent(e){return this.node.createComponent(e)}getOrCreateComponent(e){return this.node.components.get(e,!0)||this.node.createComponent(e)}hasComponent(e){return this.node.components.has(e)}getGraphComponent(e,t=!1){return this.node.graph.components.get(e,t)}getGraphComponents(e){return this.node.graph.components.getArray(e)}getGraphComponentsByTag(e){return this.node.graph.components.getByTag(e)}hasGraphComponent(e){return this.node.graph.components.has(e)}getMainComponent(e,t=!1){return this.node.system.graph.components.get(e,t)}getMainComponents(e){return this.node.system.graph.components.getArray(e)}getMainComponentsByTag(e){return this.node.system.graph.components.getByTag(e)}hasMainComponent(e){return this.node.system.graph.components.has(e)}getSystemComponent(e,t=!1){return this.node.system.components.get(e,t)}getSystemComponents(e){return this.node.system.components.getArray(e)}getSystemComponentsByTag(e){return this.node.system.components.getByTag(e)}hasSystemComponent(e){return this.node.system.components.has(e)}getComponentById(e){return this.node.system.components.getById(e)}getNode(e,t=!1){return this.node.graph.nodes.get(e,t)}getNodes(e){return this.node.graph.nodes.getArray(e)}getNodesByTag(e){return this.node.graph.nodes.getByTag(e)}hasNode(e){return this.node.graph.nodes.has(e)}getMainNode(e,t=!1){return this.node.system.graph.nodes.get(e,t)}getMainNodes(e){return this.node.system.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.node.system.graph.nodes.getByTag(e)}hasMainNode(e){return this.node.system.graph.nodes.has(e)}getSystemNode(e,t=!1){return this.node.system.nodes.get(e,t)}getSystemNodes(e){return this.node.system.nodes.getArray(e)}getSystemNodesByTag(e){return this.node.system.nodes.getByTag(e)}hasSystemNode(e){return this.node.system.nodes.has(e)}getNodeById(e){return this.node.system.nodes.getById(e)}activate(){}update(e){throw new Error("this should never be called")}tick(e){throw new Error("this should never be called")}tock(e){throw new Error("this should never be called")}deactivate(){}requestSort(){this.graph.requestSort()}is(e){const t=c.getTypeName(e);let n=this;do{if(n=Object.getPrototypeOf(n),n.constructor.typeName===t)return!0}while(n.constructor.typeName!==c.typeName);return!1}unlinkAllProperties(){this.ins.unlinkAllProperties(),this.outs.unlinkAllProperties()}resetChanged(){this.changed=!1;const e=this.ins.properties;for(let t=0,n=e.length;tt.dump(e+" IN "))),this.outs.properties.forEach((t=>t.dump(e+" OUT ")))}toJSON(){let e={};const t=this.ins.toJSON();t&&(e.ins=t);const n=this.outs.toJSON();return n&&(e.outs=n),e}fromJSON(e){e.ins&&this.ins.fromJSON(e.ins),e.outs&&this.outs.fromJSON(e.outs)}referencesFromJSON(e){const t=this.system.components.getDictionary();e.ins&&this.ins.linksFromJSON(e.ins,t),e.outs&&this.outs.linksFromJSON(e.outs,t)}addCustomInput(e,t,n){return this.changed=!0,this.ins.createCustomProperty(e,t,n)}allowCustomInput(e){return!1}addCustomOutput(e,t,n){return this.outs.createCustomProperty(e,t,n)}allowCustomOutput(e){return!1}addInputs(e,t){return this.ins.createProperties(e,t)}addOutputs(e,t){return this.outs.createProperties(e,t)}}c.typeName="Component",c.text="",c.icon="",c.isNodeSingleton=!0,c.isGraphSingleton=!1,c.isSystemSingleton=!1,c.prototype.activate=null,c.prototype.update=null,c.prototype.tick=null,c.prototype.tock=null,c.prototype.deactivate=null},52226:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(80038);class s{constructor(e,t,n,s){this.typeName=i.ZP.getTypeName(t),this.didAdd=n,this.willRemove=s,this._registry=e,e.on(this.typeName,this.onComponent,this),this.component=e.get(t,!0),this.component&&n&&n(this.component)}dispose(){this._registry.off(this.typeName,this.onComponent,this),this.component=null,this.didAdd=null,this.willRemove=null}onComponent(e){e.add?(this.component=e.object,this.didAdd&&this.didAdd(e.object)):e.remove&&(this.willRemove&&this.willRemove(e.object),this.component=null)}}},83275:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var i=n(84292),s=n(82942);class r{constructor(){this.visited={},this.visiting={},this.sorted=[]}sort(e){for(let t=0,n=e.length;t0)throw new Error("graph not empty")}requestSort(){this._sortRequested=!0}sort(){this._sortedList=this._sorter.sort(this.components.getArray());this.parent&&(this.parent.name||this.parent.typeName)}createCustomNode(e,t,n){const s=this.system.registry.getType(e);if(!s)throw new Error(`node type '${a.Z.getTypeName(e)}' not registered`);const r=new s(this,n||(0,i.Z)(12,this.system.nodes.getDictionary()));return r.create(),t&&(r.name=t),n||(r.createComponents(),r.unlock()),r}createNode(e,t){const n=new a.Z(this,t||(0,i.Z)(12,this.system.nodes.getDictionary()));return n.create(),e&&(n.name=e),n.unlock(),n}findNodeByName(e,t){const n=this.nodes.getArray(t);for(let t=0,i=n.length;te.toString(!0))).join("\n"):i}dump(e=""){console.log(e+"%cGraph","color: red");this.findRootNodes().forEach((t=>t.dump(e+" ")))}toJSON(){const e={},t=[],n=this.nodes.getArray();for(let e=0,i=n.length;e0&&(e.nodes=t),e}fromJSON(e){e.nodes&&(e.nodes.forEach((e=>{this.createCustomNode(e.type,e.name,e.id).fromJSON(e)})),e.nodes.forEach((e=>{this.nodes.getById(e.id).referencesFromJSON(e)})))}nodeToJSON(e){return e.toJSON()}_addNode(e){this.nodes.add(e),this.system._addNode(e)}_removeNode(e){this.system._removeNode(e),this.nodes.remove(e)}_addNodeTag(e,t){this.nodes.addByTag(e,t),this.system._addNodeTag(e,t)}_removeNodeTag(e,t){this.system._removeNodeTag(e,t),this.nodes.removeByTag(e,t)}_addComponent(e){if(e.isGraphSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per graph`);this.components.add(e),this.system._addComponent(e),e.tock&&this._tockList.push(e),this._sortRequested=!0}_removeComponent(e){this.system._removeComponent(e),this.components.remove(e),e.tock&&this._tockList.splice(this._tockList.indexOf(e),1),this._sortRequested=!0}_addComponentTag(e,t){this.components.addByTag(e,t),this.system._addComponentTag(e,t)}_removeComponentTag(e,t){this.system._removeComponentTag(e,t),this.components.removeByTag(e,t)}_addRoot(e){this.roots.push(e),this.parent&&this.parent.onAddInnerRoot(e)}_removeRoot(e){this.parent&&this.parent.onRemoveInnerRoot(e),this.roots.splice(this.roots.indexOf(e),1)}}},90199:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(84292),s=n(82942),r=n(97444),o=n(80038);class a extends s.Z{constructor(e,t){super({knownEvents:!1}),this.graph=null,this.components=new r.Z(o.ZP),this._name="",this._tags=new Set,this._isLocked=void 0,this.graph=e,this.id=t}static getTypeName(e){return"function"==typeof e?e.typeName:"object"==typeof e?e.constructor.typeName:e||a.typeName}get typeName(){return this.constructor.typeName}get displayTypeName(){const e=this.typeName;return"Node"===e?e:e.substr(1)}get isLocked(){return this._isLocked}get text(){return this.constructor.text}get icon(){return this.constructor.icon}get name(){return this._name}get displayName(){return this._name||this.text||this.displayTypeName}set name(e){this._name=e,this.emit({type:"change",what:"name",node:this})}get tags(){return this._tags}addTag(e){this._tags.has(e)||(this._tags.add(e),this.graph._addNodeTag(e,this))}removeTag(e){this._tags.has(e)&&(this._tags.delete(e),this.graph._removeNodeTag(e,this))}get system(){return this.graph.system}getComponent(e,t=!1){return this.components.get(e,t)}getComponents(e){return this.components.getArray(e)}getComponentsByTag(e){return this.components.getByTag(e)}getOrCreateComponent(e){return this.components.get(e,!0)||this.createComponent(e)}hasComponent(e){return this.components.has(e)}getGraphComponent(e,t=!1){return this.graph.components.get(e,t)}getGraphComponents(e){return this.graph.components.getArray(e)}getGraphComponentsByTag(e){return this.graph.components.getByTag(e)}hasGraphComponent(e){return this.graph.components.has(e)}getMainComponent(e,t=!1){return this.graph.system.graph.components.get(e,t)}getMainComponents(e){return this.graph.system.graph.components.getArray(e)}getMainComponentsByTag(e){return this.graph.system.graph.components.getByTag(e)}hasMainComponent(e){return this.graph.system.graph.components.has(e)}getSystemComponent(e,t=!1){return this.graph.system.components.get(e,t)}getSystemComponents(e){return this.graph.system.components.getArray(e)}getSystemComponentsByTag(e){return this.graph.system.components.getByTag(e)}hasSystemComponent(e){return this.graph.system.components.has(e)}getComponentById(e){return this.graph.system.components.getById(e)}getNode(e,t=!1){return this.graph.nodes.get(e,t)}getNodes(e){return this.graph.nodes.getArray(e)}getNodesByTag(e){return this.graph.nodes.getByTag(e)}hasNode(e){return this.graph.nodes.has(e)}getMainNode(e,t=!1){return this.graph.system.graph.nodes.get(e,t)}getMainNodes(e){return this.graph.system.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.graph.system.graph.nodes.getByTag(e)}hasMainNode(e){return this.graph.system.graph.nodes.has(e)}getSystemNode(e,t=!1){return this.graph.system.nodes.get(e,t)}getSystemNodes(e){return this.graph.system.nodes.getArray(e)}getSystemNodesByTag(e){return this.graph.system.nodes.getByTag(e)}hasSystemNode(e){return this.graph.system.nodes.has(e)}getNodeById(e){return this.graph.system.nodes.getById(e)}lock(){if(!1===this._isLocked)throw new Error("can't lock an unlocked node again");this._isLocked=!0}unlock(){this._isLocked=!1}create(){this.graph._addNode(this)}createComponents(){}clear(){this.components.getArray().slice().forEach((e=>e.dispose()))}dispose(){this.components.cloneArray().reverse().forEach((e=>e.dispose())),this.emit({type:"dispose",node:this}),this.graph&&(this.graph._removeNode(this),this.graph=null)}createComponent(e,t,n){if(!0===this._isLocked)throw new Error("node is locked, can't create component");const s=this.system.registry.getType(e);if(!s)throw new Error(`component type '${o.ZP.getTypeName(e)}' not registered`);const r=new s(this,n||(0,i.Z)(12,this.system.components.getDictionary()));return r.create(),t&&(r.name=t),r}is(e){const t=a.getTypeName(e);let n=this;do{if(n=Object.getPrototypeOf(n),n.constructor.typeName===t)return!0}while(n.constructor.typeName!==a.typeName);return!1}toString(e=!1){const t=this.components.getArray(),n=`Node '${this.name}' - ${t.length} components`;return e?n+"\n"+t.map((e=>" "+e.toString())).join("\n"):n}dump(e=""){console.log(e+`%cNode '${this.typeName}' (${this.displayName})`,"color: blue"),this.components.getArray().forEach((t=>t.dump(e+" ")))}toJSON(){const e={},t=[];this._isLocked&&(e.locked=!0);const n=this.components.getArray();for(let e=0,i=n.length;e0&&(e.components=t),e}fromJSON(e){this._isLocked=!!e.locked,e.components&&e.components.forEach((e=>this.componentFromJSON(e)))}componentFromJSON(e){this.createComponent(e.type,e.name,e.id).fromJSON(e)}referencesFromJSON(e){e.components&&e.components.forEach((e=>{this.components.getById(e.id).referencesFromJSON(e)}))}componentToJSON(e){return e.toJSON()}_addComponent(e){if(e.isNodeSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per node`);this.components.add(e),this.graph._addComponent(e)}_removeComponent(e){this.graph._removeComponent(e),this.components.remove(e)}_addComponentTag(e,t){this.components.addByTag(e,t),this.graph._addComponentTag(e,t)}_removeComponentTag(e,t){this.graph._removeComponentTag(e,t),this.components.removeByTag(e,t)}}a.typeName="Node",a.text="",a.icon=""},31181:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p,V5:()=>u.V5});var i=n(82942);const s=[function(e){return e},function(e,t){for(let n=0,i=t.length;n=0)throw new Error("non-array source property; can't link to element");if(1===t.elementCount&&i>=0)throw new Error("non-array destination property; can't link to element");this.source=e,this.destination=t,this.sourceIndex=n,this.destinationIndex=i;const s=void 0===n?-1:n,r=void 0===i?-1:i,o=e.elementCount>1&&s<0&&r<0;this.fnConvert=function(e,t,n){const i=n?1:0;return l[e][t][i]}(e.type,t.type,o);const a=function(e,t,n){return-1===e&&-1===t?n:e<=3&&t<=3?h[e+1][t+1]:function(n,i,s){return i[t]=s(n[e]),i}}(s,r,this.fnConvert);var c,d,u;this.fnCopy=(c=e.isMulti(),d=t.isMulti(),u=a,!1===c?!1===d?u:function(e,t,n){for(let n=0,i=t.length;n0&&(t=u(e[0],t)),t}:function(e,t,n){for(let n=0,i=e.length,s=t.length;n=0&&this.setValue(i,t,n)}copyValue(e,t){Array.isArray(e)&&(e=e.slice()),this.setValue(e,t)}set(e){e||(this.changed=!0,this.isInput()&&(this._group.linkable.changed=!0)),this.emit("value",this.value);const t=this.outLinks;for(let e=0,n=t.length;ei.source===e&&i.sourceIndex===t&&i.destinationIndex===n));return!!i&&(e.removeOutLink(i),this.removeInLink(i),!0)}unlink(){this.inLinks.slice().forEach((e=>{e.source.removeOutLink(e),this.removeInLink(e)}));if(this.outLinks.slice().forEach((e=>{this.removeOutLink(e),e.destination.removeInLink(e)})),0!==this.inLinks.length||0!==this.outLinks.length)throw new Error("fatal: leftover links")}addInLink(e){if(e.destination!==this)throw new Error("input link's destination must equal this");this.inLinks.push(e),this.requestSort(),this.emit({type:"link",add:!0,remove:!1,link:e})}addOutLink(e){if(e.source!==this)throw new Error("output link's source must equal this");this.outLinks.push(e),this.requestSort(),e.push()}removeInLink(e){const t=this.inLinks.indexOf(e);if(t<0)throw new Error("input link not found");this.inLinks.splice(t,1),this.requestSort(),0===this.inLinks.length&&"object"===this.type&&this.reset(),this.emit({type:"link",add:!1,remove:!0,link:e})}removeOutLink(e){const t=this.outLinks.indexOf(e);if(t<0)throw new Error("output link not found");this.outLinks.splice(t,1),this.requestSort()}canLinkTo(e,t,n){return e.canLinkFrom(this,t,n)}canLinkFrom(e,t,n){if(this.isOutput())return!1;const i=t>=0,s=n>=0;if(!e.isArray()&&i)throw new Error("non-array source property; can't link to element");if(!this.isArray()&&s)throw new Error("non-array destination property; can't link to element");const r=e.isArray()&&!i;return r===(this.isArray()&&!s)&&((!r||e.elementCount===this.elementCount)&&(!("object"===e.type&&"object"===this.type&&!function(e,t){if(!e||!t)return!1;let n=e.prototype;for(;n;){if(n===t.prototype)return!0;n=n.prototype}return!1}(e.schema.objectType,this.schema.objectType))&&(o=e.type,a=this.type,c[o][a])));var o,a}reset(){let e;if(this.isMulti()){let t=this.value;t?t.length=1:e=t=[],t[0]=this.clonePreset()}else e=this.clonePreset();this.setValue(e)}setMultiChannelCount(e){if(!this.isMulti())throw new Error("can't set multi channel count on non-multi property");const t=this.value,n=t.length;t.length=e;for(let i=n;i=e.length?0:t]||""}}isInput(){return this._group&&this._group===this._group.linkable.ins}isOutput(){return this._group&&this._group===this._group.linkable.outs}isArray(){return Array.isArray(this.schema.preset)}isMulti(){return!!this.schema.multi}isDefault(){const e=this.schema.multi?this.value[0]:this.value,t=this.schema.preset,n=Array.isArray(e)?e.length:-1;if(n!==(Array.isArray(t)?t.length:-1))return!1;if(n>=0){for(let i=0;i0||this.outLinks.length>0}hasInLinks(e){const t=this.inLinks;if(!(e>=0))return t.length>0;for(let n=0,i=t.length;n=0))return!0;return!1}hasOutLinks(e){const t=this.outLinks;if(!(e>=0))return t.length>0;for(let n=0,i=t.length;n0&&(e=e||{},e.links=this.outLinks.map((e=>{const t={id:e.destination._group.linkable.id,key:e.destination.key};return e.sourceIndex>=0&&(t.srcIndex=e.sourceIndex),e.destinationIndex>=0&&(t.dstIndex=e.destinationIndex),t}))),e}fromJSON(e,t){void 0!==e.value&&(this.value=e.value),void 0!==e.links&&e.links.forEach((e=>{t[e.id].ins[e.key].linkFrom(this,e.srcIndex,e.dstIndex)}))}toString(){const e=this.schema,t=e.event?"event":e.options?"enum":this.type;return`${this.path} [${t}]`}dump(e=""){console.log(e+`Property '${this.path}', key: ${this.key}, value: ${this.value}`)}validateValue(e){const t=this.schema;if(t.enum){const n=Math.trunc(e);return t.enum[n]?n:0}if(t.options){const n=Math.trunc(e);return n<0||n>=t.options.length?0:n}return"number"===this.type?(e=t.min?Math.max(t.min,e):e,e=t.max?Math.min(t.max,e):e):e}clonePreset(){const e=this.schema.preset;return Array.isArray(e)?e.slice():e}}},56166:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var i=n(82942),s=n(97444),r=n(26041),o=n(80038),a=n(90199),l=n(83275);class c extends i.Z{constructor(e){super({knownEvents:!1}),this.nodes=new s.Z(a.Z),this.components=new s.Z(o.ZP),this.registry=e||new r.Z,this.graph=new l.Z(this,null),this.graph.activate()}getComponent(e,t=!1){return this.components.get(e,t)}getComponents(e){return this.components.getArray(e)}getComponentsByTag(e){return this.components.getByTag(e)}hasComponents(e){return this.components.has(e)}getMainComponent(e,t=!1){return this.graph.components.get(e,t)}getMainComponents(e){return this.graph.components.getArray(e)}getMainComponentsByTag(e){return this.graph.components.getByTag(e)}hasMainComponents(e){return this.graph.components.has(e)}getNode(e,t=!1){return this.nodes.get(e,t)}getNodes(e){return this.nodes.getArray(e)}getNodesByTag(e){return this.nodes.getByTag(e)}hasNodes(e){return this.nodes.has(e)}getMainNode(e,t=!1){return this.graph.nodes.get(e,t)}getMainNodes(e){return this.graph.nodes.getArray(e)}getMainNodesByTag(e){return this.graph.nodes.getByTag(e)}hasMainNodes(e){return this.graph.nodes.has(e)}findNodeByName(e,t){const n=this.nodes.getArray(t);for(let t=0,i=n.length;te.toString(!0))).join("\n"):i}_addNode(e){this.nodes.add(e)}_removeNode(e){this.nodes.remove(e)}_addNodeTag(e,t){this.nodes.addByTag(e,t)}_removeNodeTag(e,t){this.nodes.removeByTag(e,t)}_addComponent(e){if(e.isSystemSingleton&&this.components.has(e))throw new Error(`only one component of type '${e.typeName}' allowed per system`);this.components.add(e)}_removeComponent(e){this.components.remove(e)}_addComponentTag(e,t){this.components.addByTag(e,t)}_removeComponentTag(e,t){this.components.removeByTag(e,t)}}},63833:(e,t,n)=>{"use strict";n.d(t,{$:()=>i,Z:()=>a});var i,s=n(80038),r=n(90199),o=n(67171);!function(e){e[e.Node=0]="Node",e[e.Graph=1]="Graph",e[e.Main=2]="Main",e[e.System=3]="System"}(i||(i={}));class a extends s.ZP{constructor(){super(...arguments),this._scope=i.Node,this._scopedNode=null,this._scopedGraph=null,this._activeComponent=null}get componentType(){return this.constructor.componentType}get followComponentSelection(){return this.constructor.followComponentSelection}get followNodeSelection(){return this.constructor.followNodeSelection}get retainSelection(){return this.constructor.retainSelection}get scope(){return this._scope}set scope(e){this._scope=e,this._activeComponent&&!this.isComponentInScope(this._activeComponent)&&(this.activeComponent=null)}get scopedNode(){return this._scopedNode}set scopedNode(e){e!==this._scopedNode&&(this._scopedNode=e,this._activeComponent&&!this.isComponentInScope(this._activeComponent)&&(this.activeComponent=null),this.onScopedComponents(),this.emit({type:"scoped-components"}))}get scopedGraph(){return this._scopedGraph}set scopedGraph(e){e!==this._scopedGraph&&(this._scopedGraph=e,this._activeComponent&&!this.isComponentInScope(this._activeComponent)&&(this.activeComponent=null),this.onScopedComponents(),this.emit({type:"scoped-components"}))}get scopedComponents(){switch(this._scope){case i.Node:return(this._scopedNode||this.node).getComponents(this.componentType);case i.Graph:return(this._scopedGraph?this._scopedGraph.innerGraph:this.graph).getComponents(this.componentType);case i.Main:return this.getMainComponents(this.componentType);case i.System:return this.getSystemComponents(this.componentType)}}get activeComponent(){return this._activeComponent}set activeComponent(e){const t=this.activeComponent;if(e!==t){if(t&&this.deactivateComponent(t),e){if(!this.isComponentInScope(e))throw new Error("can't activate, component out of scope");this.activateComponent(e)}this._activeComponent=e,this.onActiveComponent(t,e),this.emit({type:"active-component",previous:t,next:e})}}get selection(){return this.getSystemComponent(o.Z)}create(){super.create(),this.system.components.on(s.ZP,this.onComponent,this),this.followComponentSelection&&this.selection.selectedComponents.on(this.componentType,this.onSelectComponent,this),this.followNodeSelection&&this.selection.selectedNodes.on(r.Z,this.onSelectNode,this)}dispose(){this.activeComponent&&(this.activeComponent=null),this.system.components.off(s.ZP,this.onComponent,this),this.followComponentSelection&&this.selection.selectedComponents.off(this.componentType,this.onSelectComponent,this),this.followNodeSelection&&this.selection.selectedNodes.off(r.Z,this.onSelectNode,this),super.dispose()}activateComponent(e){}deactivateComponent(e){}onActiveComponent(e,t){}onScopedComponents(){}onComponent(e){e.remove&&e.object===this.activeComponent&&(this.activeComponent=null),this.isComponentInScope(e.object)&&(this.onScopedComponents(),this.emit({type:"scoped-components"}))}onSelectComponent(e){const t=e.object;this.isComponentInScope(t)&&(e.add?this.activeComponent=t:e.remove&&!this.retainSelection&&t===this.activeComponent&&(this.activeComponent=null))}onSelectNode(e){const t=e.object;if(this.isNodeInScope(t)){const n=t.getComponent(this.componentType);n&&this.onSelectComponent({type:n.typeName,object:n,add:e.add,remove:e.remove})}}isComponentInScope(e){if(!e.is(this.componentType))return!1;switch(this._scope){case i.Node:const t=this._scopedNode||this.node;return e.node===t;case i.Graph:const n=this._scopedGraph?this._scopedGraph.innerGraph:this.graph;return e.graph===n;case i.Main:return e.graph===this.system.graph;case i.System:return!0}return!1}isNodeInScope(e){switch(this._scope){case i.Node:return e===(this._scopedNode||this.node);case i.Graph:const t=this._scopedGraph?this._scopedGraph.innerGraph:this.graph;return e.graph===t;case i.Main:return e.graph===this.system.graph;case i.System:return!0}}}a.typeName="CComponentProvider",a.componentType=s.ZP,a.followComponentSelection=!0,a.followNodeSelection=!1,a.retainSelection=!0},18894:(e,t,n)=>{"use strict";n.d(t,{V5:()=>i.V5,ZP:()=>r});var i=n(80038),s=n(83275);n(90199);class r extends i.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(r.graphIns),this._innerGraph=null,this._innerRoot=null,this._innerGraph=new s.Z(this.system,this)}get innerGraph(){return this._innerGraph}get innerNodes(){return this._innerGraph.nodes}get innerComponents(){return this._innerGraph.components}get innerRoots(){return this._innerGraph.roots}getInnerComponent(e,t=!1){return this._innerGraph.components.get(e,t)}getInnerComponents(e){return this._innerGraph.components.getArray(e)}hasInnerComponent(e){return this._innerGraph.components.has(e)}getInnerNode(e,t=!1){return this._innerGraph.nodes.get(e,t)}getInnerNodes(e){return this._innerGraph.nodes.getArray(e)}hasInnerNode(e){return this._innerGraph.nodes.has(e)}isEmpty(){return 0===this._innerGraph.nodes.count()}update(e){const t=this.ins;if(t.active.changed){const e=t.active.value;e!==this._innerGraph.isActive&&(e?this.activateInnerGraph():this.deactivateInnerGraph())}return!0}tick(e){return this._innerGraph.tick(e)}tock(e){return this._innerGraph.tock(e)}dispose(){this._innerGraph.clear(),this._innerGraph=null,this._innerRoot=null,super.dispose()}clearInnerGraph(){this._innerGraph.clear()}fromJSON(e){super.fromJSON(e),this._innerGraph.clear(),this._innerGraph.fromJSON(e.graph)}toJSON(){const e=super.toJSON();return e.graph=this._innerGraph.toJSON(),e}dump(e=""){super.dump(e),this.innerGraph.dump(e+" ")}onAddInnerRoot(e){}onRemoveInnerRoot(e){}activateInnerGraph(){this._innerGraph.activate()}deactivateInnerGraph(){this._innerGraph.deactivate()}}r.typeName="CGraph",r.graphIns={active:i.V5.Boolean("Graph.Active",!0)}},3474:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var i=n(80038),s=(n(90199),n(18894));const r=(e,t,n)=>{let i;const s=e.children;for(let e=0,n=s.length;e{let i;const s=e.children;for(let e=0,n=s.length;e{let i=[];const s=e.children;for(let e=0,n=s.length;ee.node.dispose())),this._parent&&this._parent.removeChild(this),this.graph._removeRoot(this),super.dispose()}getRootComponent(e){let t=this;for(;t._parent;)t=t._parent;return t?t.node.components.get(e):null}getParentComponent(e,t){let n=this;for(;;){if(n=n._parent,!n){const e=this.graph.parent;n=e?e.components.get(l):void 0}if(!n)return;const i=n.node.components.get(e,!0);if(i)return i;if(!t)return}}getParentNode(e,t){let n=this;for(;;){if(n=n._parent,!n){const e=this.graph.parent;n=e?e.components.get(l):void 0}if(!n)return;const i=n.node;if(i.is(e))return i;if(!t)return}}getSiblingNode(e){return this.getSiblingNodes(e)[0]}getSiblingNodes(e){const t=this._parent;return this.graph.nodes.getArray(e).filter((e=>{const n=e.components.get(l);return(n?n._parent:null)==t}))}hasChildComponents(e,t){return r(this,e,t)}getChildComponent(e,t){return o(this,e,t)}getChildComponents(e,t){return a(this,e,t)}traverseUp(e,t,n,i){if(e)if(t){const e=this.node.components.getArray();for(let t=0,n=e.length;t(e.emit(n),n.stopPropagation)))}propagateDown(e,t,n){this.traverseDown(!0,e,t,(e=>(e.emit(n),n.stopPropagation)))}addChild(e){if(e===this)throw new Error("can't add self as child");if(e._parent)throw new Error("can't add child, component has a parent");if(e.graph!==this.graph)throw new Error("can't add child, component in different graph");e._parent=this,this._children.push(e),this.graph._removeRoot(e);const t={type:"hierarchy",add:!0,remove:!1,parent:this,child:e};this.traverseUp(!0,!1,!0,(e=>e.emit(t))),this.traverseDown(!1,!1,!0,(e=>e.emit(t))),this.system.emit(t)}removeChild(e){if(e._parent!==this)throw new Error("component not a child of this");const t={type:"hierarchy",add:!1,remove:!0,parent:this,child:e};this.traverseUp(!0,!1,!0,(e=>e.emit(t))),this.traverseDown(!1,!1,!0,(e=>e.emit(t))),this.system.emit(t);const n=this._children.indexOf(e);this._children.splice(n,1),e._parent=null,this.graph._addRoot(e)}onComponent(e){if(e.object===this)return;const t={type:"child",add:e.add,remove:e.remove,component:e.object};this.traverseUp(!0,!1,!0,(e=>e.emit(t)))}toJSON(){const e=super.toJSON();return this._children.length>0&&(e.children=this._children.map((e=>e.id))),e}referencesFromJSON(e){super.referencesFromJSON(e);const t=this.system.components.getDictionary();e.children&&e.children.forEach((e=>{const n=t[e];this.addChild(n)}))}toString(){return super.toString()+` - children: ${this.children.length}`}dump(e=""){super.dump(e),this.children.length>0&&(console.log(e+"%cChildren","color: purple"),this.children.forEach((t=>t.node.dump(e+" "))))}}l.typeName="CHierarchy"},92989:(e,t,n)=>{"use strict";n.d(t,{F:()=>i,Z:()=>a});var i,s=n(80038),r=n(90199),o=n(67171);!function(e){e[e.Graph=0]="Graph",e[e.Main=1]="Main",e[e.System=2]="System"}(i||(i={}));class a extends s.ZP{constructor(){super(...arguments),this._scope=i.Graph,this._scopedGraph=null,this._activeNode=null}get nodeType(){return this.constructor.nodeType}get followNodeSelection(){return this.constructor.followNodeSelection}get followComponentSelection(){return this.constructor.followComponentSelection}get retainSelection(){return this.constructor.retainSelection}get scope(){return this._scope}set scope(e){this._scope=e,this._activeNode&&!this.isNodeInScope(this._activeNode)&&(this.activeNode=null)}get scopedGraph(){return this._scopedGraph}set scopedGraph(e){e!==this._scopedGraph&&(this._scopedGraph=e,this._activeNode&&!this.isNodeInScope(this._activeNode)&&(this.activeNode=null),this.onScopedNodes(),this.emit({type:"scoped-nodes"}))}get scopedNodes(){switch(this._scope){case i.Graph:return(this._scopedGraph?this._scopedGraph.innerGraph:this.graph).getNodes(this.nodeType);case i.Main:return this.getMainNodes(this.nodeType);case i.System:return this.getSystemNodes(this.nodeType)}}get activeNode(){return this._activeNode}set activeNode(e){const t=this.activeNode;if(e!==t){if(t&&this.deactivateNode(t),e){if(!this.isNodeInScope(e))throw new Error("can't activate, node out of scope");this.activateNode(e)}this._activeNode=e,this.onActiveNode(t,e),this.emit({type:"active-node",previous:t,next:e})}}get selection(){return this.getSystemComponent(o.Z)}create(){super.create(),this.system.nodes.on(r.Z,this.onNode,this),this.followNodeSelection&&this.selection.selectedNodes.on(this.nodeType,this.onSelectNode,this),this.followComponentSelection&&this.selection.selectedComponents.on(s.ZP,this.onSelectComponent,this)}dispose(){this.activeNode&&(this.activeNode=null),this.system.nodes.off(r.Z,this.onNode,this),this.followNodeSelection&&this.selection.selectedNodes.off(this.nodeType,this.onSelectNode,this),this.followComponentSelection&&this.selection.selectedComponents.off(s.ZP,this.onSelectComponent,this),super.dispose()}activateNode(e){}deactivateNode(e){}onActiveNode(e,t){}onScopedNodes(){}onNode(e){e.remove&&e.object===this.activeNode&&(this.activeNode=null),this.isNodeInScope(e.object)&&(this.onScopedNodes(),this.emit({type:"scoped-nodes"}))}onSelectNode(e){const t=e.object;this.isNodeInScope(t)&&(e.add?this.activeNode=t:e.remove&&!this.retainSelection&&t===this.activeNode&&(this.activeNode=null))}onSelectComponent(e){const t=e.object.node;t.is(this.nodeType)&&this.onSelectNode({type:t.typeName,object:t,add:e.add,remove:e.remove})}isNodeInScope(e){if(!e.is(this.nodeType))return!1;switch(this._scope){case i.Graph:const t=this._scopedGraph?this._scopedGraph.innerGraph:this.graph;return e.graph===t;case i.Main:return e.graph===this.system.graph;case i.System:return!0}return!1}}a.typeName="CNodeProvider",a.nodeType=r.Z,a.followNodeSelection=!0,a.followComponentSelection=!1,a.retainSelection=!0},26220:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(80038);class s extends i.ZP{constructor(e,t){super(e,t),this.outs=this.addOutputs(s.pulseOuts),this._tockUpdated=!1,this.addEvent("pulse"),this.onAnimationFrame=this.onAnimationFrame.bind(this),this.context={time:new Date,secondsElapsed:0,secondsDelta:0,frameNumber:0},this._secondsStarted=.001*Date.now(),this._secondsStopped=this._secondsStarted,this._animHandler=0,this._pulseEvent={type:"pulse",context:this.context,systemUpdated:!1}}start(){0===this._animHandler&&(this._secondsStopped>0&&(this._secondsStarted+=.001*Date.now()-this._secondsStopped,this._secondsStopped=0),this._animHandler=window.requestAnimationFrame(this.onAnimationFrame))}stop(){0!==this._animHandler&&(0===this._secondsStopped&&(this._secondsStopped=.001*Date.now()),window.cancelAnimationFrame(this._animHandler),this._animHandler=0)}pulse(e){const{outs:t,context:n,_pulseEvent:i}=this;n.time.setTime(e);const s=.001*e-this._secondsStarted;n.secondsDelta=s-n.secondsElapsed,n.secondsElapsed=s,n.frameNumber++,t.time.setValue(n.secondsElapsed),t.frame.setValue(n.frameNumber);const r=this.system.graph.tick(n);i.systemUpdated=r||this._tockUpdated,this.emit(i),this._tockUpdated=this.system.graph.tock(n)}onAnimationFrame(){this.pulse(Date.now()),this._animHandler=window.requestAnimationFrame(this.onAnimationFrame)}}s.typeName="CPulse",s.isSystemSingleton=!0,s.pulseOuts={time:i.V5.Number("Pulse.Time"),frame:i.V5.Integer("Pulse.Frame")}},67171:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var i=n(97444),s=n(89809),r=n(80038),o=n(90199),a=n(18894);n(96561);class l extends r.ZP{createActions(e){return{}}}l.typeName="CController",l.isSystemSingleton=!0;class c extends l{constructor(e,t){super(e,t),this.outs=this.addOutputs(c.selOuts),this.multiSelect=!1,this.exclusiveSelect=!0,this.selectedNodes=new i.Z(o.Z),this.selectedComponents=new i.Z(r.ZP),this._activeGraph=null,this.addEvents("select-node","select-component","active-graph","update"),this.selectedNodes.on(o.Z,(e=>this.onSelectNode(e.object,e.add))),this.selectedComponents.on(r.ZP,(e=>this.onSelectComponent(e.object,e.add))),this._activeGraph=this.system.graph}getSelectedNode(e){return this.selectedNodes.get(e,!0)}getSelectedNodes(e){return this.selectedNodes.getArray(e)}getSelectedComponent(e){return this.selectedComponents.get(e,!0)}getSelectedComponents(e){return this.selectedComponents.getArray(e)}get activeGraph(){return this._activeGraph}set activeGraph(e){if(e!==this.activeGraph){this.clearSelection();const t=this._activeGraph;this._activeGraph=e,this.onActiveGraph(e),this.emit({type:"active-graph",previous:t,next:e})}}hasParentGraph(){return this._activeGraph&&this._activeGraph.parent}activateParentGraph(){this._activeGraph&&this._activeGraph.parent.graph&&(this.activeGraph=this._activeGraph.parent.graph)}hasChildGraph(){return this.selectedComponents.has(a.ZP)}activateChildGraph(){const e=this.selectedComponents.get(a.ZP,!0);e&&(this.activeGraph=e.innerGraph)}create(){super.create(),this.system.nodes.on(o.Z,this.onSystemNode,this),this.system.components.on(r.ZP,this.onSystemComponent,this)}dispose(){this.system.nodes.off(o.Z,this.onSystemNode,this),this.system.components.off(r.ZP,this.onSystemComponent,this),super.dispose()}createActions(e){return{selectNode:e.register({name:"Select Node",do:this.selectNode,target:this}),selectComponent:e.register({name:"Select Component",do:this.selectComponent,target:this}),clearSelection:e.register({name:"Clear Selection",do:this.clearSelection,target:this})}}nodeContainsSelectedComponent(e){const t=e.components.getArray();for(let e=0,n=t.length;e{"use strict";n.d(t,{P:()=>r,Z:()=>c});const i=Math.PI,s=.5*i;var r;!function(e){e[e.Linear=0]="Linear",e[e.EaseQuad=1]="EaseQuad",e[e.EaseInQuad=2]="EaseInQuad",e[e.EaseOutQuad=3]="EaseOutQuad",e[e.EaseCubic=4]="EaseCubic",e[e.EaseInCubic=5]="EaseInCubic",e[e.EaseOutCubic=6]="EaseOutCubic",e[e.EaseQuart=7]="EaseQuart",e[e.EaseInQuart=8]="EaseInQuart",e[e.EaseOutQuart=9]="EaseOutQuart",e[e.EaseQuint=10]="EaseQuint",e[e.EaseInQuint=11]="EaseInQuint",e[e.EaseOutQuint=12]="EaseOutQuint",e[e.EaseSine=13]="EaseSine",e[e.EaseInSine=14]="EaseInSine",e[e.EaseOutSine=15]="EaseOutSine"}(r||(r={}));const o={Linear:function(e){return e},EaseQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},EaseInQuad:function(e){return e*e},EaseOutQuad:function(e){return e*(2-e)},EaseCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},EaseInCubic:function(e){return e*e*e},EaseOutCubic:function(e){return--e*e*e+1},EaseQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},EaseInQuart:function(e){return e*e*e*e},EaseOutQuart:function(e){return 1- --e*e*e*e},EaseQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},EaseInQuint:function(e){return e*e*e*e*e},EaseOutQuint:function(e){return 1+--e*e*e*e*e},EaseSine:function(e){return-.5*(Math.cos(e*i)-1)},EaseInSine:function(e){return 1-Math.cos(e*s)},EaseOutSine:function(e){return Math.sin(e*s)}};var a=n(80038),l=n(84292);class c extends a.ZP{constructor(){super(...arguments),this.ins=this.addInputs(c.ins),this.outs=this.addOutputs(c.outs),this.targets=[],this.states={},this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null}getState(e){return this.states[e]}setState(e){return e.id=e.id||(0,l.Z)(6),this.states[e.id]=e,e.id}deleteState(e){delete this.states[e]}clear(){this.targets.forEach((e=>e.property.off("dispose",this.onPropertyDispose,this))),this.targets.length=0,this.states={},this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null}dispose(){this.clear(),super.dispose()}tweenTo(e,t){const n=this.states[e],i=this.outs;if(n)return this._targetState=n,this._currentValues=this.getCurrentValues(),this._startTime=t,this._easingFunction=(s=n.curve,o[r[s]]),i.switched.setValue(!1),i.tweening.setValue(!0),i.start.set(),!0;var s}update(e){const t=this.ins,n=this.states,i=t.id.value,s=n[i];if(s){if((t.tween.changed||t.recall.changed)&&(t.curve.setValue(s.curve),t.duration.setValue(s.duration),t.threshold.setValue(s.threshold)),t.tween.changed)return this.tweenTo(i,e.secondsElapsed),!0;if(t.recall.changed)return this.setValues(s.values),!0;(t.curve.changed||t.duration.changed||t.threshold.changed)&&(s.curve=t.curve.value,s.duration=t.duration.value,s.threshold=t.threshold.value),t.store.changed&&(s.values=this.getCurrentValues()),t.delete.changed&&delete n[i]}else if(i&&t.store.changed){const e={id:this.ins.id.value,curve:this.ins.curve.getValidatedValue(),duration:this.ins.duration.value,threshold:this.ins.threshold.value,values:this.getCurrentValues()};n[e.id]=e}return!0}tick(e){const t=this._targetState;if(!t)return!1;const n=this.outs,i=this._currentValues,s=this._startTime,r=e.secondsElapsed-s,o=r/t.duration;if(o<1){const e=this._easingFunction(o),s=o>=t.threshold&&!n.switched.value;this.setValues(i,t.values,e,s),n.time.setValue(r),n.completed.setValue(o),s&&(n.switched.setValue(!0),n.switch.set())}else this.setValues(i,t.values,1,!n.switched.value),n.tweening.setValue(!1),n.time.setValue(t.duration),n.completed.setValue(1),n.end.set(),n.switched.value||n.switched.setValue(!0),this._currentValues=null,this._targetState=null,this._startTime=0,this._easingFunction=null;return!0}addTargetProperty(e){if("object"===e.type||e.schema.event)throw new Error("can't add object or event properties");if(this.getTarget(e))throw new Error("can't add, target already exists");e.on("dispose",this.onPropertyDispose,this);const t="number"===e.type&&!e.schema.options,n=e.isArray();this.targets.push({property:e,isNumber:t,isArray:n});const i=this.states,s=Object.keys(i);for(let t=0,n=s.length;t{const t=this.getProperty(e.id,e.key);return{property:t,isNumber:!!t&&"number"===t.type&&!t.schema.options,isArray:!!t&&t.isArray()}}))),e.states&&e.states.forEach((e=>this.states[e.id]=e)),this._startTime=0}toJSON(){const e=super.toJSON(),t=this.stateToJSON();return t&&(e.state=t),e}stateToJSON(){const e={},t=this.targets;t.length>0&&(e.targets=t.map((e=>({id:e.property.group.linkable.id,key:e.property.key}))));const n=Object.keys(this.states);return n.length>0&&(e.states=n.map((e=>this.states[e]))),e}getTargetProperties(){return this.targets.map((e=>e.property))}onPropertyDispose(e){e.property.off("dispose",this.onPropertyDispose,this);const t=this.getTarget(e.property);this.removeTarget(t)}removeTarget(e){const t=this.targets.indexOf(e);this.targets.splice(t,1),this.removeChannel(t)}removeChannel(e){const t=this.states,n=Object.keys(t);for(let i=0,s=n.length;it.property===e))}getProperty(e,t){const n=this.system.components.getById(e);return n?n.ins[t]:null}setValues(e,t,n,i){const s=this.targets;for(let r=0,o=s.length;r{"use strict";n.d(t,{V5:()=>l});var i=n(82507);const s={xyzw:["X","Y","Z","W"],rgba:["R","G","B","A"]},r=function(e){return void 0===e||"object"==typeof e&&!Array.isArray(e)?e:{preset:e}},o=function(e,t,n){return{path:t,schema:(n=r(n))?Object.assign({},e,n):e}},a={Number:{preset:0},Integer:{preset:0,step:1,speed:.34,precision:0},Natural:{preset:0,step:1,speed:.34,precision:0,min:0},Unit:{preset:0,min:0,max:1,bar:!0},Percent:{preset:0,min:0,max:1,bar:!0,percent:!0},Vector2:{preset:[0,0]},Vector3:{preset:[0,0,0]},Vector4:{preset:[0,0,0,0]},Matrix2:{preset:[1,0,0,1]},Matrix3:{preset:[1,0,0,0,1,0,0,0,1]},Matrix4:{preset:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},Scale:{preset:1},Scale2:{preset:[1,1]},Scale3:{preset:[1,1,1]},IntVec2:{preset:[0,0],step:1,speed:.34,precision:0},IntVec3:{preset:[0,0,0],step:1,speed:.34,precision:0},ColorRGB:{preset:[1,1,1],semantic:"color",labels:s.rgba,min:0,max:1,bar:!0},ColorRGBA:{preset:[1,1,1,1],semantic:"color",labels:s.rgba,min:0,max:1,bar:!0},Boolean:{preset:!1},String:{preset:""},AssetPath:{preset:"",semantic:"asset-path"},Object:{preset:null,objectType:Object},Event:{preset:0,event:!0}},l={Property:(e,t)=>o(void 0,e,t),Number:(e,t)=>o(a.Number,e,t),Integer:(e,t)=>o(a.Integer,e,t),Natural:(e,t)=>o(a.Natural,e,t),Unit:(e,t)=>o(a.Unit,e,t),Percent:(e,t)=>o(a.Percent,e,t),Vector2:(e,t)=>o(a.Vector2,e,t),Vector3:(e,t)=>o(a.Vector3,e,t),Vector4:(e,t)=>o(a.Vector4,e,t),IntVec2:(e,t)=>o(a.IntVec2,e,t),IntVec3:(e,t)=>o(a.IntVec3,e,t),Matrix2:(e,t)=>o(a.Matrix2,e,t),Matrix3:(e,t)=>o(a.Matrix3,e,t),Matrix4:(e,t)=>o(a.Matrix4,e,t),Scale:(e,t)=>o(a.Scale,e,t),Scale2:(e,t)=>o(a.Scale2,e,t),Scale3:(e,t)=>o(a.Scale3,e,t),ColorRGB:(e,t)=>o(a.ColorRGB,e,t),ColorRGBA:(e,t)=>o(a.ColorRGBA,e,t),Boolean:(e,t)=>o(a.Boolean,e,t),String:(e,t)=>o(a.String,e,t),AssetPath:(e,t)=>o(a.AssetPath,e,t),Enum:(e,t,n)=>function(e,t,n){n=r(n);const s={enum:e,options:(0,i.q)(e),preset:0};return{path:t,schema:n?Object.assign({},s,n):s}}(t,e,n),Option:(e,t,n)=>function(e,t,n){const i={options:e,preset:0};return{path:t,schema:(n=r(n))?Object.assign({},i,n):i}}(t,e,n),Object:(e,t,n)=>function(e,t,n){const i={preset:null,objectType:e};return{path:t,schema:(n=r(n))?Object.assign({},i,n):i}}(t,e,n),Event:(e,t)=>o(a.Event,e,t)}},87156:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o,t:()=>i});var i,s=n(26775),r=n(73130);!function(e){e[e.Single=0]="Single",e[e.HorizontalSplit=1]="HorizontalSplit",e[e.VerticalSplit=2]="VerticalSplit",e[e.Quad=3]="Quad"}(i||(i={}));class o extends r.Z{constructor(e,t,n){super(e,t,n),this._layout=i.Quad,this._horizontalSplit=.5,this._verticalSplit=.5,this.addEvent("layout"),this.layout=i.Single}set layout(e){if(e===this._layout)return;this._layout=e;const t=this.viewports;switch(this._layout){case i.Single:this.setViewportCount(1);break;case i.HorizontalSplit:case i.VerticalSplit:this.setViewportCount(2);break;case i.Quad:this.setViewportCount(4)}this.updateSplitPositions(),t[1]&&(t[1].setBuiltInCamera(s.mP.Orthographic,s.LY.Top),t[1].enableCameraControl(!0).orientationEnabled=!1),t[2]&&(t[2].setBuiltInCamera(s.mP.Orthographic,s.LY.Left),t[2].enableCameraControl(!0).orientationEnabled=!1),t[3]&&(t[3].setBuiltInCamera(s.mP.Orthographic,s.LY.Front),t[3].enableCameraControl(!0).orientationEnabled=!1),this.emit({type:"layout",layout:e})}get layout(){return this._layout}set horizontalSplit(e){this._horizontalSplit=e,this.updateSplitPositions()}get horizontalSplit(){return this._horizontalSplit}set verticalSplit(e){this._verticalSplit=e,this.updateSplitPositions()}get verticalSplit(){return this._verticalSplit}updateSplitPositions(){const e=this._horizontalSplit,t=this._verticalSplit;switch(this._layout){case i.Single:this.viewports[0].setSize(0,0,1,1);break;case i.HorizontalSplit:this.viewports[0].setSize(0,0,e,1),this.viewports[1].setSize(e,0,1-e,1);break;case i.VerticalSplit:this.viewports[0].setSize(0,1-t,1,t),this.viewports[1].setSize(0,0,1,1-t);break;case i.Quad:this.viewports[0].setSize(0,1-t,e,t),this.viewports[1].setSize(e,1-t,1-e,t),this.viewports[2].setSize(0,0,e,1-t),this.viewports[3].setSize(e,0,1-e,1-t)}}}},73130:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var i=n(64702),s=n(7177),r=n(75544),o=n(82942),a=n(3474),l=n(73902),c=n(12197),h=n(26060),d=n(15271),u=n(26775);class p extends o.Z{constructor(e,t,n){super(),this.viewports=[],this.rendererComponent=null,this.targetViewport=null,this.targetObject3D=null,this.targetComponent=null,this.targetScene=null,this.targetCamera=null,this.defaultScene=new i.x,this.defaultCamera=new u.ZP,this.system=e,this.canvas=t,this.overlay=n,this.renderer=new s.C({canvas:t,antialias:!0}),this.renderer.autoClear=!1,this.renderer.outputColorSpace=r.KI_,this.picker=new h.Z(this.renderer)}dispose(){this.renderer.dispose(),this.viewports.forEach((e=>e.dispose()))}get canvasWidth(){return this.canvas.width}get canvasHeight(){return this.canvas.height}attach(){const e=this.canvasWidth,t=this.canvasHeight;this.viewports.forEach((n=>n.setCanvasSize(e,t))),this.renderer.setSize(e,t,!1),this.rendererComponent=this.system.getComponent(d.Z,!0),this.rendererComponent.attachView(this)}detach(){this.rendererComponent=this.system.getComponent(d.Z,!0),this.rendererComponent.detachView(this),this.rendererComponent=null}renderImage(e,t,n,i){const s=this.canvas.width,r=this.canvas.height;this.setRenderSize(e,t),this.render();const o=this.canvas.toDataURL(n,i);return this.setRenderSize(s,r),o}render(){const e=this.rendererComponent.activeSceneComponent;if(!e)return;let t=e.scene,n=e.activeCamera;t&&n||(t=this.defaultScene,n=this.defaultCamera);const i=this.renderer;i.clear(),i.__view=this;const s=this.viewports;for(let e=0,r=s.length;en.setCanvasSize(e,t))),this.renderer.xr.isPresenting||this.renderer.setSize(e,t,!1)}resize(){this.setRenderSize(this.canvas.clientWidth,this.canvas.clientHeight),this.renderer.xr.isPresenting||this.render()}setViewportCount(e){const t=this.viewports;for(let n=e;n{"use strict";n.d(t,{u:()=>h,Z:()=>g});var i=n(2837),s=n(8035),r=n(75809),o=n(56963),a=n(31599),l=n(44428);class c extends l.j{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}var h,d=n(19588),u=n(93113);!function(e){e[e.Solid=0]="Solid",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient"}(h||(h={}));class p extends s.K{constructor(){super(new m,new f),this.frustumCulled=!1,this.renderOrder=-1/0,this.matrixAutoUpdate=!1}dispose(){this.geometry.dispose(),this.material.dispose()}updateMatrixWorld(e){}}class m extends r.u{constructor(){super();const e=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),t=new o.v(e,5);this.setIndex([0,1,2,0,2,3]),this.setAttribute("position",new a.k(t,3,0,!1)),this.setAttribute("uv",new a.k(t,2,3,!1))}}class f extends c{constructor(){super(...arguments),this.depthTest=!1,this.depthWrite=!1,this.transparent=!1,this.uniforms={style:{value:h.LinearGradient},color0:{value:new d.P(.15,.2,.25)},color1:{value:new d.P(0,0,0)},noise:{value:.02}},this.vertexShader=["precision highp float;","attribute vec3 position;","attribute vec2 uv;","varying vec2 ndc;","void main() {"," ndc = position.xy;"," gl_Position = vec4(position, 1.0);","}"].join("\n"),this.fragmentShader=["precision highp float;","uniform vec3 color0;","uniform vec3 color1;","uniform float noise;","uniform int style;","varying vec2 ndc;","float rand(vec2 co) {","float dt = dot(co.xy ,vec2(12.9898, 78.233));","float sn = mod(dt, 3.14);","return fract(sin(sn) * 43758.5453);","}","void main() {"," float f = style == 0 ? 0.0 : (style == 1 ? ndc.y * 0.5 + 0.5 : length(ndc) * 0.707);"," gl_FragColor = vec4(mix(color0, color1, f) + noise * rand(ndc), 1.0);","}"].join("\n")}set style(e){this.uniforms.style.value=e}get style(){return this.uniforms.style.value}set color0(e){if(e instanceof u.I){const t=this.uniforms.color0.value;t.x=e.r,t.y=e.g,t.z=e.b}else this.uniforms.color0.value.copy(e)}get color0(){return this.uniforms.color0.value}set color1(e){if(e instanceof u.I){const t=this.uniforms.color1.value;t.x=e.r,t.y=e.g,t.z=e.b}else this.uniforms.color1.value.copy(e)}get color1(){return this.uniforms.color1.value}set noise(e){this.uniforms.noise.value=e}get noise(){return this.uniforms.noise.value}}class g extends i.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(g.backgroundIns),this.object3D=new p}get background(){return this.object3D}update(e){super.update(e);const t=this.ins,n=this.background.material;return t.style.changed&&(n.style=t.style.getValidatedValue()),t.color0.changed&&n.color0.fromArray(t.color0.value),t.color1.changed&&n.color1.fromArray(t.color1.value),t.noise.changed&&(n.noise=t.noise.value),!0}dispose(){this.background.dispose(),super.dispose()}}g.typeName="CBackground",g.backgroundIns={style:i.V5.Enum("Background.Style",h,h.RadialGradient),color0:i.V5.ColorRGB("Background.Color0",[.2,.25,.3]),color1:i.V5.ColorRGB("Background.Color1",[.01,.03,.05]),noise:i.V5.Number("Background.Noise",{min:0,max:1,bar:!0,preset:.02})}},76288:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(77656),s=n(80038),r=n(16967);class o extends r.Z{constructor(e,t){super(e,t),this.ins=this.addInputs(o.dirLightIns),this.object3D=new i.O,this.light.target.matrixAutoUpdate=!1}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;if((n.color.changed||n.intensity.changed)&&(t.intensity=n.intensity.value*Math.PI),(n.position.changed||n.target.changed)&&(t.position.fromArray(n.position.value),t.target.position.fromArray(n.target.value),t.updateMatrix(),t.target.updateMatrix()),n.shadowSize.changed){const e=t.shadow.camera,i=.5*n.shadowSize.value;e.left=e.bottom=-i,e.right=e.top=i,e.near=.05*n.shadowSize.value,e.far=50*n.shadowSize.value,e.updateProjectionMatrix()}return!0}onAddToParent(e){super.onAddToParent(e),e.add(this.light.target)}onRemoveFromParent(e){super.onRemoveFromParent(e),e.remove(this.light.target)}}o.typeName="CDirectionalLight",o.dirLightIns={position:s.V5.Vector3("Light.Position"),target:s.V5.Vector3("Light.Target",[0,-1,0]),shadowSize:s.V5.Number("Shadow.Size",100)}},38080:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(80038);class s extends i.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(s.ins),this.outs=this.addOutputs(s.outs),this._fullscreenElement=null,this.onFullscreenChange=this.onFullscreenChange.bind(this);const n=document.documentElement,i=n.requestFullscreen||n.mozRequestFullScreen||n.webkitRequestFullscreen;this.outs.fullscreenAvailable.setValue(!!i),this.ins.toggle.on("value",this.toggle,this)}get fullscreenElement(){return this._fullscreenElement}set fullscreenElement(e){e!==this._fullscreenElement&&(this._fullscreenElement&&this._fullscreenElement.removeEventListener("fullscreenchange",this.onFullscreenChange),this._fullscreenElement=e,e&&e.addEventListener("fullscreenchange",this.onFullscreenChange))}update(e){return!0}toggle(){const e=this.outs,t=this._fullscreenElement;if(t){const n=e.fullscreenActive.value;if(!n&&e.fullscreenAvailable.value)t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);else if(n){const e=document;e.exitFullscreen?e.exitFullscreen():e.cancelFullScreen?e.cancelFullScreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()}}}onFullscreenChange(e){const t=document,n=t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement;this.outs.fullscreenActive.setValue(!!n)}}s.typeName="CFullscreen",s.ins={toggle:i.V5.Event("Fullscreen.Toggle")},s.outs={fullscreenAvailable:i.V5.Boolean("Fullscreen.Available",!1),fullscreenActive:i.V5.Boolean("Fullscreen.Active",!1)}},16967:(e,t,n)=>{"use strict";n.d(t,{B:()=>i,Z:()=>a});var i,s=n(80038),r=n(2837);!function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High"}(i||(i={}));const o={[i.Low]:512,[i.Medium]:1024,[i.High]:2048};class a extends r.ZP{constructor(){super(...arguments),this.ins=this.addInputs(a.lightIns)}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;if((n.color.changed||n.intensity.changed)&&(t.color.fromArray(n.color.value),t.intensity=n.intensity.value),"shadow"in t&&(n.shadowEnabled.changed&&(t.castShadow=n.shadowEnabled.value),n.shadowBlur.changed&&(t.shadow.radius=n.shadowBlur.value),n.shadowResolution.changed)){const e=o[n.shadowResolution.getValidatedValue()];t.shadow.mapSize.set(e,e),t.shadow.map=null}return!0}}a.typeName="CLight",a.lightIns={color:s.V5.ColorRGB("Light.Color"),intensity:s.V5.Number("Light.Intensity",1),shadowEnabled:s.V5.Boolean("Shadow.Enabled"),shadowResolution:s.V5.Enum("Shadow.Resolution",i,i.Medium),shadowBlur:s.V5.Number("Shadow.Blur",1)}},2837:(e,t,n)=>{"use strict";n.d(t,{V5:()=>r.V5,VZ:()=>l.VZ,ZP:()=>h});var i=n(19588),s=n(71050),r=n(80038),o=n(26060),a=n(36283),l=n(92642);const c=new i.P;class h extends r.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(h.object3DIns),this.outs=this.addOutputs(h.object3DOuts),this._object3D=null,this._isPickable=!1,this.addEvent("object"),this.node.components.on(this.parentComponentClass,this._onParent,this)}get parentComponentClass(){return this.constructor.parentComponentClass}get parentComponent(){return this.node.components.get(this.parentComponentClass,!0)}get transform(){return this.node.components.get(l.ZP,!0)}get scene(){const e=this.transform;return e?e.getParentComponent(a.Z,!0):void 0}get object3D(){return this._object3D}set object3D(e){const t=this._object3D;if(t&&(t.userData.component=null,this.unregisterPickableObject3D(t,!0),t.parent&&this.onRemoveFromParent(t.parent)),this.emit({type:"object",current:t,next:e}),this._object3D=e,e){e.userData.component=this,e.matrixAutoUpdate=!1,e.visible=this.ins.visible.value,this.registerPickableObject3D(e,!0);const t=this.parentComponent;t&&this.onAddToParent(t.object3D)}}update(e){const{visible:t,pickable:n}=this.ins;return t.changed&&this._object3D&&(this._object3D.visible=t.value),n.changed&&n.value!==this._isPickable&&(this._isPickable=n.value,n.value?this.enablePointerEvents():this.disablePointerEvents()),!0}dispose(){this.object3D=null,this.ins.pickable.value&&this.disablePointerEvents(),this.node.components.off(this.parentComponentClass,this._onParent,this),super.dispose()}preRender(e){}postRender(e){}toString(){return super.toString()+(this._object3D?` - type: ${this._object3D.type}`:" - (null)")}onPointer(e){const t=this.outs;"pointer-down"===e.type?(t.pointerDown.set(),t.pointerActive.setValue(!0)):"pointer-up"===e.type&&(t.pointerUp.set(),t.pointerActive.setValue(!1)),e.stopPropagation=!0}enablePointerEvents(){this.on("pointer-down",this.onPointer,this),this.on("pointer-up",this.onPointer,this)}disablePointerEvents(){this.off("pointer-down",this.onPointer,this),this.off("pointer-up",this.onPointer,this);const e=this.outs;e.pointerActive.value&&(e.pointerUp.set(),e.pointerActive.setValue(!1))}updateTransform(){const e=this._object3D;if(!e)return;const{position:t,rotation:n,order:i,scale:r}=this.ins;if(t.changed||n.changed||i.changed||r.changed){e.position.fromArray(t.value),c.fromArray(n.value).multiplyScalar(s.M8.DEG2RAD);const o=i.getOptionText();e.rotation.setFromVector3(c,o),e.scale.fromArray(r.value),e.updateMatrix()}return!0}onAddToParent(e){e.add(this._object3D)}onRemoveFromParent(e){e.remove(this._object3D)}addObject3D(e){this._object3D.add(e),this.registerPickableObject3D(e,!0)}removeObject3D(e){this.unregisterPickableObject3D(e,!0),this._object3D.remove(e)}registerPickableObject3D(e,t){o.Z.add(e,t)}unregisterPickableObject3D(e,t){o.Z.remove(e,t)}_onParent(e){this._object3D&&!this._object3D.parent&&e.add&&this.onAddToParent(e.object.object3D)}}h.typeName="CObject3D",h.parentComponentClass=l.ZP,h.object3DIns={visible:r.V5.Boolean("Object.Visible",!0),pickable:r.V5.Boolean("Object.Pickable")},h.object3DOuts={pointerDown:r.V5.Event("Pointer.Down"),pointerUp:r.V5.Event("Pointer.Up"),pointerActive:r.V5.Boolean("Pointer.Active")},h.transformIns=l.ZP.transformIns,h.prototype.preRender=null,h.prototype.postRender=null},18345:(e,t,n)=>{"use strict";n.d(t,{Z:()=>W});var i=n(80038),s=n(52226),r=n(67171),o=n(19588),a=n(82587),l=n(28092),c=n(37840),h=n(75809),d=n(35322),u=n(64026),p=n(93113),m=n(79961);const f=new o.P,g=new a.y;class v extends l.e{constructor(e,t){t=Object.assign({},v.defaultProps,t);const n=new c.Z;n.makeEmpty(),(0,m.sN)(e,n);const i=t.length,s=[n.min.x,n.min.y,n.min.z],r=[n.max.x,n.max.y,n.max.z],o=[(r[0]-s[0])*i,(r[1]-s[1])*i,(r[2]-s[2])*i];let a;a=isFinite(o[0])&&isFinite(o[1])&&isFinite(o[2])?[s[0],s[1],s[2],s[0]+o[0],s[1],s[2],s[0],s[1],s[2],s[0],s[1]+o[1],s[2],s[0],s[1],s[2],s[0],s[1],s[2]+o[2],r[0],s[1],s[2],r[0]-o[0],s[1],s[2],r[0],s[1],s[2],r[0],s[1]+o[1],s[2],r[0],s[1],s[2],r[0],s[1],s[2]+o[2],s[0],r[1],s[2],s[0]+o[0],r[1],s[2],s[0],r[1],s[2],s[0],r[1]-o[1],s[2],s[0],r[1],s[2],s[0],r[1],s[2]+o[2],s[0],s[1],r[2],s[0]+o[0],s[1],r[2],s[0],s[1],r[2],s[0],s[1]+o[1],r[2],s[0],s[1],r[2],s[0],s[1],r[2]-o[2],s[0],r[1],r[2],s[0]+o[0],r[1],r[2],s[0],r[1],r[2],s[0],r[1]-o[1],r[2],s[0],r[1],r[2],s[0],r[1],r[2]-o[2],r[0],s[1],r[2],r[0]-o[0],s[1],r[2],r[0],s[1],r[2],r[0],s[1]+o[1],r[2],r[0],s[1],r[2],r[0],s[1],r[2]-o[2],r[0],r[1],s[2],r[0]-o[0],r[1],s[2],r[0],r[1],s[2],r[0],r[1]-o[1],s[2],r[0],r[1],s[2],r[0],r[1],s[2]+o[2],r[0],r[1],r[2],r[0]-o[0],r[1],r[2],r[0],r[1],r[2],r[0],r[1]-o[1],r[2],r[0],r[1],r[2],r[0],r[1],r[2]-o[2]]:[-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1,0,0,1];const l=new h.u;l.setAttribute("position",new d.a$(a,3));super(l,new u.n({color:t.color,depthTest:!1})),this.renderOrder=1,this.onBeforeRender=()=>{e.updateMatrixWorld(!1),this.matrixWorld.copy(e.matrixWorld)}}dispose(){this.parent&&this.parent.remove(this),this.geometry.dispose()}static expandBoundingBox(e,t,n){const i=e.geometry;if(void 0!==i){let s=e;for(g.identity();s&&s!==t;)g.premultiply(s.matrix),s=s.parent;if(i.isGeometry){const e=i.vertices;for(let t=0,i=e.length;t0)&&m.push(t,s,a),(e!==n-1||l.9&&o<.1&&(t<.2&&(r[e+0]+=1),n<.2&&(r[e+2]+=1),i<.2&&(r[e+4]+=1))}}()}(),this.setAttribute("position",new d.a$(s,3)),this.setAttribute("normal",new d.a$(s.slice(),3)),this.setAttribute("uv",new d.a$(r,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new k(e.vertices,e.indices,e.radius,e.details)}}class V extends k{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new V(e.radius,e.detail)}}const z=new o.P,F=new p.I,B=new p.I;class $ extends x.T{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new V(t);i.rotateY(.5*Math.PI),this.material=new P.v({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),r=new Float32Array(3*s.count);i.setAttribute("color",new d.Tl(r,3)),this.add(new A.K(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");F.copy(this.light.color),B.copy(this.light.groundColor);for(let e=0,n=t.count;e{e.on("after-render",this.onSceneAfterRender,this)}),(e=>{e.off("after-render",this.onSceneAfterRender,this)}))}dispose(){this._sceneTracker.dispose(),this.system.off("pointer-up",this.onPointerUp,this),this._sceneTracker.dispose(),super.dispose()}update(){return!0}onSelectNode(e,t){super.onSelectNode(e,t);const n=e.getComponent(b.ZP,!0);n&&this.updateBracket(n,t)}onSelectComponent(e,t){super.onSelectComponent(e,t),(e instanceof y.ZP||e instanceof b.ZP)&&this.updateBracket(e,t)}onPointerUp(e){this.ins.viewportPicking.value&&e.isPrimary&&!e.isDragging&&(e.component?this.selectComponent(e.component,e.ctrlKey):e.ctrlKey||this.clearSelection())}onSceneAfterRender(e){if(!this.ins.viewportBrackets.value)return;const t=e.context.renderer,n=e.context.camera;for(let e of this._brackets.values())G.some((([t])=>e instanceof t))&&(e.update(),e.updateWorldMatrix(!0,!1)),t.render(e,n)}updateBracket(e,t){if(e){if(t){const t=e.object3D;if(t){let n;for(let[e,i]of G)t.children[0]instanceof i&&(n=new e(t.children[0],1),n.updateWorldMatrix(!0,!1));n||(n=new v(e.object3D)),this._brackets.set(e,n)}}else{const t=this._brackets.get(e);t&&(this._brackets.delete(e),t.dispose())}this.changed=!0}}}W.typeName="CPickSelection"},15271:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var i,s=n(75544),r=n(80038),o=n(26220);!function(e){e[e.Basic=0]="Basic",e[e.PCF=1]="PCF",e[e.PCFSoft=2]="PCFSoft"}(i||(i={}));const a={[i.Basic]:s._MY,[i.PCF]:s._iA,[i.PCFSoft]:s.ntZ};class l extends r.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(l.ins),this.outs=this.addOutputs(l.outs),this.views=[],this._activeSceneComponent=null,this._forceRender=!1,this.addEvents("active-scene","active-camera")}get activeSceneComponent(){return this._activeSceneComponent}set activeSceneComponent(e){if(e!==this._activeSceneComponent){const t=this._activeSceneComponent,n=this.activeCameraComponent;t&&t.off("active-camera",this.onActiveCamera,this),e&&e.on("active-camera",this.onActiveCamera,this),this._activeSceneComponent=e;const i=this.activeCameraComponent,s={type:"active-scene",previous:t,next:e};this.emit(s);const r={type:"active-camera",previous:n,next:i};this.emit(r)}}get activeSceneGraph(){return this._activeSceneComponent?this._activeSceneComponent.graph:null}get activeScene(){return this._activeSceneComponent?this._activeSceneComponent.scene:null}get activeCameraComponent(){return this._activeSceneComponent?this._activeSceneComponent.activeCameraComponent:null}get activeCamera(){const e=this._activeSceneComponent?this._activeSceneComponent.activeCameraComponent:null;return e?e.camera:null}forceRender(){this._forceRender=!0}create(){super.create(),this.trackComponent(o.Z,(e=>{e.on("pulse",this.onPulse,this)}),(e=>{e.off("pulse",this.onPulse,this)}))}update(){const e=this.ins;return e.exposure.changed&&this.views.forEach((t=>t.renderer.toneMappingExposure=e.exposure.value)),e.gamma.changed,e.shadowsEnabled.changed&&this.views.forEach((t=>t.renderer.shadowMap.enabled=e.shadowsEnabled.value)),e.shadowMapType.changed&&this.views.forEach((t=>t.renderer.shadowMap.type=a[e.shadowMapType.getValidatedValue()])),!0}attachView(e){if(0===this.views.length){const t=e.renderer,n=this.outs;n.maxTextureSize.setValue(t.capabilities.maxTextureSize),n.maxCubemapSize.setValue(t.capabilities.maxCubemapSize)}this.views.push(e)}detachView(e){const t=this.views.indexOf(e);if(t<0)throw new Error("render view not registered");this.views.splice(t,1)}logInfo(){this.views.forEach((e=>{console.log(e.renderer.info)}))}onPulse(e){(e.systemUpdated||this._forceRender)&&(this.views.forEach((e=>{e.renderer.xr.isPresenting||e.render()})),this._forceRender=!1)}onActiveCamera(e){this.emit(e)}}l.typeName="CRenderer",l.isSystemSingleton=!0,l.ins={exposure:r.V5.Number("Shading.Exposure",1),gamma:r.V5.Number("Shading.Gamma",2),shadowsEnabled:r.V5.Boolean("Shadows.Enabled",!0),shadowMapType:r.V5.Enum("Shadows.MapType",i,i.PCF)},l.outs={maxTextureSize:r.V5.Integer("Caps.MaxTextureSize"),maxCubemapSize:r.V5.Integer("Caps.MaxCubemapSize")}},36283:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var i=n(64702),s=n(80038),r=n(15271),o=n(92642);const a={view:null,viewport:null,renderer:null,scene:null,camera:null},l={type:"before-render",component:null,context:a},c={type:"after-render",component:null,context:a},h={activate:s.V5.Event("Scene.Activate")};class d extends o.ZP{constructor(e,t){super(e,t),this._activeCameraComponent=null,this._preRenderList=[],this._postRenderList=[],this._renderListsNeedUpdate=!0,this.ins=this.addInputs(h,0),this.addEvents("before-render","after-render","active-camera")}get scene(){return this.object3D}get activeCameraComponent(){return this._activeCameraComponent}set activeCameraComponent(e){if(e!==this._activeCameraComponent){const t=this._activeCameraComponent;this._activeCameraComponent=e;const n={type:"active-camera",previous:t,next:e};this.emit(n)}}get activeCamera(){return this._activeCameraComponent?this._activeCameraComponent.camera:null}get renderer(){return this.getMainComponent(r.Z)}create(){super.create(),this.on("hierarchy",this.shouldUpdateRenderLists,this),this.on("child",this.shouldUpdateRenderLists,this);const e=this.renderer;e&&!e.activeSceneComponent&&(e.activeSceneComponent=this)}update(e){if(super.update(e),this.ins.activate.changed){const e=this.renderer;e&&(e.activeSceneComponent=this)}return!0}tick(e){return this._renderListsNeedUpdate&&(this.updateRenderLists(),this._renderListsNeedUpdate=!1),!1}dispose(){const e=this.renderer;e&&e.activeSceneComponent===this&&(e.activeSceneComponent=null),this.off("hierarchy",this.shouldUpdateRenderLists,this),this.off("child",this.shouldUpdateRenderLists,this),super.dispose()}preRender(e){const t=this._preRenderList;for(let n=0,i=t.length;n(e.preRender&&this._preRenderList.push(e),e.postRender&&this._postRenderList.push(e),!1))),this.changed=!0}_onBeforeRender(e,t,n){a.view=e.__view,a.viewport=e.__viewport,a.renderer=e,a.scene=t,a.camera=n,this.preRender(a),l.component=this,this.emit(l)}_onAfterRender(e,t,n){a.view=e.__view,a.viewport=e.__viewport,a.renderer=e,a.scene=t,a.camera=n,this.postRender(a),c.component=this,this.emit(c)}}d.typeName="CScene",d.isGraphSingleton=!0},92642:(e,t,n)=>{"use strict";n.d(t,{VZ:()=>m,ZP:()=>f});var i=n(19588),s=n(78943),r=n(82954),o=n(25499),a=n(28581),l=n(80038),c=n(3474);const h=new i.P,d=new i.P,u=new s._,p=new r.U;var m;!function(e){e[e.XYZ=0]="XYZ",e[e.YZX=1]="YZX",e[e.ZXY=2]="ZXY",e[e.XZY=3]="XZY",e[e.YXZ=4]="YXZ",e[e.ZYX=5]="ZYX"}(m||(m={}));class f extends c.Z{constructor(e,t){super(e,t),this.ins=this.addInputs(f.transformIns),this.outs=this.addOutputs(f.transformOuts),this._object3D=this.createObject3D(),this._object3D.matrixAutoUpdate=!1}get transform(){return this}get object3D(){return this._object3D}get children(){return this._children||[]}get matrix(){return this._object3D.matrix}update(e){const t=this._object3D,{position:n,rotation:i,order:s,scale:r}=this.ins,{matrix:o}=this.outs;t.position.fromArray(n.value),h.fromArray(i.value).multiplyScalar(a.Z.DEG2RAD);const l=s.getOptionText();return t.rotation.setFromVector3(h,l),t.scale.fromArray(r.value),t.updateMatrix(),t.matrix.toArray(o.value),o.set(),!0}dispose(){this._object3D&&(this._object3D.children.slice().forEach((e=>this._object3D.remove(e))),this._object3D.parent&&this._object3D.parent.remove(this._object3D)),super.dispose()}setPropertiesFromMatrix(e){const t=!e;e=e||this._object3D.matrix;const{position:n,rotation:i,order:s,scale:r}=this.ins;e.decompose(h,u,d),h.toArray(n.value);const o=s.getOptionText();p.setFromQuaternion(u,o),h.setFromEuler(p),h.multiplyScalar(a.Z.RAD2DEG).toArray(i.value),d.toArray(r.value),n.set(t),i.set(t),r.set(t)}addChild(e){super.addChild(e),this._object3D.add(e._object3D)}removeChild(e){this._object3D.remove(e._object3D),super.removeChild(e)}createObject3D(){return new o.T}}f.typeName="CTransform",f.transformIns={position:l.V5.Vector3("Transform.Position"),rotation:l.V5.Vector3("Transform.Rotation"),order:l.V5.Enum("Transform.Order",m),scale:l.V5.Scale3("Transform.Scale")},f.transformOuts={matrix:l.V5.Matrix4("Transform.Matrix")}},67695:(e,t,n)=>{"use strict";n.d(t,{Mo:()=>i.Mo,ZP:()=>r,dy:()=>i.dy});n(56166);var i=n(51120),s=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class r extends i.ZP{constructor(e){super(),this.system=e}}s([(0,i.Cb)({attribute:!1})],r.prototype,"system",void 0)},28097:(e,t,n)=>{"use strict";n.d(t,{Z:()=>M});var i=n(82587),s=n(37840),r=n(19588),o=n(28581),a=n(84538),l=n(82954),c=n(78943);const h=new a.L,d=(new a.L,new r.P),u=new r.P,p=new i.y,m=new l.U,f=new c._,g={PI:3.141592653589793,DOUBLE_PI:6.283185307179586,HALF_PI:1.5707963267948966,QUARTER_PI:.7853981633974483,DEG2RAD:.017453292519943295,RAD2DEG:57.29577951308232,composeOrbitMatrix:function(e,t,n){const s=e.x,r=e.y,o=e.z,a=t.x,l=t.y,c=t.z,h=Math.sin(s),d=Math.cos(s),u=Math.sin(r),p=Math.cos(r),m=Math.sin(o),f=Math.cos(o),g=p*f,v=f*u*h-m*d,y=f*u*d+m*h,b=p*m,_=h*u*m+f*d,x=m*u*d-f*h,w=-u,S=p*h,M=p*d,E=(n=n||new i.y).elements;return E[0]=g,E[1]=b,E[2]=w,E[3]=0,E[4]=v,E[5]=_,E[6]=S,E[7]=0,E[8]=y,E[9]=x,E[10]=M,E[11]=0,E[12]=a*g+l*v+c*y,E[13]=a*b+l*_+c*x,E[14]=a*w+l*S+c*M,E[15]=1,n},decomposeOrbitMatrix:function(e,t,n){m.setFromRotationMatrix(e,"ZYX"),t.setFromEuler(m),p.copy(e).invert(),h.set(0,0,0,1),h.applyMatrix4(p),n.x=-h.x,n.y=-h.y,n.z=-h.z},isMatrix4Identity:function(e){const t=e.elements;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]},decomposeTransformMatrix:function(e,t,n,i){p.fromArray(e),p.decompose(d,f,u),m.setFromQuaternion(f,"XYZ"),d.toArray(t),u.toArray(i),d.setFromEuler(m),h.multiplyScalar(o.Z.RAD2DEG),d.toArray(n)}},v=new i.y,y=new s.Z,b=new r.P,_=new r.P;var x,w,S;!function(e){e[e.Orbit=0]="Orbit",e[e.FirstPerson=1]="FirstPerson"}(x||(x={})),function(e){e[e.Off=0]="Off",e[e.Pan=1]="Pan",e[e.Orbit=2]="Orbit",e[e.Dolly=3]="Dolly",e[e.Zoom=4]="Zoom",e[e.PanDolly=5]="PanDolly",e[e.Roll=6]="Roll"}(w||(w={})),function(e){e[e.Off=0]="Off",e[e.Active=1]="Active",e[e.Release=2]="Release"}(S||(S={}));class M{constructor(e){this.orbit=new r.P(0,0,0),this.offset=new r.P(0,0,50),this.minOrbit=new r.P(-90,-1/0,-1/0),this.maxOrbit=new r.P(90,1/0,1/0),this.minOffset=new r.P(-1/0,-1/0,.1),this.maxOffset=new r.P(1/0,1/0,1e3),this.orientationEnabled=!0,this.offsetEnabled=!0,this.mode=w.Off,this.phase=S.Off,this.prevPinchDist=0,this.deltaX=0,this.deltaY=0,this.deltaPinch=0,this.deltaWheel=0,this.viewportWidth=100,this.viewportHeight=100,this.camera=e}onPointer(e){if(e.isPrimary)if("pointer-down"===e.type)this.phase=S.Active;else if("pointer-up"===e.type)return this.phase=S.Release,!0;"pointer-down"===e.type&&(this.mode=this.getModeFromEvent(e));if(this.deltaX+=1*e.movementX,this.deltaY+=1*e.movementY,2===e.pointerCount){const t=e.activePositions,n=t[1].clientX-t[0].clientX,i=t[1].clientY-t[0].clientY,s=Math.sqrt(n*n+i*i),r=this.prevPinchDist||s;this.deltaPinch*=r>0?s/r:1,this.prevPinchDist=s}else this.deltaPinch=1,this.prevPinchDist=0;return!0}onTrigger(e){return"wheel"===e.type&&(this.deltaWheel+=o.Z.limit(e.wheel,-1,1),!0)}onKeypress(e){if("ArrowUp"===e.key||"ArrowDown"===e.key){const t="ArrowUp"===e.key?-1:1;return this.deltaY=20*t,this.mode=e.shiftKey?w.Pan:e.ctrlKey?w.Dolly:w.Orbit,!0}if("ArrowLeft"===e.key||"ArrowRight"===e.key){const t="ArrowLeft"===e.key?-1:1;return this.deltaX=20*t,this.mode=e.shiftKey?w.Pan:w.Orbit,!0}return!1}setViewportSize(e,t){this.viewportWidth=e,this.viewportHeight=t}updateController(e,t){const n=this.camera;e=e||n;const i=this.orbit,s=this.offset;g.decomposeOrbitMatrix(e.matrix,i,s),this.orbit.multiplyScalar(g.RAD2DEG),t&&(this.minOffset.min(s),this.maxOffset.max(s))}zoomExtents(e){const t=this.camera,n=this.offset;if(!t)return void console.warn("CameraController.zoomExtents - camera not set");b.copy(this.orbit).multiplyScalar(o.Z.DEG2RAD),_.setScalar(0),g.composeOrbitMatrix(b,_,v),y.copy(e).applyMatrix4(v.transpose()),y.getSize(b),y.getCenter(_),n.x=_.x,n.y=_.y;const i=Math.max(b.x/t.aspect,b.y);if(t.isOrthographicCamera)n.z=1.1*i;else{const e=1/(2*Math.tan(t.fov*o.Z.DEG2RAD*.5));n.z=_.z+i*e+.25*b.z}n.z>this.maxOffset.z&&(this.maxOffset.z=2*n.length())}updateCamera(e,t){const n=this.camera;return e=e||n,!(!this.update()&&!t)&&(b.copy(this.orbit).multiplyScalar(o.Z.DEG2RAD),_.copy(this.offset),n.isOrthographicCamera&&(_.z=this.maxOffset.z,n.size=this.offset.z,n.far=2*this.maxOffset.z,n.updateProjectionMatrix()),g.composeOrbitMatrix(b,_,e.matrix),e.matrixWorldNeedsUpdate=!0,!0)}update(){if(this.phase===S.Off&&0===this.deltaWheel&&0===this.deltaX&&0===this.deltaY)return!1;if(0!==this.deltaWheel)return this.updatePose(0,0,.07*this.deltaWheel+1,0,0,0),this.deltaWheel=0,!0;if(this.phase===S.Active)return(0!==this.deltaX||0!==this.deltaY||1!==this.deltaPinch)&&(this.updateByMode(),this.deltaX=0,this.deltaY=0,this.deltaPinch=1,!0);if(this.phase===S.Release){this.deltaX*=.85,this.deltaY*=.85,this.deltaPinch=1,this.updateByMode();return Math.abs(this.deltaX)+Math.abs(this.deltaY)<.1&&(this.mode=w.Off,this.phase=S.Off),!0}return(0!==this.deltaX||0!==this.deltaY)&&(this.updateByMode(),this.deltaX=0,this.deltaY=0,this.mode=w.Off,!0)}updateByMode(){switch(this.mode){case w.Orbit:this.updatePose(0,0,1,this.deltaY,this.deltaX,0);break;case w.Pan:this.updatePose(this.deltaX,this.deltaY,1,0,0,0);break;case w.Roll:this.updatePose(0,0,1,0,0,this.deltaX);break;case w.Dolly:this.updatePose(0,0,.0075*this.deltaY+1,0,0,0);break;case w.PanDolly:const e=.42*(this.deltaPinch-1)+1;this.updatePose(.75*this.deltaX,.75*this.deltaY,1/e,0,0,0)}}updatePose(e,t,n,i,s,r){const{orbit:a,minOrbit:l,maxOrbit:c,offset:h,minOffset:d,maxOffset:u}=this;if(this.orientationEnabled&&(a.x+=-1*i*220/this.viewportHeight,a.y+=-1*s*220/this.viewportHeight,a.z+=-1*r*220/this.viewportHeight,a.x=o.Z.limit(a.x,l.x,c.x),a.y=o.Z.limit(a.y,l.y,c.y),a.z=o.Z.limit(a.z,l.z,c.z)),this.offsetEnabled){const i=h.z=n*h.z;h.x+=e*i*-1/this.viewportHeight,h.y-=t*i*-1/this.viewportHeight,h.x=o.Z.limit(h.x,d.x,u.x),h.y=o.Z.limit(h.y,d.y,u.y),h.z=o.Z.limit(h.z,d.z,u.z)}}getModeFromEvent(e){if("mouse"===e.source){const t=e.originalEvent.button;if(0===t)return e.ctrlKey?w.Pan:e.altKey?w.Dolly:w.Orbit;if(2===t)return e.altKey?w.Roll:w.Pan;if(1===t)return w.Dolly}else if("touch"===e.source){const t=e.pointerCount;return 1===t?w.Orbit:2===t?w.PanDolly:w.Pan}}}},26060:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var i=n(19588),s=n(93113),r=n(37840),o=n(46953),a=n(44428);class l extends a.j{constructor(){super(...arguments),this.isIndexShader=!0,this.uniformsNeedUpdate=!1,this.lights=!1,this.uniforms={index:{value:[0,0,0]}},this.vertexShader=["void main() {"," #include "," #include ","}"].join("\n"),this.fragmentShader=["uniform vec3 index;","void main() {"," gl_FragColor = vec4(index, 1.0);","}"].join("\n")}static indexFromPixel(e){return e[0]+e[1]<<8+e[2]<<16}static zoneFromPixel(e){return e[3]}setIndex(e){const t=e>>16,n=(e>>8)-(t<<8),i=e-(t<<16)-(n<<8),s=this.uniforms.index.value;s[0]=i/255,s[1]=n/255,s[2]=t/255,this.uniformsNeedUpdate=!0}}class c extends a.j{constructor(){super(...arguments),this.isPositionShader=!0,this.uniforms={index:{value:0},range:{value:[-1,1]}},this.vertexShader=["varying vec3 vLocalPosition;","void main() {"," #include "," #include "," vLocalPosition = vec3(position);","}"].join("\n"),this.fragmentShader=["uniform float index;","uniform vec2 range;","varying vec3 vLocalPosition;","vec4 toVec4(float v) {"," float vn = (v - range.x) / (range.y - range.x);"," float b0 = floor(vn * 255.0) / 255.0; vn = (vn - b0) * 256.0;"," float b1 = floor(vn * 255.0) / 255.0; vn = (vn - b1) * 256.0;"," float b2 = floor(vn * 255.0) / 255.0; vn = (vn - b2) * 256.0;"," float b3 = floor(vn * 255.0) / 255.0;"," return vec4(clamp(b0, 0.0, 1.0), clamp(b1, 0.0, 1.0), clamp(b2, 0.0, 1.0), clamp(b3, 0.0, 1.0));","}","void main() {"," gl_FragColor = (index == 0.0 ? toVec4(vLocalPosition.x)"," : (index == 1.0 ? toVec4(vLocalPosition.y) : toVec4(vLocalPosition.z)));","}"].join("\n")}}class h extends a.j{constructor(){super(...arguments),this.isNormalShader=!0,this.uniforms={index:{value:0}},this.vertexShader=["varying vec3 vLocalNormal;","void main() {"," #include "," #include "," #include "," vLocalNormal = vec3(normal);","}"].join("\n"),this.fragmentShader=["uniform vec3 index;","varying vec3 vLocalNormal;","void main() {"," vec3 normal = normalize(vLocalNormal);"," gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);","}"].join("\n")}}const d=new i.P,u=new s.I,p=1e4,m=new r.Z(new i.P(-1e4,-1e4,-1e4),new i.P(p,p,p));class f{constructor(e){this.renderer=e,this.pickTextures=[];for(let e=0;e<3;++e)this.pickTextures[e]=new o.d(1,1,{stencilBuffer:!1});this.pickBuffer=new Uint8Array(4),this.indexShader=new l,this.positionShader=new c,this.normalShader=new h}static add(e,t){const n=e=>{e.material&&(e.onBeforeRender=function(t,n,i,s,r){r.isIndexShader&&r.setIndex(e.id)},e.onAfterRender=function(e,t,n,i,s){s.isIndexShader&&s.setIndex(0)})};t?e.traverse((e=>n(e))):n(e)}static remove(e,t){const n=e=>{e.material&&(e.onBeforeRender=null,e.onAfterRender=null)};t?e.traverse((e=>n(e))):n(e)}pickObject(e,t,n){const i=this.pickIndex(e,t,n);if(i>0)return e.getObjectById(i)}pickIndex(e,t,n){const i=n.viewport;(t=i.updateCamera(t)).layers.disable(1);const s=e.overrideMaterial;e.overrideMaterial=this.indexShader;const r=this.renderer,o=this.pickTextures[0];r.getClearColor(u),i.applyPickViewport(o,n),r.setRenderTarget(o),r.setClearColor(0);const a=r.xr.enabled;r.xr.enabled=!1,r.clear(),r.render(e,t),r.xr.enabled=a,r.setRenderTarget(null),r.setClearColor(u),e.overrideMaterial=s,t.layers.enable(1);const l=this.pickBuffer;return r.readRenderTargetPixels(o,0,0,1,1,l),l[0]+256*l[1]+65536*l[2]}pickPosition(e,t,n,s,r){s=s||m,r=r||new i.P;const o=n.viewport;(t=o.updateCamera(t)).layers.disable(1);const a=e.overrideMaterial,l=e.overrideMaterial=this.positionShader,c=this.renderer,h=this.pickTextures;c.getClearColor(u),c.setClearColor(0);for(let i=0;i<3;++i)l.uniforms.index.value=i,l.uniforms.range.value[0]=s.min.getComponent(i),l.uniforms.range.value[1]=s.max.getComponent(i),o.applyPickViewport(h[i],n),c.setRenderTarget(h[i]),c.clear(),c.render(e,t);c.setRenderTarget(null),c.setClearColor(u),e.overrideMaterial=a,t.layers.enable(1);const p=this.pickBuffer;for(let e=0;e<3;++e)c.readRenderTargetPixels(h[e],0,0,1,1,p),r.setComponent(e,2.337437050015319e-10*p[3]+5.983838848039216e-8*p[2]+1531862745098039e-20*p[1]+.003921568627451*p[0]);return s.getSize(d),r.multiply(d).add(s.min)}pickNormal(e,t,n,s){s=s||new i.P;const r=n.viewport;(t=r.updateCamera(t)).layers.disable(1);const o=e.overrideMaterial;e.overrideMaterial=this.normalShader;const a=this.renderer,l=this.pickTextures[0];a.getClearColor(u),r.applyPickViewport(l,n),a.setRenderTarget(l),a.setClearColor(0),a.clear(),a.render(e,t),a.setRenderTarget(null),a.setClearColor(u),e.overrideMaterial=o,t.layers.enable(1);const c=this.pickBuffer;return a.readRenderTargetPixels(l,0,0,1,1,c),s.set(c[0]/255*2-1,c[1]/255*2-1,c[2]/255*2-1).normalize()}}},94608:(e,t,n)=>{"use strict";n.d(t,{KB:()=>g,ZP:()=>f,hf:()=>m});var i=n(19588),s=n(40693),r=n(25499),o=n(51120),a=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const l=new i.P,c=new i.P,h=new i.P,d=new i.P,u=new s.F,p=new s.F;var m;!function(e){e[e.TopRight=0]="TopRight",e[e.TopLeft=1]="TopLeft",e[e.BottomLeft=2]="BottomLeft",e[e.BottomRight=3]="BottomRight"}(m||(m={}));class f extends r.T{constructor(){super(),this.isHTMLSprite=!0,this.viewAngle=0,this.orientationAngle=0,this.orientationQuadrant=m.TopLeft,this._elements=new Map,this._visible=!0,this.frustumCulled=!1}getVisible(){return this._visible}setVisible(e){e!==this._visible&&this._elements&&(this._visible=e,this._elements.forEach((t=>{t&&t.setVisible(e)})))}dispose(){this._elements.forEach(((e,t)=>{e&&t.removeChild(e)})),this._elements.clear()}disposeHTMLElement(e){const t=this._elements.get(e);t&&(this._elements.delete(e),e.removeChild(t))}update(){this._elements.forEach((e=>{e&&this.updateHTMLElement(e)}))}renderHTMLElement(e,t,n,i,s){i=i||this,l.set(0,0,0),l.applyMatrix4(i.modelViewMatrix),s?c.copy(s):c.set(0,1,0),c.applyMatrix4(i.modelViewMatrix),h.copy(c).sub(l).normalize(),d.set(0,0,1),this.viewAngle=h.angleTo(d),l.applyMatrix4(n.projectionMatrix),c.applyMatrix4(n.projectionMatrix),p.set(c.x,c.y),u.set(l.x,l.y),p.sub(u);const r=.5*(c.x+1)*t.clientWidth,o=.5*(1-c.y)*t.clientHeight;e.setPosition(r,o);const a=this.orientationAngle=p.angle();this.orientationQuadrant=Math.floor(2*a/Math.PI)}getHTMLElement(e){let t=this._elements.get(e);return t||(t=this.createHTMLElement(),t&&(t.setVisible(this._visible),e.appendChild(t),this._elements.set(e,t))),t}createHTMLElement(){return null}updateHTMLElement(e){e.requestUpdate()}}let g=class extends o.ZP{setVisible(e){this.style.display=e?"block":"none"}setOpacity(e){this.style.opacity=e.toString(),this.style.visibility=e>0?"visible":"hidden"}setPosition(e,t){this.style.left=e.toString()+"px",this.style.top=t.toString()+"px"}};g=a([(0,o.Mo)("ff-sprite-element")],g)},28110:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(25499);n(94608);class s extends i.T{constructor(){super(...arguments),this.isHTMLSpriteGroup=!0,this._visible=!0}getVisible(){return this._visible}setVisible(e){if(e!==this._visible){this._visible=e;const t=this.children;for(let n=0,i=t.length;n{"use strict";n.d(t,{LY:()=>b,ZP:()=>_,mP:()=>y});var i=n(37840),s=n(19588),r=n(82587),o=n(68347),a=n(71050),l=n(67440),c=n(62257),h=n(28581);const d=.5*Math.PI,u=new i.Z,p=new s.P,m=new s.P,f=new s.P,g=new r.y,v=(new r.y,[new s.P(0,-d,0),new s.P(0,d,0),new s.P(-d,0,0),new s.P(d,0,0),new s.P(0,0,0),new s.P(0,Math.PI,0)]);var y,b;!function(e){e[e.Perspective=0]="Perspective",e[e.Orthographic=1]="Orthographic"}(y||(y={})),function(e){e[e.None=-1]="None",e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Top=2]="Top",e[e.Bottom=3]="Bottom",e[e.Front=4]="Front",e[e.Back=5]="Back"}(b||(b={}));class _ extends o.V{constructor(e){super(),this.isUniversalCamera=!0,this.fov=50,this.size=20,this.aspect=1,this.distance=20,this.zoom=1,this.near=.1,this.far=2e3,this.focus=10,this.filmGauge=35,this.filmOffset=0,this.view=null,this.setProjection(e)}setProjection(e){e===y.Orthographic?(this.type="OrthographicCamera",this.isPerspectiveCamera=!1,this.isOrthographicCamera=!0):(this.type="PerspectiveCamera",this.isPerspectiveCamera=!0,this.isOrthographicCamera=!1),this.updateProjectionMatrix()}getProjection(){return this.isOrthographicCamera?y.Orthographic:y.Perspective}setPreset(e){e!==b.None?(this.rotation.setFromVector3(v[e],"XYZ"),this.position.set(0,0,this.distance).applyQuaternion(this.quaternion)):(this.rotation.set(0,0,0),this.position.set(0,0,0)),this.updateMatrix()}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*a.M8.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*a.M8.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*a.M8.RAD2DEG*Math.atan(Math.tan(.5*a.M8.DEG2RAD*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,r){this.isPerspectiveCamera?l.c.prototype.setViewOffset.call(this,e,t,n,i,s,r):c.i.prototype.setViewOffset.call(this,e,t,n,i,s,r)}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}zoomToView(){}moveToView(e){this.updateMatrixWorld(!1),u.copy(e),g.extractRotation(this.matrixWorldInverse),u.applyMatrix4(g),u.getSize(p),u.getCenter(m);const t=Math.max(p.x/this.aspect,p.y);f.set(-m.x,-m.y,0),this.isPerspectiveCamera?f.z=p.z/(2*Math.tan(this.fov*h.Z.DEG2RAD*.5)):(this.size=.5*t,f.z=2*p.z,this.far=Math.max(this.far,2*f.z)),g.extractRotation(this.matrixWorld),f.applyMatrix4(g),this.matrix.decompose(this.position,this.quaternion,this.scale),this.position.copy(f),this.updateMatrix()}updateProjectionMatrix(){const e=this.near,t=this.far,n=this.aspect,i=this.zoom,s=this.view;if(this.isOrthographicCamera){const r=this.size,o=r/(2*i),a=o*n;let l=-a,c=a,h=o,d=-o;if(s&&s.enabled){const e=i/(s.width/s.fullWidth),t=i/(s.height/s.fullHeight),o=r*n/s.width,a=r/s.height;l+=o*(s.offsetX/e),c=l+o*(s.width/e),h-=a*(s.offsetY/t),d=h-a*(s.height/t)}this.projectionMatrix.makeOrthographic(l,c,h,d,e,t)}else{let o=e*Math.tan(.5*a.M8.DEG2RAD*this.fov)/i,l=2*o,c=n*l,h=-.5*c;s&&s.enabled&&(h+=s.offsetX*c/s.fullWidth,o-=s.offsetY*l/s.fullHeight,c*=s.width/s.fullWidth,l*=s.height/s.fullHeight);var r=this.filmOffset;0!==r&&(h+=e*r/this.getFilmWidth()),this.projectionMatrix.makePerspective(h,h+c,o,o-l,e,t)}this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}copy(e,t){return super.copy(e,t),this.type=e.type,this.isOrthographicCamera=e.isOrthographicCamera,this.isPerspectiveCamera=e.isPerspectiveCamera,this.fov=e.fov,this.size=e.size,this.aspect=e.aspect,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.view=e.view?Object.assign({},e.view):null,this}clone(){return(new this.constructor).copy(this)}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.size=this.size,t.object.aspect=this.aspect,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}},73902:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var i=n(40693),s=n(82942),r=n(26775),o=n(12197),a=n(28097);class l extends s.Z{constructor(e){super(),this.next=null,this._canvasWidth=1,this._canvasHeight=1,this._overlay=null,this._camera=null,this._controller=null,this.addEvent("dispose"),this.next=null,e=e||{},this._relRect={x:e.x||0,y:e.y||0,width:e.width||1,height:e.height||1},this._absRect={x:0,y:0,width:1,height:1},e.overlay&&(this._overlay=e.overlay)}get x(){return this._absRect.x}get y(){return this._absRect.y}get width(){return this._absRect.width}get height(){return this._absRect.height}get canvasWidth(){return this._canvasWidth}get canvasHeight(){return this._canvasHeight}get camera(){return this._camera}get controller(){return this._controller}get overlay(){return this._overlay}set overlay(e){this._overlay=e,this.updateGeometry()}dispose(){this.emit({type:"dispose",viewport:this}),this._overlay&&(this._overlay.remove(),this._overlay=null)}setSize(e,t,n,i){const s=this._relRect;s.x=e,s.y=t,s.width=n,s.height=i,this.updateGeometry()}setCanvasSize(e,t){this._canvasWidth=e,this._canvasHeight=t,this.updateGeometry(),this._controller&&this._controller.setViewportSize(e,t)}setBuiltInCamera(e,t){this._camera?this._camera.setProjection(e):(this._camera=new r.ZP(e),this._camera.matrixAutoUpdate=!1),void 0!==t&&(this._camera.setPreset(t),this.overlay.setLabel(o.x.TopRight,"view",r.LY[t],"ff-label-box"))}unsetBuiltInCamera(){this._camera=null,this._controller=null,this.overlay.unsetLabel(o.x.TopRight,"view")}enableCameraControl(e){return!e&&this._controller?this._controller=null:e&&this._camera&&(this._controller||(this._controller=new a.Z(this._camera),this._controller.setViewportSize(this.width,this.height),this._controller.updateController())),this._controller}zoomExtents(e){const t=this._camera,n=this._controller;t&&n&&(n.zoomExtents(e),n.updateCamera(null,!0))}isInside(e){return this.isPointInside(e.localX,e.localY)}isPointInside(e,t){const n=this._absRect;return t=this.canvasHeight-t,e>=n.x&&e=n.y&&t{"use strict";n.d(t,{D7:()=>p,MO:()=>u,jU:()=>d,sN:()=>m});var i=n(19588),s=n(82587),r=n(82954),o=n(78943),a=n(71050);const l=new i.P,c=new s.y,h=new r.U;new o._;function d(e,t,n){const i=n||new o._;return l.fromArray(e).multiplyScalar(a.M8.DEG2RAD),h.setFromVector3(l,t),i.setFromEuler(h),i}function u(e,t,n){const i=n||[0,0,0];return h.setFromQuaternion(e,t),l.setFromEuler(h),l.multiplyScalar(a.M8.RAD2DEG).toArray(i),i}function p(e){const t=new Map,n=new Map,i=new Map;e.traverse((e=>{const s=e;if(s.isMesh){const e=s.geometry;e&&t.set(e.uuid,e);const r=s.material;if(r){n.set(r.uuid,r);for(let e in r){const t=r[e];t&&t.isTexture&&i.set(t.uuid,t)}}}}));for(let e of i)e[1].dispose();for(let e of n)e[1].dispose();for(let e of t)e[1].dispose()}function m(e,t,n){n||(n=e);const i=e.geometry;if(i&&e.visible){let s=e;for(c.identity();s&&s!==n;)c.premultiply(s.matrix),s=s.parent;if(i.isGeometry){const e=i.vertices;for(let n=0,i=e.length;n{"use strict";n.d(t,{Z:()=>a,x:()=>i});var i,s=n(51120),r=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};!function(e){e[e.TopLeft=0]="TopLeft",e[e.TopCenter=1]="TopCenter",e[e.TopRight=2]="TopRight",e[e.BottomLeft=3]="BottomLeft",e[e.BottomCenter=4]="BottomCenter",e[e.BottomRight=5]="BottomRight"}(i||(i={}));let o=class extends s.ZP{constructor(){super(),this.labels=[],this.labels.push({},{},{},{},{},{})}setLabel(e,t,n,i){this.labels[e][t]={text:n,className:i},this.requestUpdate()}unsetLabel(e,t){delete this.labels[e][t],this.requestUpdate()}firstConnected(){this.classList.add("ff-container","ff-viewport-overlay")}render(){const e=this.labels;return s.dy`
+
${Object.keys(e[i.TopLeft]).map((t=>{const n=e[i.TopLeft][t];return s.dy`
${n.text}
`}))}
+
${Object.keys(e[i.TopCenter]).map((t=>{const n=e[i.TopCenter][t];return s.dy`
${n.text}
`}))}
+
${Object.keys(e[i.TopRight]).map((t=>{const n=e[i.TopRight][t];return s.dy`
${n.text}
`}))}
+
+
${Object.keys(e[i.BottomLeft]).map((t=>{const n=e[i.BottomLeft][t];return s.dy`
${n.text}
`}))}
+
${Object.keys(e[i.BottomCenter]).map((t=>{const n=e[i.BottomCenter][t];return s.dy`
${n.text}
`}))}
+
${Object.keys(e[i.BottomRight]).map((t=>{const n=e[i.BottomRight][t];return s.dy`
${n.text}
`}))}
+
`}};o=r([(0,s.Mo)("ff-viewport-overlay")],o);const a=o},98595:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});n(1239);var i=n(51120),s=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let r=class extends i.ZP{constructor(){super(),this.name="",this.index=0,this.selectedIndex=-1,this.tabbingIndex=0,this.selected=!1,this.selectable=!1,this.disabled=!1,this.icon="",this.role="button",this.caret=!1,this.inline=!1,this.transparent=!1,this.addEventListener("click",(e=>this.onClick(e))),this.addEventListener("keydown",(e=>this.onKeyDown(e)))}firstConnected(){this.tabIndex=this.tabbingIndex,this.setAttribute("role",this.role),this.classList.add("ff-button")}shouldUpdate(e){return(e.has("selectedIndex")||e.has("index"))&&this.selectedIndex>=0&&(this.selected=this.index===this.selectedIndex),e.has("disabled")&&this.setClass("ff-disabled",this.disabled),!0}update(e){this.classList.remove("ff-inline","ff-transparent","ff-control"),this.inline?this.classList.add("ff-inline"):this.transparent?this.classList.add("ff-transparent"):this.classList.add("ff-control"),super.update(e)}render(){return i.dy`${this.renderIcon()}${this.renderText()}${this.renderCaret()}`}renderIcon(){return this.icon?i.dy``:null}renderText(){return this.text?i.dy`
${this.text}
`:null}renderCaret(){return this.caret?i.dy`
`:null}onClick(e){this.selectable&&(this.selected=!this.selected)}onKeyDown(e){(document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement)!==this||"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),this.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}};s([(0,i.Cb)({type:String})],r.prototype,"name",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"index",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"selectedIndex",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"tabbingIndex",void 0),s([(0,i.Cb)({type:Boolean,reflect:!0})],r.prototype,"selected",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"selectable",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"disabled",void 0),s([(0,i.Cb)()],r.prototype,"text",void 0),s([(0,i.Cb)()],r.prototype,"icon",void 0),s([(0,i.Cb)()],r.prototype,"role",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"caret",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"inline",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"transparent",void 0),r=s([(0,i.Mo)("ff-button")],r);const o=r},34834:(e,t,n)=>{"use strict";var i=n(28581),s=n(47855),r=(n(45716),n(61497)),o=n(96368),a=n(51120),l=n(69551),c=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let h=class extends a.ZP{constructor(){super(),this.value=new o.Z,this._offsetX=0,this._offsetY=0,this._knob=(new a.ZP).addClass("ff-knob").setStyle({display:"block",position:"relative "}),new l.Z(this)}setXY(e,t){this.value.set(e,t),this.requestUpdate()}dragStart(e){const t=this._knob,n=this.getBoundingClientRect();e.target===this._knob?(this._offsetX=e.clientX-t.offsetLeft+.5*(t.clientWidth-t.offsetWidth),this._offsetY=e.clientY-t.offsetTop+.5*(t.clientHeight-t.offsetHeight)):(this._offsetX=n.left+.8*t.clientWidth,this._offsetY=n.top+.8*t.clientHeight),this.dragMove(e)}dragMove(e){const t=this._knob,n=e.clientX-this._offsetX,s=e.clientY-this._offsetY;let r=n/(this.clientWidth-t.clientWidth);r=i.Z.limit(r,0,1);let o=1-s/(this.clientHeight-t.clientHeight);o=i.Z.limit(o,0,1),r===this.value.x&&o===this.value.y||(this.value=this.value.set(r,o),this.emitChangeEvent(!0))}dragEnd(){this.emitChangeEvent(!1)}firstConnected(){this.setStyle({position:"relative",touchAction:"none"}),this.setAttribute("touch-action","none"),this.setAttribute("tabindex","0"),this.classList.add("ff-control","ff-vector-slider"),this.appendChild(this._knob)}update(e){const t=100*this.value.x,n=100*(1-this.value.y);this._knob.style.left=`${t.toFixed(3)}%`,this._knob.style.top=`${n.toFixed(3)}%`,super.update(e)}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,isDragging:e},bubbles:!0}))}};c([(0,a.Cb)({attribute:!1})],h.prototype,"value",void 0),h=c([(0,a.Mo)("ff-vector-slider")],h);const d=h;var u=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const p=new s.ZP;let m=class extends a.ZP{constructor(){super(),this.color=new s.ZP,this.alpha=!1,this.numeric=!1,this.onLumSatChange=this.onLumSatChange.bind(this),this.onHueChange=this.onHueChange.bind(this),this.onAlphaChange=this.onAlphaChange.bind(this),this.addEventListener("click",(e=>e.stopPropagation())),this._hsv=new s.P,this._lumSatSlider=(new d).on("change",this.onLumSatChange),this._hueSlider=(new r.Z).addClass("ff-hue-slider").on("change",this.onHueChange),this._hueSlider.direction="vertical"}firstConnected(){this.classList.add("ff-flex-column","ff-control","ff-color-edit")}update(e){e.has("color")&&this.color.toHSV(this._hsv),e.has("alpha")&&(this.alpha&&!this._alphaSlider?(this._alphaSlider=(new r.Z).addClass("ff-alpha-slider").on("change",this.onAlphaChange),this._alphaSlider.direction="vertical"):!this.alpha&&this._alphaSlider&&this._alphaSlider.remove()),super.update(e)}render(){let e=null;if(this.numeric){const t=this.color,n=t.toString(!1).substr(1),i=this.alpha?a.dy` +
A
+ `:null;e=a.dy`
+
R
+
G
+
B
+ ${i} +
#
+
`}return a.dy`
+ ${this._lumSatSlider}${this._hueSlider}${this._alphaSlider} +
${e}`}updated(){this._hueSlider.value=1-this._hsv.x/360;const e=`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, ${p.setHSV(this._hsv.x).toString(!1)})`;if(this._lumSatSlider.style.backgroundImage=e,this._lumSatSlider.setXY(this._hsv.y,this._hsv.z),this.alpha){const e=this.color.toString(!1),t=getComputedStyle(this._alphaSlider).color,n=`linear-gradient(to top, transparent, ${e}), repeating-linear-gradient(-45deg, transparent, transparent 8px, ${t} 8px, ${t} 16px)`;this._alphaSlider.style.backgroundImage=n,this._alphaSlider.value=this.color.alpha}}onLumSatChange(e){e.stopPropagation();const t=e.detail.value;this._hsv.y=t.x,this._hsv.z=t.y,this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onHueChange(e){e.stopPropagation(),this._hsv.x=360*(1-e.target.value),this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onAlphaChange(e){e.stopPropagation(),this.color.alpha=e.target.value,this.requestUpdate(),this.emitChangeEvent(e.detail.isDragging)}onNumericEdit(e){e.stopPropagation();const t=e.target.name;if("string"===t)this.color.setString(e.detail.text,1,!1);else{let n=parseInt(e.detail.text);if(!isFinite(n))return;this.color[t]=i.Z.limit(n,0,255)}this.color.toHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(e.detail.isEditing)}onKeyDown(e){const t="ArrowRight"===e.code||"ArrowUp"===e.code,n="PageUp"===e.code,s="ArrowLeft"===e.code||"ArrowDown"===e.code,r="PageDown"===e.code;if(t||n||s||r)if(e.target===this._hueSlider||e.target===this._alphaSlider){const r=t||n?-1:1,o=t||s?.01:.1;e.target===this._hueSlider?(this._hsv.x=i.Z.limit(this._hsv.x+360*o*r,0,360),this.color.setHSV(this._hsv)):this.color.alpha=i.Z.limit(this.color.alpha+o*r,0,1),this.requestUpdate(),this.emitChangeEvent(!1)}else if(e.target===this._lumSatSlider&&(t||s)){const n=t?1:-1,s=e.shiftKey?.1:.01;"ArrowRight"===e.code||"ArrowLeft"===e.code?this._hsv.y=i.Z.limit(this._hsv.y+s*n,0,1):this._hsv.z=i.Z.limit(this._hsv.z+s*n,0,1),this.color.setHSV(this._hsv),this.requestUpdate(),this.emitChangeEvent(!1)}}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{color:this.color,isDragging:e},bubbles:!0}))}};u([(0,a.Cb)({attribute:!1})],m.prototype,"color",void 0),u([(0,a.Cb)({type:Boolean})],m.prototype,"alpha",void 0),u([(0,a.Cb)({type:Boolean})],m.prototype,"numeric",void 0),m=u([(0,a.Mo)("ff-color-edit")],m)},51120:(e,t,n)=>{"use strict";n.d(t,{Mo:()=>$,ZP:()=>B,dy:()=>d.dy,Cb:()=>M,sY:()=>d.sY});var i=n(93909),s=n(14056);function r(e,t){const{element:{content:n},parts:i}=e,s=document.createTreeWalker(n,133,null,!1);let r=a(i),o=i[r],l=-1,c=0;const h=[];let d=null;for(;s.nextNode();){l++;const e=s.currentNode;for(e.previousSibling===d&&(d=null),t.has(e)&&(h.push(e),null===d&&(d=e)),null!==d&&c++;void 0!==o&&o.index===l;)o.index=null!==d?-1:o.index-c,r=a(i,r),o=i[r]}h.forEach((e=>e.parentNode.removeChild(e)))}const o=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},a=(e,t=-1)=>{for(let n=t+1;n`${e}--${t}`;let p=!0;void 0===window.ShadyCSS?p=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),p=!1);const m=e=>t=>{const n=u(t.type,e);let i=c.r.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},c.r.set(n,i));let r=i.stringsArray.get(t.strings);if(void 0!==r)return r;const o=t.strings.join(s.Jw);if(r=i.keyString.get(o),void 0===r){const n=t.getTemplateElement();p&&window.ShadyCSS.prepareTemplateDom(n,e),r=new s.YS(t,n),i.keyString.set(o,r)}return i.stringsArray.set(t.strings,r),r},f=["html","svg"],g=new Set,v=(e,t,n)=>{g.add(e);const i=n?n.element:document.createElement("template"),s=t.querySelectorAll("style"),{length:l}=s;if(0===l)return void window.ShadyCSS.prepareTemplateStyles(i,e);const h=document.createElement("style");for(let e=0;e{f.forEach((t=>{const n=c.r.get(u(t,e));void 0!==n&&n.keyString.forEach((e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{n.add(e)})),r(e,n)}))}))})(e);const d=i.content;n?function(e,t,n=null){const{element:{content:i},parts:s}=e;if(null==n)return void i.appendChild(t);const r=document.createTreeWalker(i,133,null,!1);let l=a(s),c=0,h=-1;for(;r.nextNode();)for(h++,r.currentNode===n&&(c=o(t),n.parentNode.insertBefore(t,n));-1!==l&&s[l].index===h;){if(c>0){for(;-1!==l;)s[l].index+=c,l=a(s,l);return}l=a(s,l)}}(n,h,d.firstChild):d.insertBefore(h,d.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const p=d.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==p)t.insertBefore(p.cloneNode(!0),t.firstChild);else if(n){d.insertBefore(h,d.firstChild);const e=new Set;e.add(h),r(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const y={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},b=(e,t)=>t!==e&&(t==t||e==e),_={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:b},x="finalized";class w extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,n)=>{const i=this._attributeNameForProperty(n,t);void 0!==i&&(this._attributeToPropertyMap.set(i,n),e.push(i))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=_){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this.requestUpdateInternal(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||_}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(x)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=b){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,i=t.converter||y,s="function"==typeof i?i:i.fromAttribute;return s?s(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,i=t.converter;return(i&&i.toAttribute||y.toAttribute)(e,n)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=_){const i=this.constructor,s=i._attributeNameForProperty(e,n);if(void 0!==s){const e=i._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(s):this.setAttribute(s,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){const e=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,n){let i=!0;if(void 0!==e){const s=this.constructor;n=n||s.getPropertyOptions(e),s._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}w.finalized=!0;const S=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(n){n.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(n){n.createProperty(t.key,e)}};function M(e){return(t,n)=>void 0!==n?((e,t,n)=>{t.constructor.createProperty(n,e)})(e,t,n):S(e,t)}const E=Element.prototype;E.msMatchesSelector||E.webkitMatchesSelector;const T=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,C=Symbol();class A{constructor(e,t){if(t!==C)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(T?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const P={};class R extends w{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight(((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e)),n),n=t(e,new Set),i=[];n.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!T){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new A(String(t),C)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?T?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==P&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return P}}R.finalized=!0,R.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const s=n.scopeName,r=l.L.has(t),o=p&&11===t.nodeType&&!!t.host,a=o&&!g.has(s),c=a?document.createDocumentFragment():t;if((0,l.s)(e,c,Object.assign({templateFactory:m(s)},n)),a){const e=l.L.get(c);l.L.delete(c);const n=e.value instanceof h.R?e.value.template:void 0;v(s,c,n),(0,i.r4)(t,t.firstChild),t.appendChild(c),l.L.set(t,e)}!r&&o&&window.ShadyCSS.styleElement(t.host)},R.shadowRootOptions={mode:"open"};const L=(e,t)=>{const n=e.startNode.parentNode,i=void 0===t?e.endNode:t.startNode,s=n.insertBefore((0,d.IW)(),i);n.insertBefore((0,d.IW)(),i);const r=new d.nt(e.options);return r.insertAfterNode(s),r},N=(e,t)=>(e.setValue(t),e.commit(),e),D=(e,t,n)=>{const i=e.startNode.parentNode,s=n?n.startNode:e.endNode,r=t.endNode.nextSibling;r!==s&&(0,d.V)(i,t.startNode,r,s)},I=e=>{(0,d.r4)(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},O=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},U=new WeakMap,k=new WeakMap;(0,d.XM)(((e,t,n)=>{let i;return void 0===n?n=t:void 0!==t&&(i=t),t=>{if(!(t instanceof d.nt))throw new Error("repeat can only be used in text bindings");const s=U.get(t)||[],r=k.get(t)||[],o=[],a=[],l=[];let c,h,u=0;for(const t of e)l[u]=i?i(t,u):u,a[u]=n(t,u),u++;let p=0,m=s.length-1,f=0,g=a.length-1;for(;p<=m&&f<=g;)if(null===s[p])p++;else if(null===s[m])m--;else if(r[p]===l[f])o[f]=N(s[p],a[f]),p++,f++;else if(r[m]===l[g])o[g]=N(s[m],a[g]),m--,g--;else if(r[p]===l[g])o[g]=N(s[p],a[g]),D(t,s[p],o[g+1]),p++,g--;else if(r[m]===l[f])o[f]=N(s[m],a[f]),D(t,s[m],s[p]),m--,f++;else if(void 0===c&&(c=O(l,f,g),h=O(r,p,m)),c.has(r[p]))if(c.has(r[m])){const e=h.get(l[f]),n=void 0!==e?s[e]:null;if(null===n){const e=L(t,s[p]);N(e,a[f]),o[f]=e}else o[f]=N(n,a[f]),D(t,n,s[p]),s[e]=null;f++}else I(s[m]),m--;else I(s[p]),p++;for(;f<=g;){const e=L(t,o[g+1]);N(e,a[f]),o[f++]=e}for(;p<=m;){const e=s[p++];null!==e&&I(e)}U.set(t,o),k.set(t,l)}}));var V,z=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let F=V=class extends R{constructor(){super(...arguments),this._isFirstConnected=!1}static setStyle(e,t){Object.assign(e.style,t)}static setAttribs(e,t){for(let n in t)e.setAttribute(n,t[n])}get shady(){return this.constructor.shady}appendTo(e){return e.appendChild(this),this}removeChildren(){for(;this.firstChild;)this.removeChild(this.firstChild)}getChildrenArray(){return Array.from(this.children)}appendElement(e,t){return this.createElement(e,t,this)}createElement(e,t,n){let i;return i="string"==typeof e?document.createElement(e):e instanceof HTMLElement?e:new e,t&&Object.assign(i.style,t),n&&n.appendChild(i),i}setStyle(e){return V.setStyle(this,e),this}setAttribute(e,t){return super.setAttribute(e,t),this}setAttributes(e){return V.setAttribs(this,e),this}addClass(...e){return e.forEach((e=>this.classList.add(e))),this}removeClass(...e){return e.forEach((e=>this.classList.remove(e))),this}setClass(e,t){return t?this.classList.add(e):this.classList.remove(e),this}hasFocus(){return document.activeElement===this}on(e,t,n){return this.addEventListener(e,t,n),this}off(e,t,n){return this.removeEventListener(e,t,n),this}connectedCallback(){this._isFirstConnected||(this._isFirstConnected=!0,this.firstConnected()),this.connected(),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.disconnected()}createRenderRoot(){return this.shady?super.createRenderRoot():this}firstConnected(){}connected(){}disconnected(){}onUpdate(){this.requestUpdate()}};F.tagName="ff-custom-element",F.shady=!1,F=V=z([$("ff-custom-element")],F);const B=F;function $(e){return t=>(t.tagName=e,customElements.define(t.tagName,t),t)}},69551:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});class i{constructor(e){this.isEnabled=!0,this._isDragging=!1,this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this.target=e,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),e.addEventListener("pointercancel",this.onPointerUp)}get isDragging(){return this._isDragging}get startX(){return this._startX}get startY(){return this._startY}onPointerDown(e){e.isPrimary&&this.isEnabled&&(this._isDragging=!0,this._startX=this._lastX=e.clientX,this._startY=this._lastY=e.clientY,this.target.setPointerCapture(e.pointerId),this.target.dragStart(e)),e.stopPropagation(),e.preventDefault()}onPointerMove(e){if(e.isPrimary&&this._isDragging){const t=e.clientX-this._lastX;this._lastX=e.clientX;const n=e.clientY-this._lastY;this._lastY=e.clientY,this.target.dragMove(e,t,n)}e.stopPropagation(),e.preventDefault()}onPointerUp(e){this._isDragging&&e.isPrimary&&(this.target.dragEnd(e),this.target.releasePointerCapture(e.pointerId),this._isDragging=!1),e.stopPropagation(),e.preventDefault()}}},1239:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i,s=n(51120),r=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let o=i=class extends s.ZP{constructor(e){super(),this.template=null,this.name=e||""}static add(e,t){if(i.templates[e])throw new Error(`icon already registered: '${e}'`);i.templates[e]=t}static getTemplateNames(){return Object.keys(i.templates)}firstConnected(){this.classList.add("ff-icon")}render(){if(this.name){const e=this.constructor.templates[this.name];return e||console.warn(`icon not found: '${this.name}'`),e}return this.template?this.template:s.dy`[icon undefined]`}};o.templates={},r([(0,s.Cb)({attribute:!1})],o.prototype,"template",void 0),r([(0,s.Cb)({type:String})],o.prototype,"name",void 0),o=i=r([(0,s.Mo)("ff-icon")],o);const a=o;o.add("empty",s.dy``),o.add("check",s.dy``),o.add("close",s.dy``),o.add("grip",s.dy``),o.add("up",s.dy``),o.add("down",s.dy``),o.add("caret-up",s.dy``),o.add("caret-down",s.dy``),o.add("folder",s.dy``),o.add("file",s.dy``),o.add("info",s.dy``),o.add("warning",s.dy``),o.add("error",s.dy``),o.add("prompt",s.dy``)},45716:(e,t,n)=>{"use strict";var i=n(51120),s=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let r=class extends i.ZP{constructor(){super(...arguments),this.name="",this.index=0,this.text="",this.placeholder="",this.align="left",this.initialValue="",this.requestFocus=!1}get inputElement(){return this.getElementsByTagName("input").item(0)}focus(){this.requestFocus=!0,this.performUpdate()}hasFocus(){const e=document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement;return this.inputElement===e}firstConnected(){this.classList.add("ff-control","ff-line-edit")}shouldUpdate(e){return!this.hasFocus()&&super.shouldUpdate(e)}render(){return i.dy``}updated(){this.requestFocus&&(this.requestFocus=!1,this.inputElement.focus())}onKeyDown(e){const t=e.target;"Enter"===e.key?(this.commit(t),t.blur()):"Escape"===e.key&&(this.revert(t),t.blur())}onChange(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!1)}onInput(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!0)}onFocus(e){this.initialValue=e.target.value,e.target.select()}onBlur(e){this.commit(e.target),this.requestUpdate()}revert(e){e.value=this.initialValue,this.dispatchChangeEvent(e.value,!1)}commit(e){this.initialValue=e.value,this.dispatchChangeEvent(e.value,!1)}dispatchChangeEvent(e,t){this.dispatchEvent(new CustomEvent("change",{detail:{text:e,isEditing:t}}))}};s([(0,i.Cb)({type:String})],r.prototype,"name",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"index",void 0),s([(0,i.Cb)({type:String})],r.prototype,"text",void 0),s([(0,i.Cb)({type:String})],r.prototype,"placeholder",void 0),s([(0,i.Cb)({type:String})],r.prototype,"align",void 0),r=s([(0,i.Mo)("ff-line-edit")],r)},61497:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var i=n(28581),s=n(51120),r=n(69551),o=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let a=class extends s.ZP{constructor(){super(),this.direction="horizontal",this.value=0,this._isVertical=!1,this._offsetX=0,this._offsetY=0,this._knob=(new s.ZP).addClass("ff-knob").setStyle({display:"block",position:"relative "}),new r.Z(this)}dragStart(e){const t=this._knob,n=this.getBoundingClientRect();e.target===this._knob?(this._offsetX=e.clientX-t.offsetLeft+.5*(t.clientWidth-t.offsetWidth),this._offsetY=e.clientY-t.offsetTop+.5*(t.clientHeight-t.offsetHeight)):(this._offsetX=n.left+.8*t.clientWidth,this._offsetY=n.top+.8*t.clientHeight),this.dragMove(e)}dragMove(e){const t=this._knob,n=e.clientX-this._offsetX,s=e.clientY-this._offsetY;let r=this._isVertical?1-s/(this.clientHeight-t.clientHeight):n/(this.clientWidth-t.clientWidth);r=i.Z.limit(r,0,1),r!==this.value&&(this.value=r,this.emitChangeEvent(!0))}dragEnd(){this.emitChangeEvent(!1)}firstConnected(){this.setStyle({position:"relative",touchAction:"none"}),this.setAttribute("touch-action","none"),this.setAttribute("tabindex","0"),this.classList.add("ff-control","ff-linear-slider"),this.appendChild(this._knob)}update(e){if(e.has("direction")&&(this._isVertical="vertical"===this.direction,this.setClass("ff-horizontal",!this._isVertical),this.setClass("ff-vertical",this._isVertical)),e.has("value")){const e=i.Z.limit(this.value,0,1),t=this._isVertical?0:100*e,n=this._isVertical?100*(1-e):0;this._knob.style.left=`${t.toFixed(3)}%`,this._knob.style.top=`${n.toFixed(3)}%`}super.update(e)}emitChangeEvent(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,isDragging:e},bubbles:!0}))}};o([(0,s.Cb)({type:String})],a.prototype,"direction",void 0),o([(0,s.Cb)({type:Number})],a.prototype,"value",void 0),a=o([(0,s.Mo)("ff-linear-slider")],a);const l=a},10564:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>h});n(1239);var i,s=n(51120),r=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const o={info:"ff-info",success:"ff-success",warning:"ff-warning",error:"ff-error"},a={info:"info",success:"check",warning:"warning",error:"error"},l={info:2e3,success:2e3,warning:5e3,error:0};let c=i=class extends s.ZP{constructor(e,t,n){super(),this._handler=0,this.on("transitionend",this.remove.bind(this)),this.message=e||"",this.level=t||"info",this.timeout=void 0!==n?n:l[this.level];const s=(i.shadowRootNode||document).getElementById(i.stackId);s?s.appendChild(this):console.warn(`element '#${i.stackId}' not found`)}static show(e,t,n){new i(e,t,n)}close(){this._handler>0&&(window.clearTimeout(this._handler),this._handler=0),this.classList.add("ff-out")}firstUpdated(){this.classList.add("ff-notification",o[this.level]),this.timeout>0&&(this._handler=window.setTimeout((()=>this.close()),this.timeout))}render(){const e=a[this.level];return s.dy` +
${this.message}
+ `}onClose(e){e.stopPropagation(),this.close()}};c.stackId="ff-notification-stack",c.shadowRootNode=null,r([(0,s.Cb)({type:String})],c.prototype,"message",void 0),r([(0,s.Cb)({type:String})],c.prototype,"level",void 0),r([(0,s.Cb)({type:Number})],c.prototype,"timeout",void 0),c=i=r([(0,s.Mo)("ff-notification")],c);const h=c},34287:(e,t,n)=>{"use strict";n.d(t,{Mo:()=>i.Mo,ZP:()=>o,dy:()=>i.dy});var i=n(51120),s=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let r=class extends i.ZP{constructor(){super(),this.anchor=null,this.portal=null,this.position=void 0,this.align=void 0,this.justify=void 0,this.positionX=0,this.positionY=0,this.offsetX=0,this.offsetY=0,this.keepVisible=!1,this.modal=!1,this._modalPlane=null,this.onResize=this.onResize.bind(this),this.onCaptureEvent=this.onCaptureEvent.bind(this),this.onEatEvent=this.onEatEvent.bind(this)}close(){this.dispatchEvent(new CustomEvent("close"))}connected(){if(this.calculatePosition(),window.addEventListener("resize",this.onResize),this.modal){const e=this._modalPlane=this.createElement("div");e.classList.add("ff-modal-plane"),e.addEventListener("mousedown",this.onEatEvent),e.addEventListener("contextmenu",this.onEatEvent),e.addEventListener("pointerdown",this.onEatEvent),this.parentElement.appendChild(e),setTimeout((()=>e.classList.add("ff-transition")))}else document.addEventListener("mousedown",this.onCaptureEvent,{capture:!0,passive:!0})}disconnected(){window.removeEventListener("resize",this.onResize),this._modalPlane?(this._modalPlane.remove(),this._modalPlane=null):document.removeEventListener("mousedown",this.onCaptureEvent)}firstConnected(){super.firstConnected(),this.setStyle({position:"fixed",zIndex:"1000"}),this.classList.add("ff-popup")}updated(){this.isConnected&&this.calculatePosition()}calculatePosition(){let e,t;const n=this.getBoundingClientRect();let i;if(t=this.portal?this.portal.getBoundingClientRect():{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight,width:window.innerWidth,height:window.innerHeight},"center"===this.position)i=this.center(n,t);else if("anchor"===this.position){const s=this.anchor||this.parentElement;s&&(e=s.getBoundingClientRect(),i=this.positionToAnchor(n,e,t))}else i={x:this.positionX,y:this.positionY};this.keepVisible&&"center"!==this.position&&(i=this.keepElementVisible(i,n,t)),this.style.left=Math.round(i.x)+"px",this.style.top=Math.round(i.y)+"px"}center(e,t){return{x:Math.round(.5*(t.width-e.width)),y:Math.round(.5*(t.height-e.height))}}positionToAnchor(e,t,n){const i=this.align,s=this.justify,r=this.offsetX,o=this.offsetY,a={x:0,y:0};switch(i){case"start":a.x="start"!==s&&"end"!==s?t.left-e.width-r:t.left;break;case"end":a.x="start"!==s&&"end"!==s?t.right+r:t.right-e.width;break;case"fixed":a.x=this.positionX;break;default:a.x=t.left+.5*(t.width-e.width)}switch(s){case"start":a.y=t.top-e.height-o;break;case"end":a.y=t.bottom+o;break;case"fixed":a.y=this.positionY;break;default:a.y=t.top+.5*(t.height-e.height)}return a.x+=this.offsetX,a.y+=this.offsetY,a}keepElementVisible(e,t,n){const i=this.offsetX,s=this.offsetY;return t.width>n.width?e.x=.5*(n.width-t.width):e.xn.right&&(e.x=n.right-t.width-i),t.height>n.height?e.y=.5*(n.height-t.height):e.yn.bottom&&(e.y=n.bottom-t.height-s),e}onResize(){this.calculatePosition()}onCaptureEvent(e){e.target instanceof Node&&this.contains(e.target)||this.close()}onEatEvent(e){console.log("Popup.onEatEvent"),e.stopPropagation(),e.preventDefault()}};s([(0,i.Cb)({attribute:!1})],r.prototype,"anchor",void 0),s([(0,i.Cb)({attribute:!1})],r.prototype,"portal",void 0),s([(0,i.Cb)({type:String})],r.prototype,"position",void 0),s([(0,i.Cb)({type:String})],r.prototype,"align",void 0),s([(0,i.Cb)({type:String})],r.prototype,"justify",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"positionX",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"positionY",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"offsetX",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"offsetY",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"keepVisible",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"modal",void 0),r=s([(0,i.Mo)("ff-popup")],r);const o=r},39229:(e,t,n)=>{"use strict";var i,s=n(51120),r=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let o=i=class extends s.ZP{constructor(){super(),this.direction="horizontal",this.width=5,this.margin=20,this.detached=!1,this._isActive=!1,this._offset=0,this._position=0,this.addEventListener("pointerdown",(e=>this.onPointerDown(e))),this.addEventListener("pointermove",(e=>this.onPointerMove(e))),this.addEventListener("pointerup",(e=>this.onPointerUpOrCancel(e))),this.addEventListener("pointercancel",(e=>this.onPointerUpOrCancel(e)))}get position(){return this._position}isHorizontal(){return"horizontal"===this.direction}update(e){super.update(e);const t=this.isHorizontal(),n=this.width;this.setStyle({padding:t?`0 ${n}px`:`${n}px 0`,margin:t?`0 ${-n}px`:-n+"px 0",cursor:t?"col-resize":"row-resize"})}firstUpdated(){this.classList.add("ff-splitter"),this.setAttribute("touch-action","none"),this.setStyle({position:"relative",display:"block",zIndex:"1",touchAction:"none"})}onPointerDown(e){if(e.isPrimary){e.stopPropagation(),e.preventDefault(),this._isActive=!0,this.setPointerCapture(e.pointerId);const t=this.getBoundingClientRect();this._offset=this.isHorizontal()?t.left+.5*t.width-e.clientX:t.top+.5*t.height-e.clientY}}onPointerMove(e){if(e.isPrimary&&this._isActive){e.stopPropagation(),e.preventDefault();const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect(),s=this.isHorizontal(),r=s?n.width:n.height;let o=this._offset+(s?e.clientX-n.left:e.clientY-n.top),a=o/r;if(!this.detached){const e=this.previousElementSibling,n=this.nextElementSibling;if(e instanceof HTMLElement&&n instanceof HTMLElement){const l=Array.from(t.children);let c=0,h=r,d=!1;l.forEach((t=>{if(t instanceof i)return;if(t===e||t===n)return void(d=!0);const r=t.getBoundingClientRect(),o=s?r.width:r.height;h-=o,d||(c+=o)}));const u=this.margin,p=h-u;o-=c,o=op?p:o;const m=(h-o)/r;a=o/r,e.style.flexBasis=(100*a).toFixed(3)+"%",n.style.flexBasis=(100*m).toFixed(3)+"%",setTimeout((()=>window.dispatchEvent(new CustomEvent("resize"))),0)}}this._position=a,this.dispatchEvent(new CustomEvent(i.changeEvent,{detail:{direction:this.direction,position:this._position,isDragging:!0}}))}}onPointerUpOrCancel(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),this._isActive=!1,this.dispatchEvent(new CustomEvent(i.changeEvent,{detail:{direction:this.direction,position:this._position,isDragging:!1}})))}};o.changeEvent="ff-splitter-change",r([(0,s.Cb)({type:String})],o.prototype,"direction",void 0),r([(0,s.Cb)({type:Number})],o.prototype,"width",void 0),r([(0,s.Cb)({type:Number})],o.prototype,"margin",void 0),r([(0,s.Cb)({type:Boolean})],o.prototype,"detached",void 0),o=i=r([(0,s.Mo)("ff-splitter")],o)},13470:(e,t,n)=>{"use strict";var i=n(51120),s=n(53868);const r=new WeakMap,o=(0,s.XM)((e=>t=>{const n=r.get(t);if(void 0===e&&t instanceof s._l){if(void 0!==n||!r.has(t)){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==n&&t.setValue(e);r.set(t,e)}));var a=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let l=class extends i.ZP{constructor(){super(...arguments),this.name="",this.index=0,this.text="",this.placeholder="",this.readonly=!1,this.align="left",this.maxLength=0,this.initialValue=""}get textArea(){return this.getElementsByTagName("textarea").item(0)}select(){const e=this.textArea;e&&e.select()}focus(){const e=this.textArea;e&&e.focus()}blur(){const e=this.textArea;e&&e.blur()}hasFocus(){const e=document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement;return this.textArea===e}firstConnected(){this.classList.add("ff-control","ff-text-edit")}shouldUpdate(e){return!this.hasFocus()&&super.shouldUpdate(e)}render(){var e;return i.dy``}onKeyDown(e){const t=e.target;"Escape"===e.key&&(this.revert(t),t.blur())}onChange(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!1)}onInput(e){e.stopPropagation(),e.preventDefault(),this.text=e.target.value,this.dispatchChangeEvent(this.text,!0)}onFocus(e){this.initialValue=e.target.value}onBlur(e){this.commit(e.target),this.requestUpdate()}revert(e){e.value=this.initialValue,this.dispatchChangeEvent(e.value,!1)}commit(e){this.initialValue=e.value,this.dispatchChangeEvent(e.value,!1)}dispatchChangeEvent(e,t){this.dispatchEvent(new CustomEvent("change",{detail:{text:e,isEditing:t}}))}};a([(0,i.Cb)({type:String})],l.prototype,"name",void 0),a([(0,i.Cb)({type:Number})],l.prototype,"index",void 0),a([(0,i.Cb)({type:String})],l.prototype,"text",void 0),a([(0,i.Cb)({type:String})],l.prototype,"placeholder",void 0),a([(0,i.Cb)({type:Boolean})],l.prototype,"readonly",void 0),a([(0,i.Cb)({type:String})],l.prototype,"align",void 0),a([(0,i.Cb)({type:Number})],l.prototype,"maxLength",void 0),l=a([(0,i.Mo)("ff-text-edit")],l)},41029:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});class i{static registerType(e){if(this.types[e.typeName])throw new Error(`Annotation type '${e.typeName}' already registered.`);this.types[e.typeName]=e}static registerDefaultType(e){this.defaultType=e}static get typeNames(){return[this.defaultTypeName,...Object.keys(this.types).sort()]}static get defaultTypeName(){return this.defaultType.typeName}static getType(e){const t=this.types[e]||this.defaultType;if(!t)throw new Error(`type '${e}' not registered and no default type set.`);return t}static createInstance(e,t,n){return"Circle"===(t=t||e.data.style)?new(this.getType(t))(e,n):new(this.getType(t))(e)}}i.types={},i.defaultType=null},56752:(e,t,n)=>{"use strict";n.d(t,{m$:()=>v,ZP:()=>g});var i,s=n(19588),r=n(60531),o=n(94608),a=(n(44466),n(34287)),l=(n(98595),n(13470),n(53310)),c=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let h=i=class extends a.ZP{constructor(e,t){super(),this.content=null,this.sprite=null,this.resizeObserver=null,this.close=this.close.bind(this),this.content=e,this.title=t.annotation.title,this.sprite=t,this.position="center",this.modal=!0}static show(e,t,n){const s=new i(t,n);return e.appendChild(s),new Promise(((e,t)=>{s.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-annotation-overlay","sv-annotation")}connected(){super.connected(),this.sprite.addEventListener("link",this.close),this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>this.onResize()))),this.resizeObserver.observe(this)}disconnected(){this.resizeObserver.disconnect(),this.sprite.removeEventListener("link",this.close),super.disconnected()}render(){return a.dy` +
this.discardEvents(e)} @pointerdown=${e=>this.discardEvents(e)} aria-label="Annotation pop-up" @keydown=${e=>this.onKeyDownMain(e)}> +
+
${this.title}
+ +
+
+ `}firstUpdated(e){super.firstUpdated(e);this.querySelector("#anno_container").append(this.content)}onKeyDownMain(e){"Escape"===e.code?this.close():"Tab"===e.code&&(0,l.e)((0,l.G)(this),e)}tabReset(e){const t=e.target instanceof Element?e.target:null;if(t){const e=Array.from(t.parentElement.children).find((e=>e.hasAttribute("selected")));e!==t&&(t.setAttribute("tabIndex","-1"),e.setAttribute("tabIndex","0"))}}discardEvents(e){e.stopPropagation()}};h=i=c([(0,a.Mo)("sv-annotation-overlay")],h);const d=h,u=new s.P(0,1,0),p=new s.P,m=new s.P,f=new s.P;class g extends o.ZP{constructor(e,t){super(),this.isAdaptive=!0,this.isAnimating=!1,this.assetManager=null,this.audioManager=null,this.annotation=e,this.matrixAutoUpdate=!1}get typeName(){return this.constructor.typeName}update(){super.update();const e=this.annotation.data;this.position.fromArray(e.position),p.fromArray(e.direction).normalize(),this.quaternion.setFromUnitVectors(u,p),this.updateMatrix()}emitClickEvent(){const e={type:"click",annotation:this.annotation,sprite:this};this.dispatchEvent(e)}emitLinkEvent(e){const t={type:"link",annotation:this.annotation,sprite:this,link:e};this.dispatchEvent(t)}isBehindCamera(e,t){let n=null;n=t instanceof r.H&&t.cameras.length>0?t.cameras[0]:t;const i=n.matrixWorld.elements;return e.updateMatrixWorld(),m.setFromMatrixPosition(e.matrixWorld),f.setFromMatrixPosition(n.matrixWorld),p.set(-i[8],-i[9],-i[10]).normalize(),f.addScaledVector(p,n.near),f.sub(m),f.angleTo(p)<=Math.PI/2}}g.typeName="Annotation";class v extends o.KB{constructor(e){super(),this.isTruncated=!1,this.isOverlayed=!1,this.sprite=e,this.discardEvent=this.discardEvent.bind(this),this.addEventListener("pointercancel",this.discardEvent),this.addEventListener("click",this.discardEvent)}get truncated(){return this.isTruncated}set truncated(e){this.isTruncated=e}get overlayed(){return this.isOverlayed}set overlayed(e){this.isOverlayed=e}firstConnected(){super.firstConnected(),this.classList.add("sv-annotation")}discardEvent(e){e.stopPropagation()}showOverlay(e){this.requestUpdate().then((()=>{d.show(this.parentElement,e,this.sprite).then((()=>{this.overlayed=!1,this.append(e),this.requestUpdate()}))}))}}},10160:(e,t,n)=>{"use strict";var i=n(19588),s=n(29187),r=n(8035),o=n(75809),a=n(24479),l=n(51120),c=n(28581),h=n(47855),d=(n(98595),n(56752)),u=n(41029),p=n(19853),m=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const f=new h.ZP,g=new i.P(0,0,0),v=new i.P,y=new i.P,b=new i.P,_=new i.P;class x extends d.ZP{constructor(e){super(e),this.adaptive=!0,this.offset=new s.Z,this.offset.matrixAutoUpdate=!1,this.add(this.offset),this.anchorMesh=new r.K(new o.u,new a.v),this.anchorMesh.frustumCulled=!1,this.anchorMesh.matrixAutoUpdate=!1,this.offset.add(this.anchorMesh),this.update()}dispose(){this.offset=null,this.anchorMesh=null,super.dispose()}update(){const e=this.annotation.data;this.anchorMesh.scale.setScalar(e.scale),this.anchorMesh.position.y=e.offset,this.anchorMesh.updateMatrix(),super.update()}renderHTMLElement(e,t,n){super.renderHTMLElement(e,t,n,this.anchorMesh,g);const i=this.anchorMesh;v.set(0,0,0),v.applyMatrix4(i.modelViewMatrix),y.set(0,1,0),y.applyMatrix4(i.modelViewMatrix),b.copy(y).sub(v).normalize(),_.set(0,0,1),this.viewAngle=b.angleTo(_);const s=c.Z.scaleLimit(this.viewAngle*c.Z.RAD2DEG,90,100,1,0),r=this.annotation.data.visible?s:0;e.setOpacity(r);const o=this.annotation.data,a=o.visible;this.offset.visible=a,this.adaptive!==this.isAdaptive&&(this.isAdaptive||(e.truncated=!1,e.classList.remove("sv-short"),e.requestUpdate()),this.adaptive=this.isAdaptive),this.setVisible(!this.isBehindCamera(this.offset,n)&&a),this.getVisible()||e.setVisible(this.getVisible()),this.adaptive&&!this.isAnimating&&o.expanded&&(e.truncated||(e.classList.contains("sv-expanded")?(this.originalHeight=e.offsetHeight,this.originalWidth=e.offsetWidth):e.requestUpdate().then((()=>{this.originalHeight=e.offsetHeight,this.originalWidth=e.offsetWidth,this.checkTruncate(e,t)}))),this.checkTruncate(e,t))}createHTMLElement(){return new w(this)}checkTruncate(e,t){e.getBoundingClientRect().left,t.getBoundingClientRect().left;const n=e.getBoundingClientRect().top-t.getBoundingClientRect().top+this.originalHeight>=t.offsetHeight;n!==e.truncated?(e.truncated=n,e.requestUpdate().then((()=>{this.checkBounds(e,t)}))):this.checkBounds(e,t)}checkBounds(e,t){const n=e.getBoundingClientRect().left-t.getBoundingClientRect().left,i=e.getBoundingClientRect().top-t.getBoundingClientRect().top;n+e.offsetWidth>=t.offsetWidth&&!e.classList.contains("sv-align-right")?(e.classList.add("sv-align-right"),e.requestUpdate()):n+e.offsetWidth=t.offsetHeight&&!e.classList.contains("sv-align-bottom")?(e.classList.add("sv-align-bottom"),e.requestUpdate()):i+e.offsetHeight0),s=this.sprite.audioManager;this.markerElement.innerText=n.marker;const r=l.dy` + ${this.isOverlayed?null:l.dy`
${t.title}
`} + ${n.imageUri&&!i?l.dy`
${t.imageAltText}${t.imageCredit?l.dy`
${t.imageCredit}
`:null}
`:null} + ${i?null:l.dy`

${(0,p.A)(t.lead)}

`} + ${n.audioId&&!this.isOverlayed?l.dy`
`:null} + ${n.articleId&&!i?l.dy``:null} + ${i?l.dy``:null}`;(0,l.sY)(r,this.contentElement),f.fromArray(n.color),this.markerElement.style.borderColor=f.toString(),this.isExpanded&&(this.contentElement.style.height="auto"),this.isExpanded===n.expanded||this.overlayed||(this.isExpanded=n.expanded,this.isExpanded?(n.audioId&&this.querySelector("#audio_container").append(s.getPlayerById(n.audioId)),this.classList.add("sv-expanded"),this.contentElement.style.display="block",this.contentElement.style.height="auto"):(this.classList.remove("sv-expanded"),this.contentElement.style.display="none",s.activeId==n.audioId&&this.sprite.audioManager.stop())),this.isExpanded&&(this.contentElement.style.removeProperty("transform"),this.classList.contains("sv-align-right")&&(this.contentElement.style.transform=`translateX(-${this.offsetWidth}px)`),this.classList.contains("sv-align-bottom")&&(this.contentElement.style.transform=`translateY(-${this.offsetHeight-this.markerElement.offsetHeight}px)`));const o=this.querySelector(".sv-audio-view");if(n.audioId&&!this.overlayed)if(n.expanded&&!o){this.querySelector("#audio_container").append(s.getPlayerById(n.audioId))}else!n.expanded&&o&&s.activeId==n.audioId&&s.stop()}onClickMarker(e){this.contentElement.style.display="block",e.stopPropagation(),this.sprite.emitClickEvent()}onClickArticle(e){e.stopPropagation(),this.sprite.emitLinkEvent(this.sprite.annotation.data.articleId)}onClickOverlay(e){e.stopPropagation();const t=this.contentElement;this.overlayed=!0,this.showOverlay(t)}onClickAudio(e){e.stopPropagation()}onKeyDown(e){"Space"!==e.code&&"Enter"!==e.code||(e.stopPropagation(),this.sprite.emitClickEvent())}};w=m([(0,l.Mo)("sv-circle-annotation")],w)},13301:(e,t,n)=>{"use strict";var i=n(19588),s=n(75809),r=n(64026),o=n(93122),a=n(28581),l=n(47855),c=n(51120),h=n(19853),d=(n(98595),n(56752)),u=n(41029),p=n(94608),m=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const f=["sv-q0","sv-q1","sv-q2","sv-q3"],g=new l.ZP,v=new i.P(0,1,0);class y extends d.ZP{constructor(e){super(e),this.quadrant=-1,this.adaptive=!0;const t=[];t.push(new i.P(0,0,0)),t.push(new i.P(0,1,0));const n=(new s.u).setFromPoints(t),a=new r.n({color:"#009cde",transparent:!0});a.toneMapped=!1,this.stemLine=new o.x(n,a),this.stemLine.frustumCulled=!1,this.stemLine.matrixAutoUpdate=!1,this.add(this.stemLine),this.update()}update(){const e=this.annotation.data;this.stemLine.scale.setScalar(e.scale),this.stemLine.position.y=e.offset,this.stemLine.updateMatrix();this.stemLine.material.color.fromArray(e.color),super.update()}renderHTMLElement(e,t,n){super.renderHTMLElement(e,t,n,this.stemLine,v);const i=a.Z.scaleLimit(this.viewAngle*a.Z.RAD2DEG,90,100,1,0),s=this.annotation.data.visible?i:0;if(this.stemLine.material.opacity=s,e.setOpacity(s),this.orientationQuadrant!==this.quadrant&&(e.classList.remove(f[this.quadrant]),e.classList.add(f[this.orientationQuadrant]),this.quadrant=this.orientationQuadrant),this.adaptive!==this.isAdaptive&&(this.isAdaptive?e.classList.remove("sv-static-width"):(e.classList.add("sv-static-width"),e.truncated=!1,e.classList.remove("sv-short"),e.requestUpdate()),this.adaptive=this.isAdaptive),this.setVisible(!this.isBehindCamera(this.stemLine,n)),this.adaptive&&!this.isAnimating&&this.annotation.data.expanded){if(!e.truncated){if(!e.classList.contains("sv-expanded"))return void e.requestUpdate().then((()=>{this.originalHeight=e.offsetHeight,this.originalWidth=e.offsetWidth,this.checkTruncate(e,t)}));this.originalHeight=e.offsetHeight,this.originalWidth=e.offsetWidth}this.checkTruncate(e,t)}}createHTMLElement(){return new b(this)}checkTruncate(e,t){const n=this.quadrant==p.hf.TopLeft||this.quadrant==p.hf.TopRight,i=this.quadrant==p.hf.TopRight||this.quadrant==p.hf.BottomRight,s=i?e.getBoundingClientRect().left-t.getBoundingClientRect().left:e.getBoundingClientRect().right-t.getBoundingClientRect().left,r=n?e.getBoundingClientRect().bottom-t.getBoundingClientRect().top:e.getBoundingClientRect().top-t.getBoundingClientRect().top,o=n?r-this.originalHeight<=0:r+this.originalHeight>=t.offsetHeight,a=i?s+this.originalWidth>=t.offsetWidth:s-this.originalWidth<=0,l=o||a;l!==e.truncated&&(e.truncated=l,l?e.classList.add("sv-short"):e.classList.remove("sv-short"),e.requestUpdate().then((()=>{})))}}y.typeName="Extended",u.Z.registerType(y);let b=class extends d.m${constructor(e){super(e),this.isExpanded=void 0,this.onClickTitle=this.onClickTitle.bind(this),this.onClickArticle=this.onClickArticle.bind(this),this.onClickAudio=this.onClickAudio.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onClickOverlay=this.onClickOverlay.bind(this),this.titleElement=this.appendElement("div"),this.titleElement.classList.add("sv-title"),this.titleElement.addEventListener("click",this.onClickTitle),this.wrapperElement=this.appendElement("div"),this.contentElement=this.createElement("div",null,this.wrapperElement),this.contentElement.classList.add("sv-annotation-body"),this.contentElement.style.display="none"}firstConnected(){super.firstConnected(),this.classList.add("sv-extended-annotation")}update(e){super.update(e);const t=this.sprite.annotation,n=this.sprite.annotation.data,i=this.sprite.audioManager,s=!this.overlayed&&this.truncated&&(n.imageUri||n.articleId||t.lead.length>0);this.titleElement.innerText=this.sprite.annotation.title;const r=c.dy` + ${n.imageUri&&!s?c.dy`
${t.imageAltText}${t.imageCredit?c.dy`
${t.imageCredit}
`:null}
`:null} + ${s?null:c.dy`

${(0,h.A)(t.lead)}

`} + ${n.audioId&&!this.overlayed?c.dy`
`:null} + ${n.articleId&&!s?c.dy``:null} + ${s?c.dy``:null}`;(0,c.sY)(r,this.contentElement),g.fromArray(n.color),this.style.borderColor=g.toString(),this.isExpanded&&(this.contentElement.style.height="auto"),this.isExpanded===n.expanded||this.overlayed||(this.isExpanded=n.expanded,this.isExpanded?(n.audioId&&this.querySelector("#audio_container").append(i.getPlayerById(n.audioId)),this.classList.add("sv-expanded"),this.style.minWidth=this.sprite.annotation.lead.length<40&&(!n.audioId||0==n.audioId.length)?"0":"",this.contentElement.style.display="block",this.contentElement.style.height="auto"):(this.classList.remove("sv-expanded"),this.contentElement.style.height="0",this.contentElement.style.display="none",i.activeId==n.audioId&&this.sprite.audioManager.stop()));const o=this.querySelector(".sv-audio-view");if(n.audioId&&!this.overlayed)if(n.expanded&&!o){this.querySelector("#audio_container").append(i.getPlayerById(n.audioId))}else!n.expanded&&o&&i.activeId==n.audioId&&i.stop()}onClickTitle(e){e.stopPropagation(),this.sprite.emitClickEvent()}onClickArticle(e){e.stopPropagation(),this.sprite.emitLinkEvent(this.sprite.annotation.data.articleId)}onClickAudio(e){e.stopPropagation()}onClickOverlay(e){e.stopPropagation();const t=this.contentElement;this.overlayed=!0,this.showOverlay(t)}onKeyDown(e){"Space"!==e.code&&"Enter"!==e.code||(e.stopPropagation(),this.sprite.emitClickEvent())}};b=m([(0,c.Mo)("sv-extended-annotation")],b)},91013:(e,t,n)=>{"use strict";var i=n(19588),s=n(75809),r=n(64026),o=n(93122),a=n(28581),l=n(47855),c=n(51120),h=(n(98595),n(56752)),d=n(41029),u=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};const p=["sv-q0","sv-q1","sv-q2","sv-q3"],m=new l.ZP,f=new i.P(0,1,0);class g extends h.ZP{constructor(e){super(e),this.quadrant=-1,this.adaptive=!0;const t=[];t.push(new i.P(0,0,0)),t.push(new i.P(0,1,0));const n=(new s.u).setFromPoints(t),a=new r.n({color:"#009cde",transparent:!0});a.toneMapped=!1,this.stemLine=new o.x(n,a),this.stemLine.frustumCulled=!1,this.stemLine.matrixAutoUpdate=!1,this.add(this.stemLine),this.update()}update(){const e=this.annotation.data;this.stemLine.scale.setScalar(e.scale),this.stemLine.position.y=e.offset,this.stemLine.updateMatrix();this.stemLine.material.color.fromArray(e.color),super.update()}renderHTMLElement(e,t,n){super.renderHTMLElement(e,t,n,this.stemLine,f);const i=a.Z.scaleLimit(this.viewAngle*a.Z.RAD2DEG,90,100,1,0),s=this.annotation.data.visible?i:0;this.stemLine.material.opacity=s,e.setOpacity(s),this.orientationQuadrant!==this.quadrant&&(e.classList.remove(p[this.quadrant]),e.classList.add(p[this.orientationQuadrant]),this.quadrant=this.orientationQuadrant),this.adaptive!==this.isAdaptive&&(this.isAdaptive?e.classList.remove("sv-static-width"):e.classList.add("sv-static-width"),this.adaptive=this.isAdaptive),this.setVisible(!this.isBehindCamera(this.stemLine,n))}createHTMLElement(){return new v(this)}}g.typeName="Standard",d.Z.registerDefaultType(g);let v=class extends h.m${constructor(e){super(e),this.onClickTitle=this.onClickTitle.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.titleElement=this.appendElement("div"),this.titleElement.classList.add("sv-title"),this.titleElement.addEventListener("click",this.onClickTitle)}firstConnected(){super.firstConnected(),this.classList.add("sv-standard-annotation")}update(e){super.update(e);const t=this.sprite.annotation.data;t.viewId.length?this.classList.add("sv-enable-events"):this.classList.remove("sv-enable-events"),this.titleElement.innerText=this.sprite.annotation.title,m.fromArray(t.color),this.style.borderColor=m.toString()}onClickTitle(e){e.stopPropagation(),this.sprite.emitClickEvent()}onKeyDown(e){"Space"!==e.code&&"Enter"!==e.code||(e.stopPropagation(),this.sprite.emitClickEvent())}};v=u([(0,c.Mo)("sv-standard-annotation")],v)},13772:(e,t,n)=>{"use strict";n.d(t,{Z:()=>ee});var i=n(31741),s=n(96561),r=n(26041),o=n(10564),a=n(56166),l=n(89167),c=n(31491),h=n(22040),d=(n(98595),n(18257),n(85203),n(44661)),u=n(97008),p=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class m extends u.ZP{createView(){return new f(this)}}m.typeName="CVViewTool",m.text="View",m.icon="eye";let f=class extends u.v5{firstConnected(){super.firstConnected(),this.classList.add("sv-view-tool-view")}render(){const e=this.activeDocument;if(!e)return u.dy``;this.tool;const t=e.setup.navigation,n=e.setup.language,i=t.ins.projection,s=t.ins.preset,r=t.ins.zoomExtents,o=[d.LY.Front,d.LY.Back,d.LY.Left,d.LY.Right,d.LY.Top,d.LY.Bottom];return u.dy``}onActiveDocument(e,t){this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};f=p([(0,u.Mo)("sv-view-tool-view")],f);var g=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class v extends u.ZP{createView(){return new y(this)}}v.typeName="CVRenderTool",v.text="Material",v.icon="palette";let y=class extends u.v5{constructor(){super(...arguments),this.viewer=null}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-render-tool-view")}render(){this.tool;const e=this.activeDocument,t=this.viewer;if(!t)return u.dy``;const n=t.ins.shader,i=e.setup.language;return u.dy`
+
+ +
+
`}onActiveDocument(e,t){this.viewer&&(this.viewer.ins.shader.off("value",this.onUpdate,this),this.viewer=null),t&&(this.viewer=t.setup.viewer,this.viewer.ins.shader.on("value",this.onUpdate,this))}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};y=g([(0,u.Mo)("sv-render-tool-view")],y);var b=n(76969),_=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class x extends u.ZP{createView(){return new w(this)}}x.typeName="CVEnvironmentTool",x.text="Environment",x.icon="environment";let w=class extends u.v5{firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-environment-tool-view")}render(){this.tool;if(!this.activeDocument)return u.dy`No active document`;const e=this.activeDocument.setup,t=e.grid,n=e.floor,i=e.background,s=i.ins.style.getValidatedValue()===b.u.Solid,r=e.environment,o=e.language;return u.dy`
+
+ + + ${s?null:u.dy``} + + + + + +
+
`}onActiveDocument(e,t){if(e){e.setup.background.ins.style.off("value",this.onUpdate,this)}if(t){t.setup.background.ins.style.on("value",this.onUpdate,this)}this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};w=_([(0,u.Mo)("sv-environment-tool-view")],w);var S=n(16967),M=(n(97010),n(90470),n(46436),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});class E extends u.ZP{constructor(){super(...arguments),this.lights=[],this.ins=this.addInputs(E.ins),this.outs=this.addOutputs(E.outs)}update(e){return this.outs.light.setValue(this.lights[this.ins.light.getValidatedValue()]),!0}createView(){return new T(this)}onActiveDocument(e,t){this.lights=t?t.getInnerComponents(S.Z):[],this.ins.light.setOptions(this.lights.map((e=>e.node.name))),this.outs.light.setValue(this.lights[0]),super.onActiveDocument(e,t)}}E.typeName="CVLightTool",E.text="Lights",E.icon="bulb",E.ins={light:u.V5.Option("Tool.Light",[])},E.outs={light:u.V5.Object("Tool.SelectedLight",S.Z)};let T=class extends u.v5{constructor(){super(...arguments),this.lights=null}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-light-tool-view")}connected(){super.connected(),this.tool.outs.light.on("value",this.onUpdate,this)}disconnected(){this.tool.outs.light.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.tool,t=e.lights,n=this.activeDocument;if(!t||!n)return u.dy`No editable lights in this scene.`;const i=e.outs.light.value,s=n.setup.navigation,r=n.setup.language,o=i?u.dy`
+ +
+ + + +
+
`:null;return u.dy`${o}
+
+ + +
+
`}onActiveDocument(e,t){e&&e.setup.navigation.ins.lightsFollowCamera.off("value",this.onUpdate,this),t&&t.setup.navigation.ins.lightsFollowCamera.on("value",this.onUpdate,this),this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("sv-property-options")[0].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};T=M([(0,u.Mo)("sv-light-tool-view")],T);n(77804);var C=n(29767),A=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class P extends u.ZP{createView(){return new R(this)}}P.typeName="CVTapeTool",P.text="Measure",P.icon="tape";let R=class extends u.v5{constructor(){super(...arguments),this.firstRender=!0,this.statusMsg=""}firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-tape-tool-view")}render(){const e=this.activeDocument;if(!e)return u.dy``;this.tool;const t=e.setup.tape,n=t.ins.enabled,i=t.outs.state.value,s=t.outs.distance.value,r=e.setup.language;let o;if(n.value)if(0===s)o=r.getLocalizedString("Tap on model to set start of tape")+".";else if(i===C.T.SetStart){const t=e.root.scene.ins.units.getOptionText();o=`${s.toFixed(2)} ${t}`}else o=r.getLocalizedString("Tap on model to set end of tape")+".";else o=r.getLocalizedString("Switch on to take measurements")+".";return this.statusMsg=o,u.dy`
+
+ +
+
+
`}updated(e){super.updated(e);const t=this.getElementsByClassName("ff-string").item(0);t&&(t.innerHTML=this.statusMsg,this.firstRender&&(setTimeout((()=>{t.innerHTML=`
${this.statusMsg}
`}),200),this.firstRender=!1))}onActiveDocument(e,t){e&&e.setup.tape.off("update",this.onUpdate,this),t&&t.setup.tape.on("update",this.onUpdate,this),this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("ff-button")[1].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};R=A([(0,u.Mo)("sv-tape-tool-view")],R);var L=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class N extends u.ZP{createView(){return new D(this)}}N.typeName="CVSliceTool",N.text="Slice",N.icon="knife";let D=class extends u.v5{firstConnected(){super.firstConnected(),this.classList.add("sv-group","sv-slice-tool-view")}render(){const e=this.activeDocument;if(!e)return u.dy``;this.tool;const t=e.setup.slicer,n=t.ins.enabled,i=t.ins.axis,s=t.ins.position,r=e.setup.language;return u.dy`
+
+ + + +
+
`}onActiveDocument(e,t){this.requestUpdate()}async setFocus(){await this.updateComplete;this.getElementsByTagName("ff-button")[1].focus()}onClose(e){this.parentElement.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}};D=L([(0,u.Mo)("sv-slice-tool-view")],D);var I=n(90199);class O extends I.Z{get toolProvider(){return this.getComponent(h.Z)}createComponents(){this.createComponent(h.Z),this.createComponent(m),this.createComponent(v),this.createComponent(x),this.createComponent(E),this.createComponent(P),this.createComponent(N)}}O.typeName="NVTools";const U=[c.Z,h.Z,m,v,x,E,P,N,O];var k=n(47227),V=n(25864),z=n(63872),F=n(68327),B=n(11359),$=n(38303),j=n(87203),H=n(94860),G=n(43875),Z=n(30242),W=n(40490),q=n(60206),X=n(15271),Y=n(88300),K=n(26629),J=n(51462),Q=n(1594);class ee{constructor(e,t,n){this.props=t||{},console.log(ee.splashMessage);const i=new r.Z;i.add(l.Z),i.add(U),this.commander=new s.Z;const o=this.system=new a.Z(i),c=o.graph.createCustomNode($.Z);o.graph.createCustomNode(O),o.graph.createCustomNode(j.Z),this.analytics.startTimer(),e&&new H.Z(this).appendTo(e),n||(this.documentProvider.createDocument(k),this.evaluateProps());(/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1)&&(window.createImageBitmap=void 0),c.pulse.start()}get assetManager(){return this.system.getMainComponent(z.Z)}get assetReader(){return this.system.getMainComponent(F.Z)}get documentProvider(){return this.system.getMainComponent(V.Z)}get analytics(){return this.system.getMainComponent(B.Z)}dispose(){this.assetReader.dispose(),this.documentProvider.activeComponent.clearNodeTree(),this.system.getMainComponent(X.Z).views.forEach((e=>e.dispose()))}setBaseUrl(e){this.assetManager.baseUrl=e}loadDocument(e,t,n){const i=G.$l[n];return this.assetReader.getJSON(e).then((n=>(t=void 0===t?!n.lights&&!n.cameras:t,this.documentProvider.amendDocument(n,e,t)))).then((e=>(isFinite(i)&&e.setup.viewer.ins.quality.setValue(i),e)))}reloadDocument(){this.documentProvider.removeActiveDocument(),this.documentProvider.createDocument(k),this.evaluateProps()}loadModel(e,t){return this.documentProvider.appendModel(e,t)}loadGeometry(e,t,n,i,s){return this.documentProvider.appendGeometry(e,t,n,i,s)}evaluateProps(){const e=this.props,t=this.assetManager;e.root=e.root||(0,i.Z)("root")||(0,i.Z)("r"),e.dracoRoot=e.dracoRoot||(0,i.Z)("dracoRoot")||(0,i.Z)("dr"),e.resourceRoot=e.resourceRoot||(0,i.Z)("resourceRoot")||(0,i.Z)("rr"),e.document=e.document||(0,i.Z)("document")||(0,i.Z)("d"),e.model=e.model||(0,i.Z)("model")||(0,i.Z)("m"),e.geometry=e.geometry||(0,i.Z)("geometry")||(0,i.Z)("g"),e.texture=e.texture||(0,i.Z)("texture")||(0,i.Z)("t"),e.occlusion=e.occlusion||(0,i.Z)("occlusion")||(0,i.Z)("o"),e.normals=e.normals||(0,i.Z)("normals")||(0,i.Z)("n"),e.quality=e.quality||(0,i.Z)("quality")||(0,i.Z)("q"),e.uiMode=e.uiMode||(0,i.Z)("uiMode")||(0,i.Z)("u"),e.bgColor=e.bgColor||(0,i.Z)("bgColor")||(0,i.Z)("bc"),e.bgStyle=e.bgStyle||(0,i.Z)("bgStyle")||(0,i.Z)("bs"),e.controls=e.controls||(0,i.Z)("controls")||(0,i.Z)("ct"),e.prompt=e.prompt||(0,i.Z)("prompt")||(0,i.Z)("pm"),e.reader=e.reader||(0,i.Z)("reader")||(0,i.Z)("rdr"),e.lang=e.lang||(0,i.Z)("lang")||(0,i.Z)("l");const n=e.root||e.document||e.model||e.geometry;if(this.setBaseUrl(new URL(n||".",window.location).href),e.uiMode){let t=0,n=!1;const i=Object.values(W.p).filter((e=>"string"==typeof e));e.uiMode.split("|").forEach((e=>{const s=e.toLowerCase();i.includes(s)&&(t+=W.p[s],n=!0)})),n&&this.documentProvider.activeComponent.setup.interface.ins.visibleElements.setValue(t)}e.dracoRoot&&this.assetReader.setDracoPath(e.dracoRoot),e.resourceRoot&&this.assetReader.setSystemAssetPath(e.resourceRoot),e.lang&&this.setLanguage(e.lang),e.document?(e.document=t.getAssetName(e.document),this.loadDocument(e.document,void 0,e.quality).then((()=>this.postLoadHandler(e))).catch((e=>o.ZP.show(`Failed to load document: ${e.message}`,"error")))):e.model?(e.model=t.getAssetName(e.model),this.assetReader.getText(e.model).then((()=>{this.loadModel(e.model,e.quality),this.postLoadHandler(e)})).catch((e=>o.ZP.show(`Bad Model Path: ${e.message}`,"error")))):e.geometry?(e.geometry=t.getAssetName(e.geometry),e.texture=t.getAssetName(e.texture),e.occlusion=t.getAssetName(e.occlusion),e.normals=t.getAssetName(e.normals),this.assetReader.getText(e.geometry).then((()=>{this.loadGeometry(e.geometry,e.texture,e.occlusion,e.normals,e.quality),this.postLoadHandler(e)})).catch((e=>o.ZP.show(`Bad Geometry Path: ${e.message}`,"error")))):e.root&&this.loadDocument("scene.svx.json",void 0).then((()=>this.postLoadHandler(e))).catch((()=>{}))}postLoadHandler(e){if(this.assetManager.ins.baseUrlValid.setValue(!0),e.bgColor){const t=e.bgColor.split(" ");this.setBackgroundColor(t[0],t[1]||null)}e.bgStyle&&this.setBackgroundStyle(e.bgStyle),e.controls&&this.enableNavigation(e.controls),e.prompt&&this.enablePrompt(e.prompt),e.reader&&this.enableReader(e.reader)}toggleAnnotations(){const e=this.system.getMainComponent(V.Z).activeComponent.setup.viewer.ins,t=this.system.getMainComponent(h.Z).ins;t.visible.value&&t.visible.setValue(!1),e.annotationsVisible.setValue(!e.annotationsVisible.value),this.analytics.sendProperty("Annotations_Visible",e.annotationsVisible.value)}toggleReader(){const e=this.system.getMainComponent(V.Z).activeComponent.setup.reader,t=e.ins;t.enabled.setValue(!t.enabled.value),t.focus.setValue(t.enabled.value),t.enabled.value&&t.articleId.setValue(1===e.articles.length?e.articles[0].article.id:""),this.analytics.sendProperty("Reader_Enabled",t.enabled.value)}toggleTours(){const e=this.system.getMainComponent(V.Z).activeComponent.setup.tours.ins,t=this.system.getMainComponent(V.Z).activeComponent.setup.reader.ins;e.enabled.value?e.enabled.setValue(!1):(t.enabled.value&&t.enabled.setValue(!1),e.enabled.setValue(!0),e.tourIndex.setValue(-1)),this.analytics.sendProperty("Tours_Enabled",e.enabled.value)}toggleTools(){const e=this.system.getMainComponent(h.Z).ins,t=this.system.getMainComponent(V.Z).activeComponent.setup.viewer.ins;t.annotationsVisible.value&&t.annotationsVisible.setValue(!1),e.visible.setValue(!e.visible.value),this.analytics.sendProperty("Tools_Visible",e.visible.value)}toggleMeasurement(){const e=this.system.getMainComponent(V.Z).activeComponent.setup.tape.ins;e.visible.setValue(!e.visible.value)}enableAR(){this.system.getMainComponent(Z.Z).ins.enabled.setValue(!0),this.analytics.sendProperty("AR_enabled",!0)}getArticles(){return this.system.getMainComponent(V.Z).activeComponent.setup.reader.articles.map((e=>e.article.data))}getAnnotations(){const e=this.system.getComponent(K.Z).getGraphComponents(J.Z);let t=[];return e.forEach((e=>{t=t.concat(e.getAnnotations())})),t}getCameraOrbit(e){const t=this.system.getMainComponent(V.Z).activeComponent.setup.navigation.ins;let n=t.orbit.value;if(e){const i=e.toLowerCase();if("max"===i)n=t.maxOrbit.value;else if("min"===i)n=t.minOrbit.value;else if("active"!==i)return void console.error("Error: getCameraOrbit invalid type param.")}return n.slice(0,2)}setCameraOrbit(e,t){const n=this.system.getMainComponent(V.Z).activeComponent.setup.navigation.ins,i=parseFloat(e),s=parseFloat(t);isNaN(i)||isNaN(s)?console.error("Error: setCameraOrbit param is not a number."):n.orbit.setValue([i,s,0])}getCameraOffset(e){const t=this.system.getMainComponent(V.Z).activeComponent.setup.navigation.ins;let n=t.offset.value;if(e){const i=e.toLowerCase();if("max"===i)n=t.maxOffset.value;else if("min"===i)n=t.minOffset.value;else if("active"!==i)return void console.error("Error: getCameraOffset invalid type param.")}return n.slice(0,3)}setCameraOffset(e,t,n){const i=this.system.getMainComponent(V.Z).activeComponent.setup.navigation.ins;let s=parseFloat(e),r=parseFloat(t),o=parseFloat(n);if(isNaN(s)||isNaN(r)||isNaN(o))console.error("Error: setCameraOffset param is not a number.");else{const e=i.minOffset.value,t=i.maxOffset.value;s=(0,Y.u)(s,e[0],t[0]),r=(0,Y.u)(r,e[1],t[1]),o=(0,Y.u)(o,e[2],t[2]),i.offset.setValue([s,r,o])}}setBackgroundColor(e,t){const n=this.system.getMainComponent(V.Z).activeComponent.setup.background.ins,i=document.createElement("div");if(i.id="temp-color",i.style.color=e,document.body.appendChild(i),""!==i.style.color){const e=getComputedStyle(i).color.split("(")[1].split(")")[0].split(",").map((e=>parseInt(e)/255));n.color0.setValue(e)}else console.error("Error: Color0 param is invalid.");if(t)if(i.style.color=t,""!==i.style.color){const e=getComputedStyle(i).color.split("(")[1].split(")")[0].split(",").map((e=>parseInt(e)/255));n.color1.setValue(e)}else console.error("Error: Color1 param is invalid.");document.body.removeChild(i)}setBackgroundStyle(e){const t=this.system.getMainComponent(V.Z).activeComponent.setup.background.ins,n=Object.values(q.u6).filter((e=>"string"==typeof e)).find((t=>t.toLowerCase()===e.toLowerCase()));void 0!==n?t.style.setValue(q.u6[n]):console.error("Error: Style param is invalid.")}setTourStep(e,t,n){const i=this.system.getMainComponent(V.Z).activeComponent.setup.tours.ins,s=this.system.getMainComponent(V.Z).activeComponent.setup.tours.outs;let r=parseInt(e),o=parseInt(t);!isNaN(r)&&!isNaN(o)&&r>=0&&o>=0?(i.tourIndex.setValue(r),n?(s.stepIndex.setValue(o-1),i.next.set()):i.stepIndex.setValue(o)):console.error("Error: setTourStep param ["+r+" "+o+"] is not a valid number.")}enableNavigation(e){const t=this.isTrue(e);if(null!=t){this.system.getMainComponent(V.Z).activeComponent.setup.navigation.ins.pointerEnabled.setValue(t)}else console.error("Error: enableNavigation param is not valid.")}enablePrompt(e){const t=this.isTrue(e);if(null!=t){this.system.getMainComponent(V.Z).activeComponent.setup.navigation.ins.promptEnabled.setValue(t)}else console.error("Error: enablePrompt param is not valid.")}enableReader(e){const t=this.isTrue(e);if(null!=t){this.system.getMainComponent(V.Z).activeComponent.setup.reader.ins.visible.setValue(t)}else console.error("Error: enableReader param is not valid.")}setLanguage(e){const t=this.system.getMainComponent(V.Z).activeComponent.setup.language.ins,n=e.toUpperCase();n in Q.PD?t.language.setValue(Q.PD[n]):console.error("Error: setLanguage param is not a valid language id.")}setActiveArticle(e){const t=this.system.getMainComponent(V.Z).activeComponent.setup.reader;t.ins.enabled.setValue(!0),t.ins.articleId.setValue(e)}isTrue(e){let t;const n=e.toLowerCase();return"true"===n?t=!0:"false"===n&&(t=!1),t}}ee.splashMessage="\n _________ .__ __ .__ .__ ________ ________ \n / _____/ _____ |__|/ |_| |__ __________ ____ |__|____ ____ \\_____ \\\\______ \\ \n \\_____ \\ / \\| \\ __\\ | \\ / ___/ _ \\ / \\| \\__ \\ / \\ _(__ < | | \\ \n / \\ Y Y \\ || | | Y \\\\___ ( <_> ) | \\ |/ __ \\| | \\ / \\| ` \\\n/_______ /__|_| /__||__| |___| /____ >____/|___| /__(____ /___| / /______ /_______ /\n \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \n \nVoyager - 3D Explorer and Tool Suite\n3D Foundation Project\n(c) 2024 Smithsonian Institution\n\nhttps://3d.si.edu\nhttps://github.com/smithsonian/dpo-voyager\n\n-----------------------------------------------------\nVersion: Voyager v0.42.1 PROD\n-----------------------------------------------------\n ",window.VoyagerExplorer=ee},89167:(e,t,n)=>{"use strict";n.d(t,{Z:()=>me,J:()=>pe});var i=n(18894),s=n(26220),r=n(63833),o=n(92989),a=n(403),l=n(15271),c=n(38080),h=n(18345),d=n(36283),u=n(90199),p=n(11359),m=n(63872),f=n(68327),g=n(48377),v=n(25864),y=n(26629),b=n(79815),_=n(13227),x=n(84678),w=n(3388),S=n(80038);class M extends S.ZP{constructor(){super(...arguments),this.ins=this.addInputs(M.ins)}get model(){return this.getComponent(w.Z)}update(e){return!0}}M.typeName="CVAnnotations",M.ins={};var E=n(51462),T=n(31105),C=n(27884),A=n(53414),P=n(19588),R=n(54992),L=n(16967);new P.P;class N extends L.Z{constructor(e,t){super(e,t),this.ins=this.addInputs(N.pointLightIns),this.object3D=new R.c}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return n.position.changed&&(t.position.fromArray(n.position.value),t.updateMatrix()),(n.distance.changed||n.decay.changed)&&(t.distance=n.distance.value,t.decay=n.decay.value,t.shadow.camera.near=t.distance?t.distance/800:.5),t.updateMatrix(),!0}}N.typeName="CPointLight",N.pointLightIns={position:S.V5.Vector3("Light.Position"),distance:S.V5.Number("Light.Distance"),decay:S.V5.Number("Light.Decay",1)};class D extends N{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.distance,this.ins.decay,this.ins.shadowEnabled,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}dispose(){this.ins.shadowEnabled.value&&this.light.shadow.map&&this.light.shadow.map.dispose(),super.dispose()}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if(n.type!==D.type)throw new Error("light type mismatch: not a point light");return n.point=n.point||{},i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,distance:n.point.distance||i.distance.schema.preset,decay:void 0!==n.point.decay?n.point.decay:i.decay.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowResolution:void 0!==n.shadowResolution&&L.B[n.shadowResolution]||1,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,point:{distance:n.distance.value,decay:n.decay.value}};i.type=D.type,n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=L.B[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}D.typeName="CVPointLight",D.type="point",D.text="Point Light",D.icon="bulb";var I=n(16426),O=n(71050);class U extends L.Z{constructor(e,t){super(e,t),this.ins=this.addInputs(U.spotLightIns),this.object3D=new I.P,this.light.target.matrixAutoUpdate=!1}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return(n.position.changed||n.target.changed)&&(t.position.fromArray(n.position.value),t.target.position.fromArray(n.target.value),t.updateMatrix(),t.target.updateMatrix()),(n.distance.changed||n.decay.changed||n.angle.changed||n.penumbra.changed)&&(t.distance=n.distance.value,t.decay=n.decay.value,t.angle=n.angle.value*O.M8.DEG2RAD,t.penumbra=n.penumbra.value,t.shadow.camera.near=t.distance?t.distance/800:.5),!0}onAddToParent(e){super.onAddToParent(e),e.add(this.light.target)}onRemoveFromParent(e){super.onRemoveFromParent(e),e.remove(this.light.target)}}U.typeName="CSpotLight",U.spotLightIns={position:S.V5.Vector3("Light.Position"),target:S.V5.Vector3("Light.Target",[0,-1,0]),distance:S.V5.Number("Light.Distance"),decay:S.V5.Number("Light.Decay",1),angle:S.V5.Number("Light.Angle",45),penumbra:S.V5.Percent("Light.Penumbra",.5)};class k extends U{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.distance,this.ins.decay,this.ins.angle,this.ins.penumbra,this.ins.shadowEnabled,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}dispose(){this.ins.shadowEnabled.value&&this.light.shadow.map&&this.light.shadow.map.dispose(),super.dispose()}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if(n.type!==k.type)throw new Error("light type mismatch: not a spot light");return n.spot=n.spot||{},i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,target:i.target.schema.preset,distance:n.spot.distance||i.distance.schema.preset,decay:void 0!==n.spot.decay?n.spot.decay:i.decay.schema.preset,angle:void 0!==n.spot.angle?n.spot.angle:i.angle.schema.preset,penumbra:n.spot.penumbra||i.penumbra.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowResolution:void 0!==n.shadowResolution&&L.B[n.shadowResolution]||1,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,spot:{distance:n.distance.value,decay:n.decay.value,angle:n.angle.value,penumbra:n.penumbra.value}};i.type=k.type,n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=L.B[n.shadowResolution.value])),e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}k.typeName="CVSpotLight",k.type="spot",k.text="Spot Light",k.icon="spot";var V=n(40490),z=n(27643),F=n(5249),B=n(44661),$=n(71507),j=n(97322),H=n(6461),G=n(29767),Z=n(63531),W=n(7134),q=n(74572),X=n(24856),Y=n(30242),K=n(93072),J=n(17467),Q=n(38303),ee=n(87203),te=n(82567),ne=n(75222),ie=n(19816);class se extends ie._{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class re extends L.Z{constructor(e,t){super(e,t),this.object3D=new se}get light(){return this.object3D}}re.typeName="CAmbientLight";class oe extends re{get settingProperties(){return[this.ins.color,this.ins.intensity]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}dispose(){super.dispose()}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if(n.type!==oe.type)throw new Error("light type mismatch: not an ambient light");return n.point=n.point||{},i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value};i.type=oe.type,e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}oe.typeName="CVAmbientLight",oe.type="ambient",oe.text="Ambient Light",oe.icon="globe";var ae=n(57090);class le extends L.Z{constructor(e,t){super(e,t),this.ins=this.addInputs(le.hemiLightIns),this.object3D=new ae.v}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return(n.ground.changed||n.intensity.changed)&&(t.groundColor.fromArray(n.ground.value),t.intensity=n.intensity.value),!0}}le.typeName="CHemisphereLight",le.hemiLightIns={ground:S.V5.ColorRGB("Light.Ground",[.31,.31,.125])};class ce extends le{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.ground]}get snapshotProperties(){return[this.ins.color,this.ins.intensity,this.ins.ground]}dispose(){super.dispose()}fromDocument(e,t){var n,i;if(!isFinite(t.light))throw new Error("light property missing in node");const s=e.lights[t.light],r=this.ins;if(s.type!==ce.type)throw new Error("light type mismatch: not an hemisphere light");return s.point=s.point||{},r.copyValues({color:void 0!==s.color?s.color:r.color.schema.preset,intensity:void 0!==s.intensity?s.intensity:r.intensity.schema.preset,ground:null!==(i=null===(n=s.hemisphere)||void 0===n?void 0:n.ground)&&void 0!==i?i:r.ground.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value,hemisphere:{ground:n.ground.cloneValue()}};i.type=ce.type,e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}ce.typeName="CVHemisphereLight",ce.type="hemisphere",ce.text="Hemisphere Light",ce.icon="half-sun";var he=n(50910);class de extends L.Z{constructor(e,t){super(e,t),this.ins=this.addInputs(de.rectLightIns),this.object3D=new he.T}get light(){return this.object3D}update(e){super.update(e);const t=this.light,n=this.ins;return(n.position.changed||n.target.changed)&&(t.position.fromArray(n.position.value),t.updateMatrix()),!0}}de.typeName="CRectLight",de.rectLightIns={position:S.V5.Vector3("Light.Position",[0,1,0]),target:S.V5.Vector3("Light.Target",[0,0,0]),size:S.V5.Vector2("Light.Size",[10,10])};class ue extends de{get settingProperties(){return[this.ins.color,this.ins.intensity]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}dispose(){super.dispose()}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if(n.type!==ue.type)throw new Error(`light type mismatch: not a directional light (${n.type})`);return i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,target:i.target.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value};i.type=ue.type,e.lights=e.lights||[];const s=e.lights.length;return e.lights.push(i),s}}ue.typeName="CVRectLight",ue.type="rect",ue.text="Rectangular Light",ue.icon="area";const pe=[A.Z,D,k,oe,ce,ue],me=[i.ZP,s.Z,r.Z,o.Z,a.Z,l.Z,c.Z,h.Z,d.Z,u.Z,p.Z,Y.Z,m.Z,f.Z,g.Z,v.Z,y.Z,b.Z,_.Z,x.Z,w.Z,M,E.Z,T.Z,C.Z,...pe,V.Z,z.Z,F.ZP,B.ZP,$.Z,j.Z,H.Z,G.Z,Z.Z,W.Z,q.Z,X.Z,K.Z,J.Z,Q.Z,ee.Z,te.Z,ne.Z]},30242:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Ye});var i={};n.r(i),n.d(i,{ArcCurve:()=>E,CatmullRomCurve3:()=>L,CubicBezierCurve:()=>O,CubicBezierCurve3:()=>U,EllipseCurve:()=>M,LineCurve:()=>k,LineCurve3:()=>V,QuadraticBezierCurve:()=>z,QuadraticBezierCurve3:()=>F,SplineCurve:()=>B});var s=n(80038),r=n(15271),o=n(92642),a=n(26220),l=n(10564),c=n(82587),h=n(19588),d=n(40693),u=n(37840),p=n(78943),m=n(96643),f=n(45787);class g{constructor(e,t,n=0,i=1/0){this.ray=new m.z(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new f.S,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return y(e,this,n,t),n.sort(v),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i0)){l=i;break}l=i-1}if(i=l,n[i]===r)return i/(s-1);const c=n[i];return(i+(r-c)/(n[i+1]-c))/(s-1)}getTangent(e,t){const n=1e-4;let i=e-n,s=e+n;i<0&&(i=0),s>1&&(s=1);const r=this.getPoint(i),o=this.getPoint(s),a=t||(r.isVector2?new d.F:new h.P);return a.copy(o).sub(r).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new h.P,i=[],s=[],r=[],o=new h.P,a=new c.y;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new h.P)}s[0]=new h.P,r[0]=new h.P;let l=Number.MAX_VALUE;const d=Math.abs(i[0].x),u=Math.abs(i[0].y),p=Math.abs(i[0].z);d<=l&&(l=d,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),p<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),r[0].crossVectors(i[0],s[0]);for(let t=1;t<=e;t++){if(s[t]=s[t-1].clone(),r[t]=r[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(w.uZ(i[t-1].dot(i[t]),-1,1));s[t].applyMatrix4(a.makeRotationAxis(o,e))}r[t].crossVectors(i[t],s[t])}if(!0===t){let t=Math.acos(w.uZ(s[0].dot(s[e]),-1,1));t/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(t=-t);for(let n=1;n<=e;n++)s[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),r[n].crossVectors(i[n],s[n])}return{tangents:i,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class M extends S{constructor(e=0,t=0,n=1,i=1,s=0,r=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=o,this.aRotation=a}getPoint(e,t){const n=t||new d.F,i=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(l)/s)+1)*s:0===c&&l===s-1&&(l=s-2,c=1),this.closed||l>0?o=i[(l-1)%s]:(C.subVectors(i[0],i[1]).add(i[0]),o=C);const d=i[l%s],u=i[(l+1)%s];if(this.closed||l+2i.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2];return n.set(N(o,a.x,l.x,c.x,h.x),N(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[s]-n,r=this.curves[s],o=r.getLength(),a=0===o?0:1-e/o;return r.getPointAt(a,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class H extends j{constructor(e){super(e),this.uuid=w.DO(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*n){a=c=e[0],l=h=e[1];for(let t=n;tc&&(c=d),u>h&&(h=u);p=Math.max(c-a,h-l),p=0!==p?32767/p:0}return Y(r,o,n,a,l,p,0),o};function q(e,t,n,i,s){let r,o;if(s===function(e,t,n,i){let s=0;for(let r=t,o=n-i;r0)for(r=t;r=t;r-=i)o=fe(r,e[r],e[r+1],o);return o&&ce(o,o.next)&&(ge(o),o=o.next),o}function X(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!ce(i,i.next)&&0!==le(i.prev,i,i.next))i=i.next;else{if(ge(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Y(e,t,n,i,s,r,o){if(!e)return;!o&&r&&function(e,t,n,i){let s=e;do{0===s.z&&(s.z=se(s.x,s.y,t,n,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,function(e){let t,n,i,s,r,o,a,l,c=1;do{for(n=e,e=null,r=null,o=0;n;){for(o++,i=n,a=0,t=0;t0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(s=n,n=n.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:e=s,s.prevZ=r,r=s;n=i}r.nextZ=null,c*=2}while(o>1)}(s)}(e,i,s,r);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,r?J(e,i,s,r):K(e))t.push(a.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),ge(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Y(e=Q(X(e),t,n),t,n,i,s,r,2):2===o&&ee(e,t,n,i,s,r):Y(X(e),t,n,i,s,r,1);break}}function K(e){const t=e.prev,n=e,i=e.next;if(le(t,n,i)>=0)return!1;const s=t.x,r=n.x,o=i.x,a=t.y,l=n.y,c=i.y,h=sr?s>o?s:o:r>o?r:o,p=a>l?a>c?a:c:l>c?l:c;let m=i.next;for(;m!==t;){if(m.x>=h&&m.x<=u&&m.y>=d&&m.y<=p&&oe(s,a,r,l,o,c,m.x,m.y)&&le(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function J(e,t,n,i){const s=e.prev,r=e,o=e.next;if(le(s,r,o)>=0)return!1;const a=s.x,l=r.x,c=o.x,h=s.y,d=r.y,u=o.y,p=al?a>c?a:c:l>c?l:c,g=h>d?h>u?h:u:d>u?d:u,v=se(p,m,t,n,i),y=se(f,g,t,n,i);let b=e.prevZ,_=e.nextZ;for(;b&&b.z>=v&&_&&_.z<=y;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&oe(a,h,l,d,c,u,b.x,b.y)&&le(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==s&&_!==o&&oe(a,h,l,d,c,u,_.x,_.y)&&le(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;b&&b.z>=v;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&oe(a,h,l,d,c,u,b.x,b.y)&&le(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;_&&_.z<=y;){if(_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==s&&_!==o&&oe(a,h,l,d,c,u,_.x,_.y)&&le(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Q(e,t,n){let i=e;do{const s=i.prev,r=i.next.next;!ce(s,r)&&he(s,i,i.next,r)&&pe(s,r)&&pe(r,s)&&(t.push(s.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),ge(i),ge(i.next),i=e=r),i=i.next}while(i!==e);return X(i)}function ee(e,t,n,i,s,r){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&ae(o,e)){let a=me(o,e);return o=X(o,o.next),a=X(a,a.next),Y(o,t,n,i,s,r,0),void Y(a,t,n,i,s,r,0)}e=e.next}o=o.next}while(o!==e)}function te(e,t){return e.x-t.x}function ne(e,t){const n=function(e,t){let n,i=t,s=-1/0;const r=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const e=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,n=i.x=i.x&&i.x>=l&&r!==i.x&&oe(on.x||i.x===n.x&&ie(n,i)))&&(n=i,d=h)),i=i.next}while(i!==a);return n}(e,t);if(!n)return t;const i=me(n,e);return X(i,i.next),X(n,n.next)}function ie(e,t){return le(e.prev,e,t.prev)<0&&le(t.next,e,e.next)<0}function se(e,t,n,i,s){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function re(e){let t=e,n=e;do{(t.x=(e-o)*(r-a)&&(e-o)*(i-a)>=(n-o)*(t-a)&&(n-o)*(r-a)>=(s-o)*(i-a)}function ae(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&he(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(pe(e,t)&&pe(t,e)&&function(e,t){let n=e,i=!1;const s=(e.x+t.x)/2,r=(e.y+t.y)/2;do{n.y>r!=n.next.y>r&&n.next.y!==n.y&&s<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(le(e.prev,e,t.prev)||le(e,t.prev,t))||ce(e,t)&&le(e.prev,e,e.next)>0&&le(t.prev,t,t.next)>0)}function le(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ce(e,t){return e.x===t.x&&e.y===t.y}function he(e,t,n,i){const s=ue(le(e,t,n)),r=ue(le(e,t,i)),o=ue(le(n,i,e)),a=ue(le(n,i,t));return s!==r&&o!==a||(!(0!==s||!de(e,n,t))||(!(0!==r||!de(e,i,t))||(!(0!==o||!de(n,e,i))||!(0!==a||!de(n,t,i)))))}function de(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ue(e){return e>0?1:e<0?-1:0}function pe(e,t){return le(e.prev,e,e.next)<0?le(e,t,e.next)>=0&&le(e,e.prev,t)>=0:le(e,t,e.prev)<0||le(e,e.next,t)<0}function me(e,t){const n=new ve(e.i,e.x,e.y),i=new ve(t.i,t.x,t.y),s=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function fe(e,t,n,i){const s=new ve(e,t,n);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function ge(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ve(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class ye{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s2&&e[t-1].equals(e[0])&&e.pop()}function _e(e,t){for(let n=0;n{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t})(),Ee=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,Te=Boolean(window.webkit&&window.webkit.messageHandlers),Ce=(()=>{if(Ee){if(Te)return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}}return!1})(),Ae=(/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent));var Pe=n(26629),Re=n(79815),Le=n(1594),Ne=n(37117),De=n(3388),Ie=n(63872),Oe=n(77656),Ue=n(63960),ke=n(93113);class Ve extends Ue.F{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ke.I(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class ze extends Oe.O{constructor(e,t,n){super(),this.shadowMaterial=new Ve,this.boundingBox=new u.Z,this.size=new h.P,this.isAnimated=!1,this.needsUpdate=!1,this.intensity=0,this.castShadow=!0,this.frustumCulled=!1,this.floor=new b.K(new _._,this.shadowMaterial),this.floor.rotateX(-Math.PI/2),this.floor.receiveShadow=!0,this.floor.castShadow=!1,this.floor.frustumCulled=!1,this.add(this.floor),this.shadow.camera.up.set(0,0,1),t.add(this),this.target=t,this.setModel(e,n)}setModel(e,t){this.boundingBox.copy(e.outs.boundingBox.value),e.outs.boundingBox.value.getSize(this.size);const{boundingBox:n,size:i}=this;if(this.isAnimated){const e=2*Math.max(i.x,i.y,i.z);i.y=e,n.expandByVector(i.subScalar(e).multiplyScalar(-.5)),n.max.y=n.min.y+e,i.set(e,e,e)}const s=.001*i.y;this.position.y=n.max.y+s,n.getCenter(this.floor.position),this.setSoftness(t)}setSoftness(e){const t=Math.pow(2,9-3*e);this.setMapSize(t)}setMapSize(e){const{camera:t,mapSize:n,map:i}=this.shadow,{size:s,boundingBox:r}=this;null!=i&&(i.dispose(),this.shadow.map=null),this.isAnimated&&(e*=2);const o=Math.floor(s.x>s.z?e:e*s.x/s.z),a=Math.floor(s.x>s.z?e*s.z/s.x:e);n.set(o,a);const l=2.5*s.x/o,c=2.5*s.z/a;t.left=-r.max.x-l,t.right=-r.min.x+l,t.bottom=r.min.z-c,t.top=r.max.z+c,this.setScaleAndOffset(t.zoom,0),this.shadow.updateMatrices(this),this.floor.scale.set(s.x+2*l,s.z+2*c,1),this.needsUpdate=!0}setIntensity(e){this.shadowMaterial.opacity=e,e>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.shadowMaterial.opacity}setRotation(e){this.shadow.camera.up.set(Math.sin(e),0,Math.cos(e)),this.shadow.updateMatrices(this)}setScaleAndOffset(e,t){const n=this.size.y,i=1/e,s=.001*n;this.floor.position.y=2*s-n+t*i;const{camera:r}=this.shadow;r.zoom=e,r.near=0,r.far=n*e-t,r.projectionMatrix.makeOrthographic(r.left*e,r.right*e,r.top*e,r.bottom*e,r.near,r.far),r.projectionMatrixInverse.copy(r.projectionMatrix).invert(),this.shadow.updateMatrices(this)}updateMatrices(){this.shadow.updateMatrices(this)}dispose(){const{floor:e,shadowMaterial:t}=this;e.geometry.dispose(),t.dispose(),this.floor=null,this.shadowMaterial=null}}var Fe=n(53414),Be=n(60206),$e=n(11359),je=n(84678);const He=new c.y,Ge=new h.P,Ze=new d.F,We=new h.P,qe=new u.Z,Xe=new p._;class Ye extends s.ZP{constructor(){super(...arguments),this._shadowRoot=null,this._arCodeImage=null,this.ins=this.addInputs(Ye.ins),this.outs=this.addOutputs(Ye.outs),this.arLink=document.createElement("a"),this.raycaster=new g,this.initialHitTestSource=null,this.inputSource=null,this.transientHitTestSource=null,this.refSpace=null,this.frame=null,this.vScene=null,this.camera=null,this.cameraParent=null,this.cachedView=null,this.cachedQuality=null,this.cachedNearPlane=0,this.cachedFarPlane=0,this.xrCamera=null,this.hitPlane=null,this.selectionRing=null,this.session=null,this.setup=null,this.originalUnits=null,this.isTranslating=!1,this.isRotating=!1,this.isScaling=!1,this.lastDragValueX=0,this.lastDragValueY=0,this.totalDrag=0,this.lastScale=0,this.lastHitPosition=new h.P,this.lastFrameTime=0,this.targetOpacity=0,this.modelFloorOffset=0,this.optimalCameraDistance=0,this.shadow=null,this.lightTransform=null,this.lightsToReset=[],this.featuresToReset=[],this.annotationsAtLaunch=!1,this.scaleDisplay=null,this.updateScale=!1,this.placementRotation=new p._,this.onSessionEnded=()=>{this.outs.isPresenting.setValue(!1);const e=this.renderer.views[0].renderer;this.resetScene(),e.shadowMap.autoUpdate=!0;const t=this.initialHitTestSource;null!=t&&(t.cancel(),this.initialHitTestSource=null);const n=this.transientHitTestSource;null!=n&&(n.cancel(),this.transientHitTestSource=null),this.refSpace=null,this.frame=null,this.inputSource=null,this.xrCamera=null,this.cachedView=null,this.vScene=null,this.cachedView=null,this.camera=null;const i=this.session;i&&(i.removeEventListener("end",this.onSessionEnded),i.removeEventListener("selectstart",this.onSelectStart),i.removeEventListener("selectend",this.onSelectEnd),this.session=null),this.setup.reader.ins.enabled.off("value",this.endSession,this),e.setAnimationLoop(null),e.xr.enabled=!1,this.outs.isPlaced.setValue(!1),this.setup.navigation.ins.enabled.setValue(!0),this.renderer.views[0].render()},this.render=(e,t)=>{this.frame=t;const n=this.renderer.views[0].renderer,{camera:i,xrCamera:s,refSpace:r,initialHitTestSource:o,vScene:a,sceneNode:l,shadow:c,lastFrameTime:h}=this;if(!t||!t.getViewerPose(r))return;if(!s&&this.session){const e=n.xr.getCamera();return void(this.xrCamera=e.cameras[0])}if(s&&(n.xr.updateCamera(i),i.updateMatrixWorld(!0),i.projectionMatrix.fromArray(s.projectionMatrix.elements),i.projectionMatrixInverse.copy(s.projectionMatrix).invert()),null!=o&&s){const e=a.scene,{position:t}=e,n=2*l.outs.boundingRadius.value+s.near;s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const r=i.getWorldDirection(Ge);e.rotation.y=Math.atan2(-r.x,-r.z),t.copy(i.position).add(r.multiplyScalar(n)),this.shadow.setRotation(e.rotation.y),e.updateMatrix(),e.updateMatrixWorld()}if(this.setInitialPosition(t),this.handleInput(t),this.outs.isPlaced.value){const t=e-h;this.updateOpacity(t,this.targetOpacity),this.lastFrameTime=e}const d=n.getContext();if(d.depthMask(!1),d.clear(d.DEPTH_BUFFER_BIT),d.depthMask(!0),c.needsUpdate&&(n.shadowMap.needsUpdate=!0,c.needsUpdate=!1),this.updateScale){const e=a.scene,t=this.scaleDisplay;Ge.copy(e.position);const n=this.renderer.views[0].viewports[0].width,i=this.renderer.views[0].viewports[0].height,r=n/2,o=i/2,l=n-t.clientWidth,c=i-t.clientHeight;Ge.project(s),Ge.x=Math.min(Math.max(Ge.x*r+r,0),l),Ge.y=Math.min(Math.max(-Ge.y*o+o,0),c),t.style.left=Ge.x.toString()+"px",t.style.top=Ge.y.toString()+"px",t.innerText=Math.round(100*e.scale.x).toString()+"%"}n.render(a.scene,i)},this.onSelectStart=e=>{const t=this.vScene.scene,n=this.transientHitTestSource;if(null==n)return;this.targetOpacity=.5;const i=this.frame.getHitTestResultsForTransientInput(n);if(1===i.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,n=this.raycaster;Ze.set(t[0],-t[1]),n.setFromCamera(Ze,this.xrCamera);const i=n.intersectObject(this.hitPlane);i.length>0?(this.isTranslating=!0,this.lastHitPosition.copy(i[0].point)):!1===this.ins.wallMount.value&&(this.isRotating=!0),this.lastDragValueX=t[0],this.lastDragValueY=t[1]}else 2===i.length&&(this.isScaling=!0,this.lastScale=this.getFingerSeparation(i)/t.scale.x)},this.onSelectEnd=()=>{this.targetOpacity=0,this.totalDrag=0,this.isTranslating=!1,this.isRotating=!1,this.isScaling=!1,this.scaleDisplay.classList.remove("sv-show"),this.inputSource=null}}get renderer(){return this.getMainComponent(r.Z)}get pulse(){return this.getMainComponent(a.Z)}get sceneNode(){return this.getSystemComponent(Pe.Z)}get analytics(){return this.system.getMainComponent($e.Z)}get assetManager(){return this.getMainComponent(Ie.Z)}get shadowRoot(){return this._shadowRoot}set shadowRoot(e){this._shadowRoot=e}get arCodeImage(){const e=document.documentURI;if(null==this._arCodeImage&&e.includes(".si.edu")&&e.includes("3d-api")){const t=e.split("/").pop().split(":").pop();36==t.length&&(this._arCodeImage="https://3d-api.si.edu/voyager/"+t+"/qrcode")}return this._arCodeImage}create(){super.create(),this.system.components.on(je.Z,this.onMetaComponent,this)}dispose(){this.system.components.off(je.Z,this.onMetaComponent,this),super.dispose()}update(){const{ins:e,outs:t}=this;if(e.enabled.changed){let n=e.enabled.value;n&&(Se?(this.launchWebXR(),this.analytics.sendProperty("AR_Enabled","WebXR")):Ae?(this.launchSceneViewer(),this.analytics.sendProperty("AR_Enabled","SceneViewer")):Ee&&Ce?(this.launchQuickLook(),this.analytics.sendProperty("AR_Enabled","QuickLook")):(n=!1,this.analytics.sendProperty("AR_Enabled","Unavailable"),l.ZP.show("AR unavailable on this platform.","warning"))),t.enabled.setValue(n)}return!0}launchWebXR(){var e,t,n;const i=null===(e=this.renderer)||void 0===e?void 0:e.views[0].renderer,s=this.vScene=null===(t=this.renderer)||void 0===t?void 0:t.activeSceneComponent,r=this.camera=null==s?void 0:s.activeCamera;this.cameraParent=r.parent;if(!(this.setup=this.getSystemComponent(Re.Z)))return!1;const o=null===(n=this.sceneNode)||void 0===n?void 0:n.getGraphComponents(De.Z);let a=null;for(const e of o)if(a=e.derivatives.get(Ne._U.Web3D,Ne.$l.AR),null!=a)break;a&&(this.setup.navigation.setChanged(!0),this.cachedQuality=o[0].ins.quality.value,o.forEach((e=>{e.ins.quality.setValue(Ne.$l.AR)})),i.setAnimationLoop(((e,t)=>this.render(e,t))),navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay"],domOverlay:{root:this.shadowRoot.querySelector("ff-viewport-overlay")}}).then((e=>this.onSessionStarted(i,e))).catch((e=>{console.log("Error starting session: "+e),l.ZP.show("AR available but blocked. Please check your browser settings.","warning")})))}async onSessionStarted(e,t){const n=this.renderer.views[0].renderer.getContext();await n.makeXRCompatible(),t.updateRenderState({baseLayer:new XRWebGLLayer(t,n,{alpha:!0})}),this.setupScene(),e.shadowMap.autoUpdate=!1,e.xr.enabled=!0,e.xr.setReferenceSpaceType("local"),e.xr.setSession(t),await t.addEventListener("end",this.onSessionEnded),this.refSpace=await t.requestReferenceSpace("local");const i=await t.requestReferenceSpace("viewer");e.xr.cameraAutoUpdate=!1;const s=20*Math.PI/180,r=!0===this.ins.wallMount.value?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(s),z:-Math.cos(s)});t.requestHitTestSource({space:i,offsetRay:r}).then((e=>{this.initialHitTestSource=e})),this.outs.isPresenting.setValue(!0),this.session=t,this.lastFrameTime=performance.now(),this.setup.reader.ins.enabled.on("value",this.endSession,this)}endSession(){this.session&&this.session.end()}setupScene(){const{cameraParent:e,setup:t,featuresToReset:n}=this,i=this.sceneNode;e&&e.remove(this.camera),this.setup.background.hide(),this.setup.navigation.ins.enabled.setValue(!1);const s=i.graph.findNodeByName("Lights");(this.lightTransform=s.getComponent(o.ZP,!0)).ins.rotation.reset();const r=this.scaleDisplay=document.createElement("div");r.classList.add("sv-scale-annotation"),this.shadowRoot.querySelector("ff-viewport-overlay").appendChild(r),n.push(t.floor.ins.visible.value?1:0),n.push(t.grid.ins.visible.value?1:0),n.push(t.tape.ins.visible.value?1:0),n.push(t.slicer.ins.enabled.value?1:0),n.push(t.viewer.ins.shader.value),this.annotationsAtLaunch=t.viewer.ins.annotationsVisible.value,t.floor.ins.visible.setValue(!1),t.grid.ins.visible.setValue(!1),t.tape.ins.visible.setValue(!1),t.slicer.ins.enabled.setValue(!1),t.viewer.ins.shader.value!==Be.pH.Default&&t.viewer.ins.shader.setValue(Be.pH.Default),t.viewer.ins.annotationsVisible.setValue(!1);(this.originalUnits=i.ins.units.getValidatedValue())!=Le.f_.m&&this.sceneNode.ins.units.setValue(Le.f_.m);i.getGraphComponents(Fe.Z).forEach((e=>{e.ins.shadowEnabled.value&&(e.ins.shadowEnabled.setValue(!1),this.lightsToReset.push(e))})),this.pulse.pulse(Date.now()),i.update(null);(this.shadow=new ze(this.sceneNode,this.vScene.scene,.5)).setIntensity(0),qe.copy(this.sceneNode.outs.boundingBox.value),qe.getSize(Ge),this.cachedNearPlane=this.camera.near,this.cachedFarPlane=this.camera.far,this.vScene.activeCameraComponent.ins.near.setValue(.01),this.vScene.activeCameraComponent.ins.far.setValue(1e3)}resetScene(){const{camera:e,cameraParent:t,setup:n,featuresToReset:i}=this,s=this.vScene.scene;t&&t.add(e),e.position.set(0,0,0),e.rotation.set(0,0,0),this.vScene.activeCameraComponent.ins.near.setValue(this.cachedNearPlane),this.vScene.activeCameraComponent.ins.far.setValue(this.cachedFarPlane),e.updateMatrix(),this.lightTransform.object3D.rotation.set(0,0,0),this.lightTransform.object3D.updateMatrix(),this.sceneNode.ins.units.setValue(this.originalUnits),s.position.setScalar(0),s.rotation.y=0,s.scale.setScalar(1),s.updateMatrix(),s.updateMatrixWorld(!0),i.reverse(),n.floor.ins.visible.setValue(!!i.pop()),n.grid.ins.visible.setValue(!!i.pop()),n.tape.ins.visible.setValue(!!i.pop()),n.slicer.ins.enabled.setValue(!!i.pop());const r=i.pop();r!==Be.pH.Default&&n.viewer.ins.shader.setValue(r),this.lightsToReset.forEach((e=>{e.ins.shadowEnabled.setValue(!0)})),this.lightsToReset.length=0,n.background.show();this.sceneNode.getGraphComponents(De.Z).forEach((e=>{e.ins.quality.setValue(this.cachedQuality)}));const o=this.selectionRing;null!=o&&(s.remove(o),o.geometry.dispose(),o.material.dispose(),this.selectionRing=null);const a=this.hitPlane;null!=a&&(s.remove(a),a.geometry.dispose(),a.material.dispose(),this.hitPlane=null),this.scaleDisplay.remove();const l=this.shadow;null!=l&&(s.remove(l),l.dispose(),this.shadow=null),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix()}setInitialPosition(e){const t=this.initialHitTestSource;if(null==t)return;const n=e.getHitTestResults(t);if(0==n.length)return;const i=n[0],s=this.getHitPoint(i);if(null==s)return;this.placeModel(s),t.cancel(),this.initialHitTestSource=null;const{session:r}=e;r.addEventListener("selectstart",this.onSelectStart),r.addEventListener("selectend",this.onSelectEnd),r.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getHitPoint(e){const t=e.getPose(this.refSpace);if(null==t)return null;const n=He.fromArray(t.transform.matrix),i=n.elements[5]>.75;if(!0===this.ins.wallMount.value&&!i){const e=this.vScene.scene;e.rotation.y=Math.atan2(n.elements[4],n.elements[6]),e.updateMatrix()}return i!==this.ins.wallMount.value?We.setFromMatrixPosition(n):null}handleInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isScaling&&!this.isRotating)return;const n=e.getHitTestResultsForTransientInput(t),i=this.vScene.scene,s=i.scale.x;if(this.isScaling)if(n.length<2)this.isScaling=!1,this.scaleDisplay.classList.remove("sv-show"),this.scaleDisplay.addEventListener("transitionend",(()=>{this.updateScale=!1}),{once:!0});else{let e=this.getFingerSeparation(n)/this.lastScale;e=e>.9&&e<1.1?1:e,this.scaleScene(i,e),this.scaleDisplay.classList.add("sv-show"),this.updateScale=!0}else{if(2===n.length)return this.isTranslating=!1,this.isRotating=!1,this.isScaling=!0,void(this.lastScale=this.getFingerSeparation(n)/s);if(this.isRotating){const e=this.inputSource.gamepad.axes[0];i.rotation.y+=1.5*(e-this.lastDragValueX),i.updateMatrix(),this.sceneRotateHelper(),this.lastDragValueX=e}else if(this.isTranslating){const e=this.inputSource.gamepad.axes,t=e[0]-this.lastDragValueX,s=e[1]-this.lastDragValueY;this.totalDrag+=Math.hypot(t,s),n.forEach((e=>{if(this.totalDrag<.01||e.inputSource!==this.inputSource||e.results.length<1)return;const t=this.getHitPoint(e.results[0]);null!=t&&(Ge.copy(t),Ge.sub(this.lastHitPosition),i.position.add(Ge),i.updateMatrix(),i.updateMatrixWorld(),this.lastHitPosition.copy(t),this.updateBoundingBox())})),this.shadow.updateMatrices()}}}getFingerSeparation(e){const t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],s=n[1]-t[1];return Math.sqrt(i*i+s*s)}placeModel(e){const t=this.vScene.scene,n=!0===this.ins.wallMount.value,{min:i,max:s}=qe,r=this.sceneNode.outs.boundingRadius.value,o=Math.max(1.25*(s.x-i.x),.15),a=n?Math.max(1.25*(s.y-i.y),.15):Math.max(1.25*(s.z-i.z),.15),l=(i.x+s.x)/2,c=(i.z+s.z)/2,d=(i.y+s.y)/2,u=n?0:-Math.PI/2;this.lastHitPosition.copy(e);const p=this.hitPlane=new b.K(new _._(o,a),new x.v);p.position.set(l,n?d:i.y,n?i.z:c),p.rotation.set(u,0,0),p.visible=!1,t.add(p),this.placementRotation.copy(t.quaternion);const f=new H,g=new H,v=o>a?.025*o:.025*a;this.roundedRect(f,-o/2,-a/2,o,a,.5*v),this.roundedRect(g,-o/2+v,-a/2+v,o-2*v,a-2*v,.4*v),f.holes.push(g);let y=new xe(f);const w=this.selectionRing=new b.K(y,new x.v({side:we.ehD,opacity:0}));w.position.set(l,n?d:i.y,n?i.z:c),w.rotation.set(u,0,0),w.material.transparent=!0,w.visible=!1,t.add(w),this.modelFloorOffset=i.y,t.position.set(e.x,n?e.y:e.y-i.y,e.z),t.updateMatrix(),t.updateMatrixWorld(!0),this.updateBoundingBox(),this.pulse.pulse(Date.now()),this.shadow.updateMatrices(),this.shadow.setIntensity(!0===this.ins.wallMount.value?0:.3),this.setup.viewer.ins.annotationsVisible.setValue(this.annotationsAtLaunch),1===this.ins.arScale.value||n||this.renderer.views[0].renderer.render(t,this.shadow.shadow.camera),this.scaleScene(this.vScene.scene,this.ins.arScale.value);const S=this.camera.position.clone(),M=e.clone().sub(S);if(M.length(){this.scaleDisplay.classList.remove("sv-show"),this.scaleDisplay.addEventListener("transitionend",(()=>{this.updateScale=!1}),{once:!0})}),1500))}launchSceneViewer(){const e=this.sceneNode.getGraphComponents(De.Z),t=e.findIndex((e=>null!==e.derivatives.get(Ne._U.App3D,Ne.$l.AR))),n=t>-1?e[t].derivatives.get(Ne._U.App3D,Ne.$l.AR):null;if(n){const e=this.arLink,t=n.findAsset(Ne.hH.Model),i=`intent://arvr.google.com/scene-viewer/1.0?file=${this.assetManager.getAssetUrl(t.data.uri)}&mode=ar_only#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end;`;e.setAttribute("href",i),e.click()}}launchQuickLook(){const e=this.sceneNode.getGraphComponents(De.Z),t=e.findIndex((e=>null!==e.derivatives.get(Ne._U.iOSApp3D,Ne.$l.AR))),n=t>-1?e[t].derivatives.get(Ne._U.iOSApp3D,Ne.$l.AR):null;if(n){const e=this.arLink,t=n.findAsset(Ne.hH.Model),i=this.assetManager.getAssetUrl(t.data.uri);e.setAttribute("rel","ar");const s=document.createElement("img");e.appendChild(s),e.setAttribute("href",i.toString()),e.click(),e.removeChild(s)}}updateBoundingBox(){this.sceneNode.ins.sceneTransformed.set()}updateOpacity(e,t){const n=this.selectionRing.material,i=n.opacity;if(t===i)return;const s=t-i;n.opacity=s>0?Math.min(i+.002*e,t):Math.max(i-.002*e,t),this.selectionRing.visible=n.opacity>0}roundedRect(e,t,n,i,s,r){e.moveTo(t,n+r),e.lineTo(t,n+s-r),e.quadraticCurveTo(t,n+s,t+r,n+s),e.lineTo(t+i-r,n+s),e.quadraticCurveTo(t+i,n+s,t+i,n+s-r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t+i,n,t+i-r,n),e.lineTo(t+r,n),e.quadraticCurveTo(t,n,t,n+r)}sceneRotateHelper(){const e=this.vScene.scene;Xe.copy(e.quaternion),Xe.invert(),Xe.multiply(this.placementRotation),this.lightTransform.object3D.rotation.setFromQuaternion(Xe),this.lightTransform.object3D.updateMatrix(),this.shadow.setRotation(e.rotation.y)}scaleScene(e,t){e.scale.setScalar(t),!1===this.ins.wallMount.value&&(e.position.y=this.lastHitPosition.y-this.modelFloorOffset*e.scale.y),e.updateMatrix(),e.updateMatrixWorld(),this.shadow.setScaleAndOffset(t,0),this.updateBoundingBox()}onMetaComponent(e){const t=e.object;e.add&&t.once("load",(()=>{const e=t.images.dictionary;Object.keys(e).forEach((t=>{const n=e[t];n.usage&&"ARCode"===n.usage&&(this._arCodeImage=this.assetManager.getAssetUrl(n.uri))}))}))}}Ye.typeName="CVARManager",Ye.text="ARManager",Ye.icon="",Ye.isSystemSingleton=!0,Ye.ins={enabled:s.V5.Boolean("State.Enabled"),wallMount:s.V5.Boolean("AR.wallMount",!1),arScale:s.V5.Number("AR.Scale",1)},Ye.outs={enabled:s.V5.Boolean("State.Enabled"),available:s.V5.Boolean("State.Available",Me),isPlaced:s.V5.Boolean("AR.Placed",!1),isPresenting:s.V5.Boolean("AR.Presenting",!1)}},11359:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(80038);class s extends i.ZP{constructor(){super(...arguments),this._title="Untitled",this._timerStart=0}startTimer(){0===this._timerStart&&(this._timerStart=Date.now())}resetTimer(){this._timerStart=0}getTimerTime(){return this._timerStart>0?Date.now()-this._timerStart:0}setTitle(e){this._title=e}sendProperty(e,t){if("function"==typeof gtag){const n=void 0!==t?t.toString():"undefined";gtag("event",e.toLowerCase(),{scene_title:this._title,event_value:n})}}}s.typeName="CVAnalytics",s.text="Analytics",s.icon="",s.isSystemSingleton=!0},51462:(e,t,n)=>{"use strict";n.d(t,{Z:()=>x});var i=n(80038),s=n(28110),r=n(2837),o=n(15271),a=n(3388),l=n(84678),c=n(5249),h=n(15577),d=n(44466),u=n(41029),p=(n(91013),n(13301),n(10160),n(30242)),m=n(93072),f=n(1594),g=n(68327),v=n(17467),y=n(63872),b=n(74572),_=n(26220);class x extends r.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(x.ins),this._activeAnnotation=null,this._annotations={},this._viewports=new Set,this._sprites={},this._truncateLock=!1,this._activeView=!1,this.addEvents("active-annotation","group"),this.onSpriteClick=this.onSpriteClick.bind(this),this.onSpriteLink=this.onSpriteLink.bind(this),this.on("pointer-up",this.onPointerUp,this),this.system.on("pointer-up",this.onSystemPointerUp,this),this.arManager.outs.isPresenting.on("value",this.handleARStateChange,this),this.language.outs.language.on("value",this.updateLanguage,this),this.object3D=new s.Z}get model(){return this.getComponent(a.Z)}get meta(){return this.getComponent(l.Z,!0)}get reader(){return this.getGraphComponent(c.ZP,!0)}get language(){return this.getGraphComponent(m.Z,!0)}get audio(){return this.getGraphComponent(v.Z,!0)}get snapshots(){return this.getGraphComponent(b.Z,!0)}get articles(){const e=this.meta;return e?e.articles:null}get arManager(){return this.system.getMainComponent(p.Z)}get assetManager(){return this.system.getMainComponent(y.Z)}get renderer(){return this.getMainComponent(o.Z)}get assetReader(){return this.getMainComponent(g.Z)}get activeAnnotation(){return this._activeAnnotation}set activeAnnotation(e){if(e!==this._activeAnnotation){const t=this._activeAnnotation;t&&(t.set("expanded",!1),this.updateSprite(t)),this._activeAnnotation=e,e&&(e.set("expanded",!0),this.updateSprite(e),this._activeView&&(this._truncateLock=!0,this._activeView=!1));const n=this.ins;n.marker.setValue(e?e.data.marker:"",!0),n.title.setValue(e?e.title:"",!0),n.lead.setValue(e?e.lead:"",!0),n.tags.setValue(e?e.tags.join(", "):"",!0),n.style.setOption(e?e.data.style:u.Z.defaultTypeName,!0),n.scale.setValue(e?100*e.data.scale*(0,h.Z)(this.model.ins.localUnits.getValidatedValue(),f.f_.m):1,!0),n.offset.setValue(e?100*e.data.offset*(0,h.Z)(this.model.ins.localUnits.getValidatedValue(),f.f_.m):0,!0),n.tilt.setValue(e?e.data.tilt:0,!0),n.azimuth.setValue(e?e.data.azimuth:0,!0),n.color.setValue(e?e.data.color.slice():[1,1,1],!0);const i=this.reader.articles;if(i.length){const t=i.map((e=>e.article.title));t.unshift("(none)"),n.article.setOptions(t);const s=e?i.find((t=>t.article.id===e.data.articleId)):null;n.article.setValue(s?i.indexOf(s)+1:0,!0)}else n.article.setOptions(["(none)"]),n.article.setValue(0);n.audioId.setValue(e?e.data.audioId:null,!0),n.image.setValue(e?e.data.imageUri:"",!0),n.imageCredit.setValue(e?e.imageCredit:"",!0),n.imageAltText.setValue(e?e.imageAltText:"",!0),this.emit({type:"annotation-update",annotation:e})}}get hasAnnotations(){return Object.keys(this._annotations).length>0}setActiveAnnotationById(e){this.activeAnnotation=this._annotations[e]}update(e){super.update(e);const t=this.ins,n=this.object3D,i=this.activeAnnotation;if(t.unitScale.changed&&(n.scale.setScalar(t.unitScale.value),n.updateMatrix()),t.activeTags.changed){const e=t.activeTags.value.split(",").map((e=>e.trim())).filter((e=>e));for(const t in this._annotations){const n=this._annotations[t],i=n.tags;let s=0===i.length;e.forEach((e=>{i.indexOf(e)>=0&&(s=!0)})),n.set("visible",s),this.updateSprite(n)}}if(t.visible.changed&&n.setVisible(t.visible.value),i){if(t.marker.changed&&i.set("marker",t.marker.value),t.title.changed&&(i.title=t.title.value),t.lead.changed&&(i.lead=t.lead.value),t.tags.changed&&(i.tags=t.tags.value.split(",").map((e=>e.trim())).filter((e=>e)),this.emit({type:"tag-update"})),t.style.changed&&(i.set("style",t.style.getOptionText()),this.createSprite(i)),t.scale.changed&&i.set("scale",t.scale.value*(0,h.Z)(f.f_.m,this.model.ins.localUnits.getValidatedValue())*.01),t.offset.changed&&i.set("offset",t.offset.value*(0,h.Z)(f.f_.m,this.model.ins.localUnits.getValidatedValue())*.01),t.tilt.changed&&i.set("tilt",t.tilt.value),t.azimuth.changed&&i.set("azimuth",t.azimuth.value),t.color.changed&&i.set("color",t.color.value.slice()),t.image.changed&&i.set("imageUri",t.image.value),t.imageCredit.changed&&(i.imageCredit=t.imageCredit.value),t.imageAltText.changed&&(i.imageAltText=t.imageAltText.value),t.article.changed){const e=this.reader.articles,n=e&&e[t.article.getValidatedValue()-1];i.set("articleId",n?n.article.id:"")}t.audioId.changed&&i.set("audioId",t.audioId.value),this.updateSprite(i),this.emit({type:"annotation-update",annotation:i})}return!0}tock(){if(this.updated)return!0}postRender(e){const t=e.viewport;this._viewports.has(t)||(t.on("dispose",this.onViewportDispose,this),this._viewports.add(t));if(this.object3D.render(t.overlay,e.camera),this._truncateLock){const e=this.activeAnnotation.data,t=this._sprites[e.id];t.isAnimating=!0,this.snapshots.outs.tweening.once("value",(()=>{t.isAnimating=!1}),this),this._truncateLock=!1}}dispose(){this.object3D.dispose(),this.off("pointer-up",this.onPointerUp,this),this.system.off("pointer-up",this.onSystemPointerUp,this),this.arManager.outs.isPresenting.off("value",this.handleARStateChange,this),this.language.outs.language.off("value",this.updateLanguage,this),this._viewports.forEach((e=>e.off("dispose",this.onViewportDispose,this))),this._viewports.clear(),super.dispose()}getAnnotations(){return Object.keys(this._annotations).map((e=>this._annotations[e]))}addAnnotation(e){this._annotations[e.id]=e,this.createSprite(e),Object.keys(e.data.titles).forEach((e=>{this.language.addLanguage(f.PD[e])})),Object.keys(e.data.leads).forEach((e=>{this.language.addLanguage(f.PD[e])})),this.changed=!0}removeAnnotation(e){const t=Object.keys(this._annotations);if(delete this._annotations[e.id],this.removeSprite(e),e===this.activeAnnotation){const n=Math.min(t.indexOf(e.id)+1,t.length-1);this.activeAnnotation=n<0?null:this._annotations[t[n]],e.tags.length>0&&this.emit({type:"tag-update"})}this.changed=!0}updateAnnotation(e,t){t&&this.updateSprite(e),this.changed=!0}toJSON(){const e=super.toJSON(),t=this.toData();return t&&(e.data=t),e}fromJSON(e){e.data&&this.fromData(e.data)}toData(){const e=Object.keys(this._annotations);return 0===e.length?null:e.map((e=>this._annotations[e].toJSON()))}fromData(e){const t=this.language.outs.language.value;e.forEach((e=>{let n=new d.Z(e);n.language=t,this.addAnnotation(n)})),this.emit({type:"tag-update"})}handleARStateChange(){for(const e in this._annotations){const t=this._annotations[e];this._sprites[t.id].isAdaptive=!this.arManager.outs.isPresenting.value}}onPointerUp(e){if(e.isDragging)return;let t=e.object3D;for(;t&&!t.isHTMLSprite;)t=t.parent;const n=t&&t.annotation;n&&(this.emit({type:"click",sprite:t,annotation:n}),e.stopPropagation=!0)}onSystemPointerUp(e){e.isDragging||this.emit({type:"click",sprite:null,annotation:null})}onViewportDispose(e){this.object3D.disposeHTMLElements(e.viewport.overlay)}onSpriteClick(e){this.emit(e);const t=e.annotation;if(t&&t.data.viewId.length&&!this.arManager.outs.isPresenting.value){this.normalizeViewOrbit(t.data.viewId);const e=this.snapshots.getTargetProperties().findIndex((e=>"ActiveId"==e.name));if(e>=0){this.snapshots.getState(t.data.viewId).values[e]=t.data.id}const n=this.getMainComponent(_.Z);this.snapshots.tweenTo(t.data.viewId,n.context.secondsElapsed),this._activeView=!0}}onSpriteLink(e){this.reader&&(this.reader.ins.articleId.setValue(e.annotation.data.articleId),this.reader.ins.enabled.setValue(!0))}createSprite(e){this.removeSprite(e);const t=u.Z.createInstance(e);t.addEventListener("click",this.onSpriteClick),t.addEventListener("link",this.onSpriteLink),t.assetManager=this.assetManager,t.audioManager=this.audio,this._sprites[e.id]=t,this.object3D.add(t),this.registerPickableObject3D(t,!0)}removeSprite(e){const t=this._sprites[e.id];t&&(t.removeEventListener("click",this.onSpriteClick),t.removeEventListener("link",this.onSpriteLink),t.dispose(),this._sprites[e.id]=void 0,this.object3D.remove(t),this.unregisterPickableObject3D(t,!0))}updateSprite(e){const t=this._sprites[e.id];t&&t.update()}updateLanguage(){if(!this.getComponent(a.Z,!0))return;const e=this.ins,t=this._activeAnnotation,n=this.language;this.getAnnotations().forEach((e=>{e.language=n.outs.language.value})),e.activeTags.set();for(const e in this._annotations){const t=this._annotations[e],n=this._sprites[t.id];n&&n.update()}e.title.setValue(t?t.title:"",!0),e.lead.setValue(t?t.lead:"",!0),e.tags.setValue(t?t.tags.join(", "):""),e.imageCredit.setValue(t?t.imageCredit:"",!0),e.imageAltText.setValue(t?t.imageAltText:"",!0);const i=this.reader.articles.map((e=>e.article.title));i.unshift("(none)"),e.article.setOptions(i)}normalizeViewOrbit(e){const t=this.snapshots.getTargetProperties().findIndex((e=>"Orbit"==e.name)),n=this.snapshots.getState(e),i=this.snapshots.getCurrentValues()[t];let s=0;i.forEach(((e,i)=>{const r=Math.round((e-n.values[t][i])/360);n.values[t][i]+=360*r,s+=Math.abs(e-n.values[t][i])})),n.duration=s>.01?1:0}}x.typeName="CVAnnotationView",x.ins={unitScale:i.V5.Number("Transform.UnitScale",{preset:1,precision:5}),activeTags:i.V5.String("Tags.Active"),title:i.V5.String("Annotation.Title"),lead:i.V5.String("Annotation.Lead"),marker:i.V5.String("Annotation.Marker"),tags:i.V5.String("Annotation.Tags"),style:i.V5.Option("Annotation.Style",u.Z.typeNames),scale:i.V5.Scale("Annotation.Scale",{preset:1,precision:3}),offset:i.V5.Number("Annotation.Offset",{preset:0,precision:3}),article:i.V5.Option("Annotation.Article",[]),image:i.V5.String("Annotation.Image"),imageCredit:i.V5.String("Image.Credit"),imageAltText:i.V5.String("Image.AltText"),audioId:i.V5.String("Annotation.AudioID"),tilt:i.V5.Number("Annotation.Tilt"),azimuth:i.V5.Number("Annotation.Azimuth"),color:i.V5.ColorRGB("Annotation.Color")}},63872:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(58754),s=n(80038);class r extends s.ZP{constructor(){super(...arguments),this.ins=this.addInputs(r.ins),this.outs=this.addOutputs(r.outs),this._loadingManager=new o(this),this._baseUrl=window.location.href,this._initialLoad=!1}get loadingManager(){return this._loadingManager}get baseUrl(){return this._baseUrl}set baseUrl(e){this._baseUrl=new URL(e,window.location.href).href}get initialLoad(){return this._initialLoad}set initialLoad(e){this._initialLoad=e}getAssetName(e){return e.split("/").pop()}getAssetUrl(e){const t=new URL(e,this._baseUrl).href;return this.loadingManager.resolveURL(t)}getAssetPath(e){const t=this._baseUrl,n=e.indexOf(t);return n>=0?e.substr(n+t.length):e}getAssetBasePath(e){const t=this.getAssetPath(e).split("/");t.pop();const n=t.join("/");return n?n+"/":n}getRelativeAssetPath(e,t){const n=this.getAssetUrl(e),i=this.getAssetUrl(t),s=n.indexOf(i);return s>=0?n.substr(s+i.length):this.getAssetPath(n)}create(){super.create()}update(){const{ins:e,outs:t}=this;if(e.busy.changed){const n=e.busy.value||this._loadingManager.isBusy;t.busy.setValue(n),n||t.completed.set()}return!0}}r.typeName="CVAssetManager",r.text="AssetManager",r.icon="",r.isSystemSingleton=!0,r.ins={busy:s.V5.Boolean("State.Busy"),baseUrlValid:s.V5.Boolean("Settings.BaseURLValid")},r.outs={busy:s.V5.Boolean("State.Busy"),completed:s.V5.Event("State.Completed")};class o extends i.l{constructor(e){super(),this._manager=e,this._isBusy=!1,this.onStart=this.onLoadingStart.bind(this),this.onProgress=this.onLoadingProgress.bind(this),this.onLoad=this.onLoadingCompleted.bind(this),this.onError=this.onLoadingError.bind(this)}get isBusy(){return this._isBusy}onLoadingStart(){this._isBusy=!0,this._manager.ins.busy.set()}onLoadingProgress(e,t,n){0}onLoadingCompleted(){this._isBusy=!1,this._manager.ins.busy.set()}onLoadingError(){this._isBusy=!1,this._manager.ins.busy.set()}}},68327:(e,t,n)=>{"use strict";n.d(t,{x:()=>An,Z:()=>Pn});var i=n(56587),s=n(80038);class r{constructor(e){this._loadingManager=e}async get(e){return this._loadingManager.itemStart(e),fetch(e,{headers:{Accept:"application/json"}}).then((t=>{if(!t.ok)throw this._loadingManager.itemError(e),this._loadingManager.itemEnd(e),new Error(`failed to fetch from '${e}', status: ${t.status} ${t.statusText}`);return this._loadingManager.itemEnd(e),t.json()}))}}var o=n(40693),a=n(6965),l=n(93113),c=n(71050);class h extends a.W{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new o.F(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return c.uZ(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new l.I(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new l.I(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new l.I(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}var d=n(75544),u=n(8173),p=n(17393),m=n(19588),f=n(84538),g=n(60206);const v=n(8669).Z,y=n(9849).Z;class b extends h{constructor(e){super(),this._clayColor=new l.I("#a67a6c").convertLinearToSRGB(),this._wireColor=new l.I("#004966").convertLinearToSRGB(),this._wireEmissiveColor=new l.I("#004966").convertLinearToSRGB(),this._objectSpaceNormalMap=!1,this._paramCopy={},this._sideCopy=d.Wl3,this.type="UberPBRAdvMaterial",this.isUberPBRMaterial=!0,this.isMeshStandardMaterial=!0,this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:!0,PHYSICAL:!0,OBJECTSPACE_NORMALMAP:!1,MODE_NORMALS:!1,MODE_XRAY:!1,CUT_PLANE:!1,USE_ZONEMAP:!1},this.uniforms=u.rD.merge([p.V.physical.uniforms,{aoMapMix:{value:new m.P(.25,.25,.25)},cutPlaneDirection:{value:new f.L(0,0,-1,0)},cutPlaneColor:{value:new m.P(1,0,0)},zoneMap:{value:null}}]),this._aoMapMix=this.uniforms.aoMapMix.value,this._cutPlaneDirection=this.uniforms.cutPlaneDirection.value,this._cutPlaneColor=this.uniforms.cutPlaneColor.value,this._zoneMap=this.uniforms.zoneMap.value,this.vertexShader=y,this.fragmentShader=v,this.color=new l.I(16777215),this.roughness=.7,this.metalness=0,e&&this.setValues(e)}set cutPlaneDirection(e){this._cutPlaneDirection.copy(e)}get cutPlaneDirection(){return this._cutPlaneDirection}set cutPlaneColor(e){this._cutPlaneColor.copy(e)}get cutPlaneColor(){return this._cutPlaneColor}set aoMapMix(e){this._aoMapMix.copy(e)}get aoMapMix(){return this._aoMapMix}set zoneMap(e){this._zoneMap=e,this.uniforms.zoneMap.value=e,this.needsUpdate=!0}get zoneMap(){return this._zoneMap}setShaderMode(e){switch(Object.assign(this,this._paramCopy),this.defines.MODE_NORMALS=!1,this.defines.MODE_XRAY=!1,this.defines.OBJECTSPACE_NORMALMAP=!(!this.normalMap||!this._objectSpaceNormalMap),this.side=this.defines.CUT_PLANE?d.ehD:this.side,this.needsUpdate=!0,e){case g.pH.Clay:this._paramCopy={color:this.color,map:this.map,roughness:this.roughness,metalness:this.metalness,aoMapIntensity:this.aoMapIntensity,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite,envMap:this.envMap,transmission:this.transmission},this.color=this._clayColor,this.map=null,this.envMap=null,this.transmission=0,this.roughness=1,this.metalness=0,this.aoMapIntensity*=1,this.blending=d.jFi,this.transparent=!1,this.depthWrite=!0;break;case g.pH.Normals:this._paramCopy={blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_NORMALS=!0,this.blending=d.jFi,this.transparent=!1,this.depthWrite=!0;break;case g.pH.XRay:this._paramCopy={side:this.side,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_XRAY=!0,this.side=d.ehD,this.blending=d.WMw,this.transparent=!0,this.depthWrite=!1;break;case g.pH.Wireframe:this._paramCopy={color:this.color,emissive:this.emissive,roughness:this.roughness,metalness:this.metalness,wireframe:this.wireframe,map:this.map,aoMap:this.aoMap,emissiveMap:this.emissiveMap,normalMap:this.normalMap},this.color=this._wireColor,this.emissive=this._wireEmissiveColor,this.roughness=.8,this.metalness=.1,this.wireframe=!0,this.map=null,this.aoMap=null,this.emissiveMap=null,this.normalMap=null,this.defines.OBJECTSPACE_NORMALMAP=!1}}enableCutPlane(e){this.defines.CUT_PLANE=e,e?(this._sideCopy=this.side,this.side=d.ehD):this.side=this._sideCopy}enableObjectSpaceNormalMap(e){e!==this._objectSpaceNormalMap&&(this._objectSpaceNormalMap=e),this.normalMap&&(this.normalMapType=d.PA7,this.needsUpdate=!0)}enableZoneMap(e){this.defines.USE_ZONEMAP=e}}var _=n(58754);class x{constructor(e){this.manager=void 0!==e?e:_.t,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise((function(i,s){n.load(e,i,t,s)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}x.DEFAULT_MATERIAL_NAME="__DEFAULT";const w={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},S={};class M extends Error{constructor(e,t){super(e),this.response=t}}class E extends x{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const s=w.get(e);if(void 0!==s)return this.manager.itemStart(e),setTimeout((()=>{t&&t(s),this.manager.itemEnd(e)}),0),s;if(void 0!==S[e])return void S[e].push({onLoad:t,onProgress:n,onError:i});S[e]=[],S[e].push({onLoad:t,onProgress:n,onError:i});const r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(r).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=S[e],i=t.body.getReader(),s=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),r=s?parseInt(s):0,o=0!==r;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:s})=>{if(i)e.close();else{a+=s.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:r});for(let e=0,t=n.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{w.add(e,t);const n=S[e];delete S[e];for(let e=0,i=n.length;e{const n=S[e];if(void 0===n)throw this.manager.itemError(e),t;delete S[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}var T=n(75809),C=n(35322);const A=new WeakMap;class P extends x{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,t,n,i){const s=new E(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(e=>{this.parse(e,t,i)}),n,i)}parse(e,t,n){this.decodeDracoFile(e,t,null,null,d.KI_).catch(n)}decodeDracoFile(e,t,n,i,s=d.GUF){const r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};return this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){const n=JSON.stringify(t);if(A.has(e)){const t=A.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,r=e.byteLength,o=this._getWorker(s,r).then((n=>(i=n,new Promise(((n,r)=>{i._callbacks[s]={resolve:n,reject:r},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&s&&this._releaseTask(i,s)})),A.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new T.u;e.index&&t.setIndex(new C.Tl(e.index.array,1));for(let n=0;n{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=R.toString(),s=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e{const t=e.draco,o=new t.Decoder;try{const e=function(e,t,i,s){const r=s.attributeIDs,o=s.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in r){const l=self[o[i]];let c,d;if(s.useUniqueIDs)d=r[i],c=t.GetAttributeByUniqueId(a,d);else{if(d=t.GetAttributeId(a,e[r[i]]),-1===d)continue;c=t.GetAttribute(a,d)}const u=n(e,t,a,i,l,c);"color"===i&&(u.vertexColorSpace=s.vertexColorSpace),h.attributes.push(u)}c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),s=4*i,r=e._malloc(s);t.GetTrianglesUInt32Array(n,s,r);const o=new Uint32Array(e.HEAPF32.buffer,r,i).slice();return e._free(r),{array:o,itemSize:1}}(e,t,a));return e.destroy(a),h}(t,o,new Int8Array(i),r),a=e.attributes.map((e=>e.array.buffer));e.index&&a.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},a)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(o)}}))}}}class L{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n=s)break e;{const o=t[1];e=s)break t}r=n,n=0}}for(;n>>1;e0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;es.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:o})}}var Oe=n(29187),Ue=n(67440),ke=n(62257);class Ve extends Y.T{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ze extends ee.x{constructor(e=null,t=1,n=1,i,s,r,o,a,l=d.TyD,c=d.TyD,h,u){super(null,r,o,a,l,c,i,s,h,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Fe=new U.y,Be=new U.y;class $e{constructor(e=[],t=[]){this.uuid=c.DO(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;et;)--r;if(++r,0!==s||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);const e=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*e,r*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;0===s&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let t=0;t!==s;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==r&&r>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,r),e=!1;break}r=i}if(void 0!==i&&He(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===d.pIN,s=e.length-1;let r=1;for(let o=1;o0){e[r]=e[s];for(let e=s*n,i=r*n,o=0;o!==n;++o)t[i+o]=t[e+o];++r}return r!==e.length?(this.times=e.slice(0,r),this.values=t.slice(0,r*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Ke.prototype.TimeBufferType=Float32Array,Ke.prototype.ValueBufferType=Float32Array,Ke.prototype.DefaultInterpolation=d.NMF;class Je extends Ke{}Je.prototype.ValueTypeName="bool",Je.prototype.ValueBufferType=Array,Je.prototype.DefaultInterpolation=d.Syv,Je.prototype.InterpolantFactoryMethodLinear=void 0,Je.prototype.InterpolantFactoryMethodSmooth=void 0;class Qe extends Ke{}Qe.prototype.ValueTypeName="color";class et extends Ke{}et.prototype.ValueTypeName="number";class tt extends K{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)k._.slerpFlat(s,0,r,l-o,r,l,a);return s}}class nt extends Ke{InterpolantFactoryMethodLinear(e){return new tt(this.times,this.values,this.getValueSize(),e)}}nt.prototype.ValueTypeName="quaternion",nt.prototype.DefaultInterpolation=d.NMF,nt.prototype.InterpolantFactoryMethodSmooth=void 0;class it extends Ke{}it.prototype.ValueTypeName="string",it.prototype.ValueBufferType=Array,it.prototype.DefaultInterpolation=d.Syv,it.prototype.InterpolantFactoryMethodLinear=void 0,it.prototype.InterpolantFactoryMethodSmooth=void 0;class st extends Ke{}st.prototype.ValueTypeName="vector";class rt{constructor(e,t=-1,n,i=d.IFH){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=c.DO(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,s=n.length;e!==s;++e)t.push(ot(n[e]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(Ke.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,r=[];for(let e=0;e1){const e=r[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const r=[];for(const e in i)r.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return r}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,s){if(0!==n.length){const r=[],o=[];We(n,r,o,i),0!==r.length&&s.push(new e(t,r,o))}},i=[],s=e.name||"default",r=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e=2.0 are supported.")));const l=new nn(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(r),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,s){n.parse(e,t,i,s)}))}}function ht(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const dt={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_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_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 ut{constructor(e){this.parser=e,this.name=dt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,r)}}class Mt{constructor(e){this.parser=e,this.name=dt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const r=s.extensions[t],o=i.images[r.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(s){if(s)return n.loadTextureImage(e,r.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Et{constructor(e){this.parser=e,this.name=dt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const r=s.extensions[t],o=i.images[r.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(s){if(s)return n.loadTextureImage(e,r.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Tt{constructor(e){this.name=dt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,r=e.count,o=e.byteStride,a=new Uint8Array(t,n,i);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(r,o,a,e.mode,e.filter).then((function(e){return e.buffer})):s.ready.then((function(){const t=new ArrayBuffer(r*o);return s.decodeGltfBuffer(new Uint8Array(t),r,o,a,e.mode,e.filter),t}))}))}return null}}class Ct{constructor(e){this.name=dt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==Vt.TRIANGLES&&e.mode!==Vt.TRIANGLE_STRIP&&e.mode!==Vt.TRIANGLE_FAN&&void 0!==e.mode)return null;const s=n.extensions[this.name].attributes,r=[],o={};for(const e in s)r.push(this.parser.getDependency("accessor",s[e]).then((t=>(o[e]=t,o[e]))));return r.length<1?null:(r.push(this.parser.createNodeMesh(e)),Promise.all(r).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,s=[];for(const e of n){const t=new U.y,n=new m.P,r=new k._,a=new m.P(1,1,1),l=new X(e.geometry,e.material,i);for(let e=0;e-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&s<98?this.textureLoader=new te(this.options.manager):this.textureLoader=new ne(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new E(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const r={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return Xt(s,r,i),Yt(r,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(r)}))).then((function(){e(r)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())s(i,t.children[n])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,h[e*r+1]),r>=3&&p.setZ(t,h[e*r+2]),r>=4&&p.setW(t,h[e*r+3]),r>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,s=t.images[i];let r=this.textureLoader;if(s.uri){const e=n.manager.getHandler(s.uri);null!==e&&(r=e)}return this.loadTextureImage(e,i,r)}loadTextureImage(e,t,n){const i=this,s=this.json,r=s.textures[e],o=s.images[t],a=(o.uri||o.bufferView)+":"+r.sampler;if(this.textureCache[a])return this.textureCache[a];const l=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=r.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(s.samplers||{})[r.sampler]||{};return t.magFilter=Ft[n.magFilter]||d.wem,t.minFilter=Ft[n.minFilter]||d.D1R,t.wrapS=Bt[n.wrapS]||d.rpg,t.wrapT=Bt[n.wrapT]||d.rpg,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[a]=l,l}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const r=i.images[e],o=self.URL||self.webkitURL;let a=r.uri||"",l=!1;if(void 0!==r.bufferView)a=n.getDependency("bufferView",r.bufferView).then((function(e){l=!0;const t=new Blob([e],{type:r.mimeType});return a=o.createObjectURL(t),a}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(a).then((function(e){return new Promise((function(n,i){let r=n;!0===t.isImageBitmapLoader&&(r=function(e){const t=new ee.x(e);t.needsUpdate=!0,n(t)}),t.load(L.resolveURL(e,s.path),r,void 0,i)}))})).then((function(e){var t;return!0===l&&o.revokeObjectURL(a),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),e}));return this.sourceCache[e]=c,c}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then((function(r){if(!r)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((r=r.clone()).channel=n.texCoord),s.extensions[dt.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[dt.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=s.associations.get(r);r=s.extensions[dt.KHR_TEXTURE_TRANSFORM].extendTexture(r,e),s.associations.set(r,t)}}return void 0!==i&&(r.colorSpace=i),e[t]=r,r}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,s=void 0!==t.attributes.color,r=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new oe,re.F.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new ae.n,re.F.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||s||r){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),s&&(e+="vertex-colors:"),r&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),s&&(t.vertexColors=!0),r&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return a.W}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let r;const a={},c=[];if((s.extensions||{})[dt.KHR_MATERIALS_UNLIT]){const e=i[dt.KHR_MATERIALS_UNLIT];r=e.getMaterialType(),c.push(e.extendParams(a,s,t))}else{const n=s.pbrMetallicRoughness||{};if(a.color=new l.I(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;a.color.setRGB(e[0],e[1],e[2],d.GUF),a.opacity=e[3]}void 0!==n.baseColorTexture&&c.push(t.assignTexture(a,"map",n.baseColorTexture,d.KI_)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(c.push(t.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),r=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)}))))}!0===s.doubleSided&&(a.side=d.ehD);const h=s.alphaMode||Zt;if(h===qt?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===Wt&&(a.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&r!==O.v&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new o.F(1,1),void 0!==s.normalTexture.scale)){const e=s.normalTexture.scale;a.normalScale.set(e,e)}if(void 0!==s.occlusionTexture&&r!==O.v&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(a.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&r!==O.v){const e=s.emissiveFactor;a.emissive=(new l.I).setRGB(e[0],e[1],e[2],d.GUF)}return void 0!==s.emissiveTexture&&r!==O.v&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,d.KI_)),Promise.all(c).then((function(){const n=new r(a);return s.name&&(n.name=s.name),Yt(n,s),t.associations.set(n,{materials:e}),s.extensions&&Xt(i,n,s),n}))}createUniqueName(e){const t=me.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(e){return n[dt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return sn(n,e,t)}))}const r=[];for(let n=0,o=e.length;n0&&Kt(u,s),u.name=t.createUniqueName(s.name||"mesh_"+e),Yt(u,s),h.extensions&&Xt(i,u,h),t.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;n1?new Oe.Z:1===t.length?t[0]:new Y.T,o!==t[0])for(let e=0,n=t.length;e{const t=new Map;for(const[e,n]of i.associations)(e instanceof re.F||e instanceof ee.x)&&t.set(e,n);return e.traverse((e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)})),t})(s),s}))}_createAnimationTracks(e,t,n,i,s){const r=[],o=e.name?e.name:e.uuid,a=[];let l;switch(Ht[s.path]===Ht.weights?e.traverse((function(e){e.morphTargetInfluences&&a.push(e.name?e.name:e.uuid)})):a.push(o),Ht[s.path]){case Ht.weights:l=et;break;case Ht.rotation:l=nt;break;case Ht.position:case Ht.scale:l=st;break;default:if(1===n.itemSize)l=et;else l=st}const c=void 0!==i.interpolation?Gt[i.interpolation]:d.NMF,h=this._getArrayFromAccessor(n);for(let e=0,n=a.length;e=0}isValidMimeType(e){return on.mimeTypes.indexOf(e)>=0}get(e){return new Promise(((t,n)=>{this.gltfLoader.load(e,(e=>{t(this.createModelGroup(e))}),null,(i=>{null===this.gltfLoader||null===this.gltfLoader.dracoLoader?t(null):(console.error(`failed to load '${e}': ${i}`),n(new Error(i)))}))}))}createModelGroup(e){const t=e.scene;return t.traverse((e=>{if("Mesh"===e.type){const t=e;t.castShadow=!0;const n=t.material;n.map&&(n.map.colorSpace=d.KI_),t.geometry.computeBoundingBox();const i="MeshPhysicalMaterial"===n.type?new b:new rn.Z;n.flatShading&&(t.geometry.computeVertexNormals(),n.flatShading=!1,console.warn("Normals unavailable so they have been calculated. For best outcomes, please provide normals with geometry.")),"MeshPhysicalMaterial"!==n.type&&"MeshStandardMaterial"!==n.type||i.copy(n),n.userData.objectSpaceNormals&&i.enableObjectSpaceNormalMap(!0),t.material=i}})),t}}on.extensions=["gltf","glb"],on.mimeTypes=["model/gltf+json","model/gltf-binary"];var an=n(41654);const ln=/^[og]\s*(.+)?/,cn=/^mtllib /,hn=/^usemtl /,dn=/^usemap /,un=/\s+/,pn=new m.P,mn=new m.P,fn=new m.P,gn=new m.P,vn=new m.P,yn=new l.I;function bn(){const e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){const t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){const t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){const e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){const n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){const i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,s=this.object.geometry.normals;pn.fromArray(i,e),mn.fromArray(i,t),fn.fromArray(i,n),vn.subVectors(fn,mn),gn.subVectors(pn,mn),vn.cross(gn),vn.normalize(),s.push(vn.x,vn.y,vn.z),s.push(vn.x,vn.y,vn.z),s.push(vn.x,vn.y,vn.z)},addColor:function(e,t,n){const i=this.colors,s=this.object.geometry.colors;void 0!==i[e]&&s.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&s.push(i[t+0],i[t+1],i[t+2]),void 0!==i[n]&&s.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,s,r,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(e,c),d=this.parseVertexIndex(t,c),u=this.parseVertexIndex(n,c);if(this.addVertex(h,d,u),this.addColor(h,d,u),void 0!==o&&""!==o){const e=this.normals.length;h=this.parseNormalIndex(o,e),d=this.parseNormalIndex(a,e),u=this.parseNormalIndex(l,e),this.addNormal(h,d,u)}else this.addFaceNormal(h,d,u);if(void 0!==i&&""!==i){const e=this.uvs.length;h=this.parseUVIndex(i,e),d=this.parseUVIndex(s,e),u=this.parseUVIndex(r,e),this.addUV(h,d,u),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n=7?(yn.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])).convertSRGBToLinear(),t.colors.push(yn.r,yn.g,yn.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===r){const e=s.slice(1).trim().split(un),n=[];for(let t=0,i=e.length;t0){const e=i.split("/");n.push(e)}}const i=n[0];for(let e=1,s=n.length-1;e1){const e=i[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;const e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\0"===s)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"')}}t.finalize();const s=new Oe.Z;s.materialLibraries=[].concat(t.materialLibraries);if(!0===!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length))for(let e=0,n=t.objects.length;e0&&c.setAttribute("normal",new C.a$(i.normals,3)),i.colors.length>0&&(l=!0,c.setAttribute("color",new C.a$(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new C.a$(i.uvs,2));const h=[];for(let e=0,n=r.length;e1){for(let e=0,t=r.length;e0){const e=new oe({size:1,sizeAttenuation:!1}),n=new T.u;n.setAttribute("position",new C.a$(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new C.a$(t.colors,3)),e.vertexColors=!0);const i=new De(n,e);s.add(i)}return s}}const xn=new l.I;class wn extends x{constructor(e){super(e),this.propertyNameMapping={},this.customPropertyMapping={}}load(e,t,n,i){const s=this,r=new E(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,(function(n){try{t(s.parse(n))}catch(t){i?i(t):console.error(t),s.manager.itemError(e)}}),n,i)}setPropertyNameMapping(e){this.propertyNameMapping=e}setCustomPropertyNameMapping(e){this.customPropertyMapping=e}parse(e){function t(e,t=0){let n="";const i=/^ply([\s\S]*)end_header(\r\n|\r|\n)/.exec(e);null!==i&&(n=i[1]);const s={comments:[],elements:[],headerLength:t,objInfo:""},r=n.split(/\r\n|\r|\n/);let o;function a(e,t){const n={type:e[0]};return"list"===n.type?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t&&(n.name=t[n.name]),n}for(let e=0;ee.name));function n(e){for(let n=0,i=e.length;n0&&t.setIndex(e.indices),t.setAttribute("position",new C.a$(e.vertices,3)),e.normals.length>0&&t.setAttribute("normal",new C.a$(e.normals,3)),e.uvs.length>0&&t.setAttribute("uv",new C.a$(e.uvs,2)),e.colors.length>0&&t.setAttribute("color",new C.a$(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(t=t.toNonIndexed(),e.faceVertexUvs.length>0&&t.setAttribute("uv",new C.a$(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&t.setAttribute("color",new C.a$(e.faceVertexColors,3)));for(const n of Object.keys(u.customPropertyMapping))e[n].length>0&&t.setAttribute(n,new C.a$(e[n],u.customPropertyMapping[n].length));return t.computeBoundingSphere(),t}function l(e,t,n,i){if("vertex"===t){e.vertices.push(n[i.attrX],n[i.attrY],n[i.attrZ]),null!==i.attrNX&&null!==i.attrNY&&null!==i.attrNZ&&e.normals.push(n[i.attrNX],n[i.attrNY],n[i.attrNZ]),null!==i.attrS&&null!==i.attrT&&e.uvs.push(n[i.attrS],n[i.attrT]),null!==i.attrR&&null!==i.attrG&&null!==i.attrB&&(xn.setRGB(n[i.attrR]/255,n[i.attrG]/255,n[i.attrB]/255).convertSRGBToLinear(),e.colors.push(xn.r,xn.g,xn.b));for(const t of Object.keys(u.customPropertyMapping))for(const i of u.customPropertyMapping[t])e[t].push(n[i])}else if("face"===t){const t=n.vertex_indices||n.vertex_index,s=n.texcoord;3===t.length?(e.indices.push(t[0],t[1],t[2]),s&&6===s.length&&(e.faceVertexUvs.push(s[0],s[1]),e.faceVertexUvs.push(s[2],s[3]),e.faceVertexUvs.push(s[4],s[5]))):4===t.length&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),null!==i.attrR&&null!==i.attrG&&null!==i.attrB&&(xn.setRGB(n[i.attrR]/255,n[i.attrG]/255,n[i.attrB]/255).convertSRGBToLinear(),e.faceVertexColors.push(xn.r,xn.g,xn.b),e.faceVertexColors.push(xn.r,xn.g,xn.b),e.faceVertexColors.push(xn.r,xn.g,xn.b))}}function c(e,t){const n={};let i=0;for(let s=0;se.getInt8(t),size:1};case"uint8":case"uchar":return{read:t=>e.getUint8(t),size:1};case"int16":case"short":return{read:t=>e.getInt16(t,n),size:2};case"uint16":case"ushort":return{read:t=>e.getUint16(t,n),size:2};case"int32":case"int":return{read:t=>e.getInt32(t,n),size:4};case"uint32":case"uint":return{read:t=>e.getUint32(t,n),size:4};case"float32":case"float":return{read:t=>e.getFloat32(t,n),size:4};case"float64":case"double":return{read:t=>e.getFloat64(t,n),size:8}}}for(let s=0,r=e.length;s=this.arr.length}next(){return this.arr[this.i++]}}class Mn{constructor(e){this.objLoader=new _n(e),this.plyLoader=new wn(e)}isValid(e){const t=e.split(".").pop().toLowerCase();return Mn.extensions.indexOf(t)>=0}get(e){const t=e.split(".").pop().toLowerCase();return new Promise(((n,i)=>{if("obj"===t)this.objLoader.load(e,(t=>{const s=t.children[0].geometry;return s&&"Geometry"===s.type||"BufferGeometry"===s.type?n(s):i(new Error(`Can't parse geometry from '${e}'`))}));else{if("ply"!==t)throw new Error(`Can't load geometry, unknown extension: '${t}' in '${e}'`);this.plyLoader.load(e,(t=>t&&"Geometry"===t.type||"BufferGeometry"===t.type?n(t):i(new Error(`Can't parse geometry from '${e}'`))))}}))}}Mn.extensions=["obj","ply"];class En{constructor(e){this.textureLoader=new te(e)}isValid(e){const t=e.split(".").pop().toLowerCase();return En.extensions.indexOf(t)>=0}isValidMimeType(e){return En.mimeTypes.indexOf(e)>=0}get(e){return new Promise(((t,n)=>{this.textureLoader.load(e,(e=>{t(e)}),null,(e=>{console.error(e),n(new Error(e.message))}))}))}getImmediate(e){return this.textureLoader.load(e,null,null,(e=>{console.error(e)}))}}En.extensions=["jpg","png"],En.mimeTypes=["image/jpeg","image/png"];class Tn{constructor(e){this._customFontPath=null,this._loadingManager=e,this._textureLoader=new te(e),this._cache={}}set fontPath(e){this._customFontPath=e}get fontPath(){return this._customFontPath}get(e){return this._cache[e]}async load(e){if(this._cache[e])return Promise.resolve(this._cache[e]);this._loadingManager.itemStart(e);const t=this.fontPath,n=t?t+e+".json":An+e+".json",i=t?t+e+".png":An+e+".png",s=fetch(n,{headers:{Accept:"application/json"}}).then((t=>{if(!t.ok)throw this._loadingManager.itemError(e),new Error(`failed to load bitmap font descriptor: '${n}', status: ${t.status} ${t.statusText}`);return t.json()})),r=new Promise(((e,t)=>{this._textureLoader.load(i,(n=>n?e(n):t(new Error(`failed to load font texture from '${i}'`))))}));return Promise.all([s,r]).then((t=>{const n={descriptor:t[0],texture:t[1]};return this._cache[e]=n,this._loadingManager.itemEnd(e),n}))}}var Cn=n(63872);const An="https://cdn.jsdelivr.net/gh/smithsonian/dpo-voyager@latest/assets/";class Pn extends s.ZP{constructor(e,t){super(e,t),this.systemAssetPath=null;const n=this.assetManager.loadingManager;this.jsonLoader=new r(n),this.modelLoader=new on(n),this.geometryLoader=new Mn(n),this.textureLoader=new En(n),this.fontReader=new Tn(n)}dispose(){this.modelLoader.dispose(),super.dispose()}get assetManager(){return this.getMainComponent(Cn.Z)}setDracoPath(e){this.modelLoader.dracoPath=e}setSystemAssetPath(e){this.fontReader.fontPath=e,this.systemAssetPath=e}getSystemAssetUrl(e){return(this.systemAssetPath||An)+e}async getJSON(e){const t=this.assetManager.getAssetUrl(e);return this.jsonLoader.get(t)}async getText(e){const t=this.assetManager.getAssetUrl(e);return i.Z.text(t,"GET")}async getModel(e){const t=this.assetManager.getAssetUrl(e);return this.modelLoader.get(t)}async getGeometry(e){const t=this.assetManager.getAssetUrl(e);return this.geometryLoader.get(t)}async getTexture(e){const t=this.assetManager.getAssetUrl(e);return this.textureLoader.get(t)}async getFont(e){const t=this.assetManager.getAssetUrl(e);return this.fontReader.load(t)}async getSystemTexture(e){const t=this.getSystemAssetUrl(e);return this.textureLoader.get(t)}async getSystemJSON(e){const t=this.getSystemAssetUrl(e);return this.jsonLoader.get(t)}}Pn.typeName="CVAssetReader",Pn.text="AssetReader",Pn.icon="",Pn.isSystemSingleton=!0},17467:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var i=n(80038),s=n(84678),r=n(63872),o=n(93072),a=n(1594),l=n(10564),c=n(51120),h=n(11359),d=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class u extends i.ZP{constructor(){super(...arguments),this._narrationId=null,this._activeId=null,this._audioMap={},this.audioClips={},this.audioPlayer=null,this.audioView=null,this.audioViews={},this.isPlaying=!1,this.ins=this.addInputs(u.ins),this.outs=this.addOutputs(u.outs),this.onEnd=()=>{const{outs:e}=this;this.isPlaying=!1,e.isPlaying.setValue(!1),this.audioView.requestUpdate()},this.onCueChange=e=>{const t=e.target.track.activeCues,n=t.length>0?t[0].text:"";this.ins.activeCaption.setValue(n)},this.onLoadTrack=e=>{const t=this.audioPlayer.children[0].track.cues;0===t[0].startTime&&(t[0].startTime=.01)},this.onTimeChange=e=>{this.audioView.elapsed=this.getTimeElapsed(),this.audioView.requestUpdate()}}get assetManager(){return this.getMainComponent(r.Z)}get language(){return this.getGraphComponent(o.Z,!0)}get analytics(){return this.system.getMainComponent(h.Z)}get narrationId(){return this._narrationId||""}set narrationId(e){this._narrationId=e,this.outs.narrationEnabled.setValue(e.length>0)}get activeId(){return this._activeId||""}set activeId(e){this._activeId=e}create(){super.create(),this.graph.components.on(s.Z,this.onMetaComponent,this),this.language.outs.language.on("value",this.onLanguageChange,this)}dispose(){Object.keys(this._audioMap).forEach((e=>URL.revokeObjectURL(this._audioMap[e]))),this.language.outs.language.off("value",this.onLanguageChange,this),this.graph.components.off(s.Z,this.onMetaComponent,this),super.dispose()}update(){const{ins:e,outs:t}=this;return e.playNarration.changed&&this.audioPlayer&&this._narrationId&&(t.narrationPlaying.value&&this.activeId==this._narrationId?this.stop():t.narrationPlaying.value||this.play(this._narrationId),t.narrationPlaying.setValue(!t.narrationPlaying.value)),!0}getPlayerById(e){if(!this.audioViews.hasOwnProperty(e)){const t=this.audioViews[e]=new p;t.audio=this,t.audioId=e,t.requestUpdate()}return this.audioViews[e]}getAudioList(){return Object.keys(this.audioClips).map((e=>this.audioClips[e]))}getAudioClip(e){return this.audioClips[e]}getAudioClipUri(e){const t=this.audioClips[e];return t?t.uris[a.PD[this.language.outs.language.value]]:null}getClipCaptionUri(e){const t=this.audioClips[e];return t?t.captionUris[a.PD[this.language.outs.language.value]]:null}getDuration(e){const t=this.audioClips[e],n=a.PD[this.language.outs.language.getValidatedValue()],i=t.durations[n];if(i)return i;{const t=this.audioClips[e];return Object.keys(t.uris).forEach((n=>{const i=t.uris[n];if(i){const s=this.assetManager.getAssetUrl(i);t.durations[n]="pending";const r=new(window.AudioContext||window.webkitAudioContext),o=new XMLHttpRequest;o.open("GET",s,!0),o.responseType="arraybuffer",o.onload=()=>{const s=new Blob([o.response],{type:"audio/mpeg"}),a=window.URL.createObjectURL(s);this._audioMap[i]=a,r.decodeAudioData(o.response,(i=>{let s=i.duration;t.durations[n]=s.toString(),this.getPlayerById(e).requestUpdate()}))},o.send()}})),"pending"}}getTimeElapsed(){return this.audioPlayer?Math.floor(this.audioPlayer.currentTime):0}setTimeElapsed(e){this.audioPlayer&&(0===this.audioPlayer.seekable.length?this.audioPlayer.addEventListener("canplay",(()=>this.setTimeElapsed(e)),{once:!0}):(this.audioPlayer.currentTime=e,this.audioView.elapsed=e,this.audioView.requestUpdate()))}addAudioClip(e){this.audioClips[e.id]=e,this.outs.updated.set()}removeAudioClip(e){this.isPlaying&&e==this.activeId&&this.stop(),e==this._narrationId&&(this.narrationId=""),delete this.audioClips[e]}updateAudioClip(e){this.getDuration(e),this.outs.updated.set()}onMetaComponent(e){const t=e.object;"NVScene"===t.node.typeName&&e.add&&(this.audioClips=t.audio.dictionary,t.once("load",(()=>{this.audioClips=t.audio.dictionary,this.outs.updated.set(),Object.keys(this.audioClips).forEach((e=>{this.updateAudioClip(this.audioClips[e].id)}))})))}fromData(e){const{outs:t}=this;e=e||{},this._narrationId=e.narrationId||null,t.narrationEnabled.setValue(null!=this._narrationId),this.audioClips[this._narrationId]||(t.narrationEnabled.setValue(!1),console.warn("Invalid narration audio ID"))}toData(){let e=null;return null!==this._narrationId&&(e={narrationId:this._narrationId}),e}play(e){const{outs:t}=this;t.isPlaying.value&&this.audioPlayer.pause(),this.activeId!==e&&this.setTimeElapsed(0),t.isPlaying.setValue(!0),this.audioView=this.audioViews[e],this.initializeClip(e),this.audioPlayer.play().then((()=>{this.activeId=e,this.isPlaying=!0,Object.keys(this.audioViews).forEach((e=>this.audioViews[e].requestUpdate())),this.analytics.sendProperty("Audio_Play",this.getAudioClipUri(e))})).catch((e=>l.ZP.show(`Failed to play audio at '${this.audioPlayer.getAttribute("src")}':${e}`,"warning")))}pause(){this.audioPlayer&&(this.outs.isPlaying.setValue(!1),this.audioPlayer.pause(),this.audioView.requestUpdate())}stop(){this.audioPlayer&&(this.pause(),this.setTimeElapsed(0),this.onEnd())}initializeClip(e){null===this.audioPlayer&&this.setupAudio();const t=this.audioClips[e];if(t){const e=t.uris[a.PD[this.language.outs.language.getValidatedValue()]];this.assetManager.getAssetUrl(e);if(this.audioPlayer.src!=this._audioMap[e]){this.audioPlayer.setAttribute("src",this._audioMap[e]),this.audioPlayer.load(),this.audioPlayer.children[0].setAttribute("src","");const n=t.captionUris[a.PD[this.language.outs.language.getValidatedValue()]];n&&this.audioPlayer.children[0].setAttribute("src",this.assetManager.getAssetUrl(n))}}}setupAudio(){if(null===this.audioPlayer){const e=this.audioPlayer=document.createElement("audio");e.onended=this.onEnd,e.setAttribute("controls",""),e.setAttribute("preload","auto"),e.addEventListener("timeupdate",this.onTimeChange),e.crossOrigin="anonymous",e.onerror=()=>{console.error(`Error ${e.error.code}; details: ${e.error.message}`)};const t=document.createElement("track");t.setAttribute("default",""),this.audioPlayer.append(t),t.addEventListener("cuechange",this.onCueChange),t.addEventListener("load",this.onLoadTrack)}}onLanguageChange(){this.stop()}}u.typeName="CVAudioManager",u.text="Audio",u.icon="",u.isSystemSingleton=!0,u.ins={playNarration:i.V5.Event("Audio.PlayNarration"),activeCaption:i.V5.String("Audio.ActiveCaption"),captionsEnabled:i.V5.Boolean("Audio.CaptionsEnabled",!0)},u.outs={narrationEnabled:i.V5.Boolean("Audio.NarrationEnabled",!1),narrationPlaying:i.V5.Boolean("Audio.NarrationPlaying",!1),isPlaying:i.V5.Boolean("Audio.IsPlaying",!1),updated:i.V5.Event("Audio.Updated")};let p=class extends c.ZP{constructor(){super(),this.audio=null,this.audioId="",this.elapsed=0,this.onDrag=this.onDrag.bind(this)}firstConnected(){this.classList.add("sv-audio-view")}update(e){if(e.has("elapsed")){const e=this.querySelector("#time-slider");e&&(e.value=this.elapsed.toString())}super.update(e)}render(){const e=this.audio.outs.isPlaying.value&&this.audioId==this.audio.activeId,t=this.audio.getDuration(this.audioId),n=this.formatSeconds(this.elapsed),i="pending"==t?t:this.formatSeconds(parseInt(t));return c.dy`this.playAudio(e,this.audioId)}>
${n}/${i}
`}playAudio(e,t){const n=this.audio;this.audio.outs.isPlaying.value&&this.audioId==this.audio.activeId?n.pause():n.play(t)}onDrag(e){e.stopPropagation()}onTimeChange(){this.audioId==this.audio.activeId&&(this.audio.initializeClip(this.audioId),this.audio.setTimeElapsed(0|parseFloat(this.querySelector("#time-slider").value)))}formatSeconds(e){var t=new Date(0);return t.setSeconds(e),t.toISOString().substring(15,19)}};d([(0,c.Cb)({attribute:!1})],p.prototype,"audio",void 0),d([(0,c.Cb)({attribute:!1})],p.prototype,"audioId",void 0),d([(0,c.Cb)({attribute:!1})],p.prototype,"elapsed",void 0),p=d([(0,c.Mo)("sv-audio-view")],p)},71507:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(76969);class s extends i.Z{constructor(e,t){super(e,t),this.background.layers.set(1)}get settingProperties(){return[this.ins.style,this.ins.color0,this.ins.color1]}get snapshotProperties(){return[this.ins.color0,this.ins.color1]}hide(){this.background.visible=!1}show(){this.background.visible=!0}fromData(e){this.ins.copyValues({style:i.u[e.style]||i.u.Solid,color0:e.color0||[.2,.25,.3],color1:e.color1||[.01,.03,.05]})}toData(){const e=this.ins;return{style:i.u[e.style.value],color0:e.color0.cloneValue(),color1:e.color1.cloneValue()}}}s.typeName="CVBackground"},27884:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var i=n(19588),s=n(82954),r=n(78943),o=n(80038),a=n(26775),l=n(2837),c=n(28581);const h=new i.P,d=new i.P,u=new s.U,p=new r._;class m extends l.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(m.camIns),this.object3D=new a.ZP}get camera(){return this.object3D}update(){const{autoActivate:e,activate:t}=this.ins;if(t.changed||e.changed&&e.value){const e=this.scene;e&&(e.activeCameraComponent=this)}const n=this.camera,{position:i,rotation:s,projection:r,fov:o,size:a,zoom:l,near:c,far:h}=this.ins;if(i.changed||s.changed){n.position.fromArray(i.value);const e=[s.value[0],s.value[1],s.value[2]];n.rotation.fromArray(e),n.updateMatrix()}return r.changed&&n.setProjection(r.getValidatedValue()),n.fov=o.value,n.size=a.value,n.zoom=l.value,n.near=c.value,n.far=h.value,n.updateProjectionMatrix(),!0}dispose(){const e=this.scene;e&&e.activeCameraComponent===this&&(e.activeCameraComponent=null),super.dispose()}setPropertiesFromMatrix(e){const t=!e;e=e||this.object3D.matrix;const{position:n,rotation:i,order:s}=this.ins;e.decompose(h,p,d),h.toArray(n.value);const r=s.getOptionText();u.setFromQuaternion(p,r),h.setFromEuler(u),h.multiplyScalar(c.Z.RAD2DEG).toArray(i.value),n.set(t),i.set(t)}}m.typeName="CCamera",m.camIns={autoActivate:o.V5.Boolean("Camera.AutoActivate",!0),activate:o.V5.Event("Camera.Activate"),position:o.V5.Vector3("Transform.Position"),rotation:o.V5.Vector3("Transform.Rotation"),order:o.V5.Enum("Transform.Order",l.VZ,l.VZ.ZYX),projection:o.V5.Enum("Projection.Type",a.mP,a.mP.Perspective),fov:o.V5.Number("Projection.FovY",52),size:o.V5.Number("Projection.Size",20),zoom:o.V5.Number("Projection.Zoom",1),near:o.V5.Number("Frustum.ZNear",.01),far:o.V5.Number("Frustum.ZFar",1e4)};class f extends m{constructor(e,t){super(e,t),this.addIns=this.addInputs(f.cameraAddIns),this.object3D.layers.enable(1)}get settingProperties(){return[this.ins.projection,this.ins.fov,this.ins.size,this.ins.near,this.ins.far,this.addIns.autoNearFar]}fromDocument(e,t){if(!isFinite(t.camera))throw new Error("camera property missing in node");const n=e.cameras[t.camera];return null!=n.autoNearFar&&this.addIns.autoNearFar.setValue(n.autoNearFar),"perspective"===n.type?this.ins.copyValues({projection:a.mP.Perspective,fov:n.perspective.yfov,near:n.perspective.znear,far:n.perspective.zfar}):this.ins.copyValues({projection:a.mP.Orthographic,size:n.orthographic.ymag,near:n.orthographic.znear,far:n.orthographic.zfar}),t.camera}toDocument(e,t){const n=this.ins,i={};n.projection.getValidatedValue()===a.mP.Perspective?(i.type="perspective",i.perspective={yfov:n.fov.value,znear:n.near.value,zfar:n.far.value}):(i.type="orthographic",i.orthographic={ymag:n.size.value,znear:n.near.value,zfar:n.far.value}),i.autoNearFar=this.addIns.autoNearFar.value,e.cameras=e.cameras||[];const s=e.cameras.length;return e.cameras.push(i),s}}f.typeName="CVCamera",f.text="Camera",f.icon="video",f.cameraAddIns={autoNearFar:l.V5.Boolean("Frustum.AutoNearFar",!0)}},48377:(e,t,n)=>{"use strict";n.d(t,{Z:()=>M});var i=n(31271),s=n(80038),r=n(25499),o=n(18894),a=n(92642),l=n(36283);class c extends o.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(c.rgIns),this._object3D=null,this._isAttached=!1,this._object3D=new r.T,this._object3D.matrixAutoUpdate=!1}get transform(){return this.node.components.get(a.ZP,!0)}get scene(){const e=this.transform;return e?e.getParentComponent(l.Z,!0):void 0}get object3D(){return this._object3D}create(){super.create(),this.innerRoots.filter((e=>e.is(a.ZP))).forEach((e=>this._object3D.add(e.object3D))),this.trackComponent(a.ZP,(e=>this.ins.visible.value&&this.attachObject3D(e)),(e=>this.detachObject3D(e)))}dispose(){this.detachObject3D(this.transform),this.innerRoots.filter((e=>e.is(a.ZP))).forEach((e=>this._object3D.remove(e.object3D))),super.dispose()}update(e){super.update(e);const t=this.ins;if(t.visible.changed){const e=this.transform;t.visible.value?this.attachObject3D(e):this.detachObject3D(e)}return!0}onAddInnerRoot(e){e.is(a.ZP)&&this._object3D.add(e.object3D)}onRemoveInnerRoot(e){e.is(a.ZP)&&this._object3D.remove(e.object3D)}attachObject3D(e){this._isAttached||e&&(e.object3D.add(this._object3D),this._isAttached=!0)}detachObject3D(e){this._isAttached&&e&&(e.object3D.remove(this._object3D),this._isAttached=!1)}}c.typeName="CRenderGraph",c.rgIns={visible:o.V5.Boolean("Graph.Visible",!0)};var h=n(75310),d=n.n(h);const u=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/document.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Smithsonian 3D Document","description":"Describes a 3D document containing a scene with 3D models.","definitions":{"scene":{"$id":"#scene","type":"object","properties":{"nodes":{"type":"array","description":"The indices of the scene\'s root nodes.","items":{"type":"integer","minimum":0},"uniqueItems":true,"minItems":1},"setup":{"description":"The index of the scene\'s setup.","type":"integer","minimum":0}}},"node":{"$id":"#node","type":"object","properties":{"name":{"type":"string"},"children":{"type":"array","description":"The indices of this node\'s children.","items":{"type":"integer","minimum":0},"uniqueItems":true,"minItems":1},"matrix":{"description":"A floating-point 4x4 transformation matrix stored in column-major order.","type":"array","items":{"type":"number"},"minItems":16,"maxItems":16,"default":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},"translation":{"description":"The node\'s translation along the x, y, and z axes.","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[0,0,0]},"rotation":{"description":"The node\'s unit quaternion rotation in the order (x, y, z, w), where w is the scalar.","type":"array","items":{"type":"number","minimum":-1,"maximum":1},"minItems":4,"maxItems":4,"default":[0,0,0,1]},"scale":{"description":"The node\'s non-uniform scale, given as the scaling factors along the x, y, and z axes.","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[1,1,1]},"camera":{"description":"The index of the camera component of this node.","type":"integer","minimum":0},"light":{"description":"The index of the light component of this node.","type":"integer","minimum":0},"meta":{"description":"The index of the meta data component of this node.","type":"integer","minimum":0},"model":{"description":"The index of the model component of this node.","type":"integer","minimum":0}},"not":{"anyOf":[{"required":["matrix","translation"]},{"required":["matrix","rotation"]},{"required":["matrix","scale"]}]}},"camera":{"$id":"#camera","type":"object","properties":{"type":{"description":"Specifies if the camera uses a perspective or orthographic projection.","type":"string","enum":["perspective","orthographic"]},"perspective":{"description":"A perspective camera containing properties to create a perspective projection matrix.","type":"object","properties":{"yfov":{"type":"number","description":"The floating-point vertical field of view in radians.","exclusiveMinimum":0},"aspectRatio":{"type":"number","description":"The floating-point aspect ratio of the field of view.","exclusiveMinimum":0},"znear":{"type":"number","description":"The floating-point distance to the near clipping plane.","exclusiveMinimum":0},"zfar":{"type":"number","description":"The floating-point distance to the far clipping plane.","exclusiveMinimum":0}},"required":["yfov","znear"]},"orthographic":{"description":"An orthographic camera containing properties to create an orthographic projection matrix.","type":"object","properties":{"xmag":{"type":"number","description":"The floating-point horizontal magnification of the view. Must not be zero."},"ymag":{"type":"number","description":"The floating-point vertical magnification of the view. Must not be zero."},"znear":{"type":"number","description":"The floating-point distance to the near clipping plane.","exclusiveMinimum":0},"zfar":{"type":"number","description":"The floating-point distance to the far clipping plane. `zfar` must be greater than `znear`.","exclusiveMinimum":0}},"required":["ymag","znear","zfar"]},"autoNearFar":{"type":"boolean","default":true}},"required":["type"],"not":{"required":["perspective","orthographic","autoNearFar"]}},"light":{"$id":"#light","type":"object","properties":{"type":{"description":"Specifies the type of the light source.","type":"string","enum":["ambient","directional","point","spot","hemisphere","rect"]},"color":{"$ref":"#/definitions/colorRGB"},"intensity":{"type":"number","minimum":0,"default":1},"castShadow":{"type":"boolean","default":false},"point":{"type":"object","properties":{"distance":{"type":"number","minimum":0},"decay":{"type":"number","minimum":0}}},"spot":{"type":"object","properties":{"distance":{"type":"number","minimum":0},"decay":{"type":"number","minimum":0},"angle":{"type":"number","minimum":0},"penumbra":{"type":"number","minimum":0}}},"hemisphere":{"type":"object","properties":{"groundColor":{"$ref":"#/definitions/colorRGB"}}}},"required":["type"],"not":{"required":["point","spot","hemisphere"]}},"colorRGB":{"$id":"#colorRGB","type":"array","items":{"type":"number","minimum":0,"maximum":1},"minItems":3,"maxItems":3,"default":[1,1,1]}},"type":"object","properties":{"asset":{"type":"object","properties":{"type":{"type":"string","const":"application/si-dpo-3d.document+json"},"version":{"description":"Version of this presentation description.","type":"string","minLength":1},"copyright":{"description":"A copyright message to credit the content creator.","type":"string","minLength":1},"generator":{"description":"Tool that generated this presentation description.","type":"string","minLength":1}},"required":["type","version"]},"scene":{"description":"Index of the root scene of the document.","type":"integer","minimum":0},"scenes":{"description":"An array of scenes.","type":"array","items":{"$ref":"#/definitions/scene"}},"nodes":{"description":"An array of nodes.","type":"array","items":{"$ref":"#/definitions/node"},"minItems":1},"metas":{"description":"An array of meta data components.","type":"array","items":{"$ref":"./meta.schema.json"}},"setups":{"description":"An array of setup components.","type":"array","items":{"$ref":"./setup.schema.json"},"minItems":1},"cameras":{"description":"An array of camera components.","type":"array","items":{"$ref":"#/definitions/camera"},"minItems":1},"lights":{"description":"An array of light components.","type":"array","items":{"$ref":"#/definitions/light"},"minItems":1},"models":{"description":"An array of model components.","type":"array","items":{"$ref":"./model.schema.json"},"minItems":1}},"required":["asset","scene","scenes"],"additionalProperties":false}'),p=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/common.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Math","description":"Definitions for mathematical compound objects such as vectors and matrices.","definitions":{"units":{"$id":"#units","type":"string","enum":["inherit","mm","cm","m","km","in","ft","yd","mi"]},"vector2":{"description":"2-component vector.","$id":"#vector2","type":"array","items":{"type":"number"},"minItems":2,"maxItems":2,"default":[0,0]},"vector3":{"description":"3-component vector.","$id":"#vector3","type":"array","items":{"type":"number"},"minItems":3,"maxItems":3,"default":[0,0,0]},"vector4":{"description":"4-component vector.","$id":"#vector4","type":"array","items":{"type":"number"},"minItems":4,"maxItems":4,"default":[0,0,0,0]},"matrix3":{"description":"3 by 3, matrix, storage: column-major.","$id":"#matrix3","type":"array","items":{"type":"number"},"minItems":9,"maxItems":9,"default":[1,0,0,0,1,0,0,0,1]},"matrix4":{"description":"4 by 4 matrix, storage: column-major.","$id":"#matrix4","type":"array","items":{"type":"number"},"minItems":16,"maxItems":16,"default":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},"boundingBox":{"description":"Axis-aligned 3D bounding box.","$id":"#boundingBox","type":"object","properties":{"min":{"$ref":"#/definitions/vector3"},"max":{"$ref":"#/definitions/vector3"}},"required":["min","max"]}}}'),m=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/meta.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Meta","description":"Meta data for a scene or model item.","definitions":{"image":{"$id":"image","description":"Reference to a preview image","type":"object","properties":{"uri":{"description":"Location of the image resource, absolute URL or path relative to this document","type":"string","minLength":1},"quality":{"type":"string","enum":["Thumb","Low","Medium","High"]},"byteSize":{"type":"integer","minimum":1},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"usage":{"type":"string","enum":["Render","ARCode"]}},"required":["uri","quality"]},"article":{"$id":"#article","description":"Reference to an external document (HTML)","type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"description":"Short title.","type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"description":"Short lead text.","type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"tags":{"description":"Array of tags, categorizing the article.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"intros":{"description":"Introductory splash screen text with language key.","type":"object"},"uri":{"description":"Location of the article resource, absolute URL or path relative to this document","type":"string","minLength":1},"uris":{"description":"Location of the article resource, absolute URL or path relative to this document with language key","type":"object"},"mimeType":{"description":"MIME type of the resource.","type":"string"},"thumbnailUri":{"description":"Location of a thumbnail/preview image of the resource.","type":"string"}},"required":["id"],"additionalProperties":false},"audioclip":{"$id":"audioclip","description":"Reference to an audio file","type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"description":"Short name.","type":"string"},"uris":{"description":"Location of the audio resource, absolute URL or path relative to this document with language key","type":"object"},"captionUris":{"description":"Location of the caption resource, absolute URL or path relative to this document with language key","type":"object"},"durations":{"description":"Length of the audio resource with language key","type":"object"}},"required":["id","uris"]}},"type":"object","properties":{"collection":{"description":"Information retrieved from the collection record for the item.","type":"object"},"process":{"description":"Information about how the item was processed.","type":"object"},"images":{"type":"array","items":{"$ref":"#/definitions/image"},"minItems":1},"articles":{"type":"array","items":{"$ref":"#/definitions/article"},"minItems":1},"leadArticle":{"description":"Index of the main article. This is the default article displayed with the item.","type":"integer","minimum":0},"audio":{"type":"array","items":{"$ref":"#/definitions/audioclip"},"minItems":0}},"additionalProperties":false}'),f=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/model.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Model","description":"Describes the visual representations (models, derivatives) of a 3D item.","definitions":{"annotation":{"description":"Spatial annotation (hot spot, hot zone) on a model. Annotations can reference articles.","type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"marker":{"type":"string"},"tags":{"description":"Array of tags, categorizing the annotation.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"articleId":{"description":"Id of an article related to this annotation.","type":"string","minLength":1},"imageUri":{"description":"URI of an image resource for this annotation.","type":"string","minLength":1},"imageCredit":{"description":"Credit line image in this annotation with language key.","type":"object"},"imageAltText":{"description":"Alt text for image in this annotation with language key","type":"object"},"audioId":{"description":"Id of an audio resource for this annotation.","type":"string","minLength":1},"viewId":{"description":"Id of a snapshot resource with camera view information for this annotation.","type":"string","minLength":1},"style":{"type":"string"},"visible":{"description":"Flag indicating whether the annotation is visible.","type":"boolean","default":true},"expanded":{"description":"Flag indicating whether the annotation is displayed in expanded state.","type":"boolean","default":false},"scale":{"description":"Scales the annotation relative to its default size.","type":"number","default":1},"offset":{"description":"Offsets the annotation along its direction.","type":"number","default":0},"tilt":{"description":"Tilt angle of the annotation relative to the direction vector in degrees.","type":"number","default":0},"azimuth":{"description":"Azimuth angle of a tilted annotation.","type":"number","default":0},"color":{"description":"Color of the annotation","type":"array","minItems":3,"maxItems":3,"items":{"type":"number"}},"position":{"description":"Position where the annotation is anchored, in local item coordinates.","$ref":"./common.schema.json#/definitions/vector3"},"direction":{"description":"Direction of the stem of this annotation, usually corresponds to the surface normal.","$ref":"./common.schema.json#/definitions/vector3"},"zoneIndex":{"description":"Index of the zone on the zone texture.","type":"integer","minimum":0}},"required":["id"],"additionalProperties":false},"derivative":{"description":"Visual representation derived from the master model.","type":"object","properties":{"usage":{"description":"usage categories for a derivative.","type":"string","enum":["Image2D","Web3D","App3D","iOSApp3D","Print3D","Editorial3D"]},"quality":{"type":"string","enum":["Thumb","Low","Medium","High","Highest","AR"]},"assets":{"description":"List of individual resources this derivative is composed of.","type":"array","items":{"$ref":"#/definitions/asset"}}}},"asset":{"description":"an individual resource for a 3D model.","type":"object","properties":{"uri":{"type":"string","minLength":1},"type":{"type":"string","enum":["Model","Geometry","Image","Texture","Points","Volume"]},"part":{"type":"string","minLength":1},"mimeType":{"type":"string","minLength":1},"byteSize":{"type":"integer","minimum":1},"numFaces":{"type":"integer","minimum":1},"imageSize":{"type":"integer","minimum":1},"mapType":{"type":"string","enum":["Color","Normal","Occlusion","Emissive","MetallicRoughness","Zone"]}},"required":["uri","type"]},"material":{"description":"Surface properties for this model, shared by all derivatives.","type":"object","properties":{}}},"type":"object","properties":{"units":{"$ref":"./common.schema.json#/definitions/units"},"tags":{"type":"string"},"visible":{"type":"boolean"},"renderOrder":{"type":"number"},"overlayMap":{"type":"number"},"shadowSide":{"type":"string","enum":["Front","Back","Double"]},"derivatives":{"type":"array","items":{"$ref":"#/definitions/derivative"}},"translation":{"description":"Translation vector. Must be applied to bring model into its \'neutral\' pose.","$ref":"./common.schema.json#/definitions/vector3"},"rotation":{"description":"Rotation quaternion. Must be applied to bring model into its \'neutral\' pose.","$ref":"./common.schema.json#/definitions/vector4"},"boundingBox":{"description":"Bounding box for this model, shared by all derivatives.","$ref":"./common.schema.json#/definitions/boundingBox"},"material":{"$ref":"#/definitions/material"},"annotations":{"description":"List of annotations to be displayed with the model","type":"array","items":{"$ref":"#/definitions/annotation"}}},"required":["units","derivatives"],"additionalProperties":false}'),g=JSON.parse('{"$id":"https://schemas.3d.si.edu/voyager/setup.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"Setup","description":"Tours and settings for explorer documents (background, interface, etc.)","definitions":{"viewer":{"type":"object","properties":{"shader":{"type":"string"},"exposure":{"type":"number"},"toneMapping":{"type":"boolean"},"gamma":{"type":"number"},"annotationsVisible":{"type":"boolean"},"isWallMountAR":{"type":"boolean"},"arScale":{"type":"number"},"activeTags":{"type":"string"},"sortedTags":{"type":"string"},"radioTags":{"type":"boolean"}},"required":["shader","exposure","gamma"]},"reader":{"type":"object","properties":{"enabled":{"type":"boolean"},"position":{"type":"string"},"articleId":{"description":"Id of the article currently displayed in the reader.","type":"string","minLength":1}}},"interface":{"type":"object","properties":{"visible":{"type":"boolean"},"logo":{"type":"boolean"},"menu":{"type":"boolean"},"tools":{"type":"boolean"}}},"navigation":{"type":"object","properties":{"type":{"type":"string","enum":["Orbit","Walk"]},"enabled":{"type":"boolean"},"autoZoom":{"type":"boolean"},"autoRotation":{"type":"boolean"},"lightsFollowCamera":{"type":"boolean"},"orbit":{"$comment":"TODO: Implement","type":"object","properties":{}},"walk":{"$comment":"TODO: Implement","type":"object","properties":{}}}},"background":{"type":"object","properties":{"style":{"type":"string","enum":["Solid","LinearGradient","RadialGradient"]},"color0":{"$ref":"./common.schema.json#/definitions/vector3"},"color1":{"$ref":"./common.schema.json#/definitions/vector3"}}},"floor":{"type":"object","properties":{"visible":{"type":"boolean"},"position":{"$ref":"./common.schema.json#/definitions/vector3"},"size":{"type":"number"},"color":{"$ref":"./common.schema.json#/definitions/vector3"},"opacity":{"type":"number"},"receiveShadow":{"type":"boolean"},"autoSize":{"type":"boolean"}}},"grid":{"type":"object","properties":{"visible":{"type":"boolean"},"color":{"$ref":"./common.schema.json#/definitions/vector3"}}},"tape":{"type":"object","properties":{"enabled":{"type":"boolean"},"startPosition":{"$ref":"./common.schema.json#/definitions/vector3"},"startDirection":{"$ref":"./common.schema.json#/definitions/vector3"},"endPosition":{"$ref":"./common.schema.json#/definitions/vector3"},"endDirection":{"$ref":"./common.schema.json#/definitions/vector3"}}},"slicer":{"type":"object","properties":{"enabled":{"type":"boolean"},"axis":{"type":"string","enum":["X","Y","Z"]},"inverted":{"type":"boolean"},"position":{"type":"number"},"color":{"$ref":"./common.schema.json#/definitions/vector3"}}},"audio":{"type":"object","properties":{"narrationId":{"type":"string"}}},"language":{"type":"object","properties":{"language":{"type":"string","enum":["EN","ES","DE","NL","JA","FR","HAW"]}}},"tours":{"description":"Animated tours.","type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"lead":{"type":"string"},"leads":{"description":"Short lead text with language key.","type":"object"},"tags":{"description":"Array of tags, categorizing the tour.","type":"array","items":{"type":"string"}},"taglist":{"description":"Array of tags, categorizing the annotation with language key.","type":"object"},"steps":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"titles":{"description":"Short title with language key.","type":"object"},"id":{"type":"string"}}}}}}},"snapshots":{"description":"Snapshots are animatable scene states.","type":"object","properties":{"features":{"type":"array","items":{"type":"string"}},"targets":{"type":"array","items":{"type":"string"}},"states":{"type":"array","items":{"type":"object"}}}}},"type":"object","properties":{"units":{"$ref":"./common.schema.json#/definitions/units"},"interface":{"$ref":"#/definitions/interface"},"viewer":{"$ref":"#/definitions/viewer"},"reader":{"$ref":"#/definitions/reader"},"navigation":{"$ref":"#/definitions/navigation"},"background":{"$ref":"#/definitions/background"},"floor":{"$ref":"#/definitions/floor"},"grid":{"$ref":"#/definitions/grid"},"tape":{"$ref":"#/definitions/tape"},"slicer":{"$ref":"#/definitions/slicer"},"tours":{"$ref":"#/definitions/tours"},"language":{"$ref":"#/definitions/language"},"audio":{"$ref":"#/definitions/audio"}}}');var v=n(75222),y=n(82567),b=n(84678),_=n(79815),x=n(63872),w=n(11359),S=n(1594);class M extends c{constructor(e,t){super(e,t),this.titles={},this.intros={},this.meta=null,this.ins=this.addInputs(M.ins),this.outs=this.addOutputs(M.outs),this.innerGraph.createCustomNode(y.Z),this.ins.active.setValue(!1),this.ins.visible.setValue(!1)}get root(){return this.innerNodes.get(y.Z)}get setup(){return this.innerComponents.get(_.Z)}get assetPath(){return this.outs.assetPath.value}get assetBaseName(){let e=this.assetPath;const t=e.indexOf(".svx.json");return t>=0&&(e=e.substr(0,t)),e}get analytics(){return this.getMainComponent(w.Z)}create(){super.create(),this.innerGraph.components.on(b.Z,this.onMetaComponent,this),this.setup.language.outs.language.on("value",this.onLanguageUpdate,this)}dispose(){this.setup.language.outs.language.off("value",this.onLanguageUpdate,this),this.innerGraph.components.off(b.Z,this.onMetaComponent,this),super.dispose()}update(e){super.update(e);const{ins:t,outs:n}=this;if(t.dumpJson.changed){const e=this.deflateDocument();console.log("-------------------- VOYAGER DOCUMENT --------------------"),console.log(JSON.stringify(e,((e,t)=>"number"==typeof t?parseFloat(t.toFixed(5)):t),2))}if(t.dumpTree.changed&&(console.log("-------------------- VOYAGER DOCUMENT --------------------"),this.dump()),t.download.changed){const e=n.assetPath.value.split("/").pop()||"voyager-document.json";i.Z.json(this.deflateDocument(),e)}if(t.title.changed&&this.titles){const e=this.setup.language;t.title.setValue(t.title.value,!0),n.title.setValue(t.title.value),t.title.value&&(this.titles[S.PD[e.outs.language.value]]=t.title.value,this.updateMeta())}if(t.intro.changed&&this.intros){const e=this.setup.language;n.intro.setValue(t.intro.value),this.intros[S.PD[e.outs.language.value]]=t.intro.value,this.updateMeta()}return!0}clearNodeTree(){this.root.transform.children.slice().forEach((e=>e.node.dispose()))}openDocument(e,t,n){if(!M.validator.validate(e))throw new Error("document schema validation failed");n||(this.clearNodeTree(),this.ins.title.setValue(null)),this.onMetaComponent({type:"CVMeta",object:this.root.meta,add:!0,remove:!1});let i="object"==typeof n?n:this.root;if(i.graph!==this.innerGraph)throw new Error("invalid parent node");const s=new Map;if(i instanceof y.Z)i.fromDocument(e,e.scene,s);else{e.scenes[e.scene].nodes.forEach((t=>{const n=this.innerGraph.createCustomNode(v.Z);i.transform.addChild(n.transform),n.fromDocument(e,t,s)}))}t&&(this.outs.assetPath.setValue(t),this.name=this.getMainComponent(x.Z).getAssetName(t))}appendModel(e,t,n){if(n&&n.graph!==this.innerGraph)throw new Error("invalid parent node");if(this.isEmpty())throw new Error("empty document, can't append model");n=n||this.root;const i=this.innerGraph.createCustomNode(v.Z);n.transform.addChild(i.transform),i.createModel();const s=i.model;return s.derivatives.createModelAsset(e,t),s}appendGeometry(e,t,n,i,s,r){if(r&&r.graph!==this.innerGraph)throw new Error("invalid parent node");if(this.isEmpty())throw new Error("empty document, can't append geometry");r=r||this.root;const o=this.innerGraph.createCustomNode(v.Z);r.transform.addChild(o.transform),o.createModel();o.model.derivatives.createMeshAsset(e,t,n,i,s)}deflateDocument(e){if(this.isEmpty())throw new Error("empty document, can't serialize");const t={asset:{type:M.mimeType,version:M.version,generator:"Voyager",copyright:"(c) Smithsonian Institution. All rights reserved."},scene:0,scenes:[]},n=new Map;return t.scene=this.root.toDocument(t,n,e),t}onMetaComponent(e){const t=e.object,n=this.ins.title,i=this.ins.intro,s=this.setup.language;null===this.meta&&(this.meta=t),e.add&&!n.value&&t.once("load",(()=>{this.titles=t.collection.get("titles")||{},this.intros=t.collection.get("intros")||{},0===Object.keys(this.titles).length&&(this.titles[S.PD[s.outs.language.value]]=t.collection.get("title")||"",t.collection.dictionary.titles=this.titles);const e=this.titles[S.PD[s.outs.language.value]];n.setValue(e);const r=this.intros[S.PD[s.outs.language.value]]||"";i.setValue(r),this.analytics.setTitle(e),this.meta=t}))}onLanguageUpdate(){const e=this.setup.language,t=this.titles[S.PD[e.outs.language.value]];this.ins.title.setValue(t);const n=this.intros[S.PD[e.outs.language.value]]||"";this.ins.intro.setValue(n)}updateMeta(){const e=this.meta;e&&(e.collection.dictionary.titles=this.titles,e.collection.dictionary.intros=this.intros)}}M.typeName="CVDocument",M.mimeType="application/si-dpo-3d.document+json",M.version="1.0",M.validator=new class{constructor(){this._schemaValidator=new(d())({schemas:[u,p,m,f,g],allErrors:!0}),this._validateDocument=this._schemaValidator.getSchema("https://schemas.3d.si.edu/voyager/document.schema.json")}validate(e){return!!this._validateDocument(e)||(console.warn(this._schemaValidator.errorsText(this._validateDocument.errors,{separator:", ",dataVar:"document"})),!1)}},M.ins={dumpJson:s.V5.Event("Document.DumpJSON"),dumpTree:s.V5.Event("Document.DumpTree"),download:s.V5.Event("Document.Download"),title:s.V5.String("Document.Title"),intro:s.V5.String("Document.Intro","")},M.outs={assetPath:s.V5.AssetPath("Asset.Path",{preset:"scene.svx.json"}),title:s.V5.String("Document.Title"),intro:s.V5.String("Document.Intro","")}},25864:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(80038),s=n(63833),r=n(48377);class o extends s.Z{constructor(e,t){super(e,t),this.outs=this.addOutputs(o.outs),this.scope=s.$.Node}createDocument(e,t){const n=this.node.createComponent(r.Z);return this.activeComponent=n,e&&n.openDocument(e,t),n}amendDocument(e,t,n){const i=this.activeComponent;if(!i)throw new Error("no active document, can't amend");return i.openDocument(e,t,n),i}refreshDocument(){this.emit({type:"active-component",previous:null,next:this.activeComponent})}appendModel(e,t){const n=this.activeComponent;if(!n)throw new Error("no active document, can't append model");return n.appendModel(e,t),n}appendGeometry(e,t,n,i,s){const r=this.activeComponent;if(!r)throw new Error("no active document, can't append geometry");return r.appendGeometry(e,t,n,i,s),r}removeActiveDocument(){const e=this.activeComponent;e&&e.dispose()}activateComponent(e){e.ins.visible.setValue(!0),e.ins.active.setValue(!0)}deactivateComponent(e){e.ins.visible.setValue(!1),e.ins.active.setValue(!1)}onActiveComponent(e,t){this.outs.activeDocument.setValue(t)}onScopedComponents(){this.outs.changedDocuments.set()}}o.typeName="CVDocumentProvider",o.componentType=r.Z,o.outs={activeDocument:i.V5.Object("Documents.Active",r.Z),changedDocuments:i.V5.Event("Documents.Changed")}},24856:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var i=n(75544),s=n(80038),r=n(68327),o=n(26629),a=n(36283);const l=["Footprint_Court_1k_TMap.jpg","spruit_sunrise_1k_LDR.jpg","campbell_env.jpg"];class c extends s.ZP{constructor(){super(...arguments),this.ins=this.addInputs(c.envIns),this._texture=null,this._currentIdx=0,this.shouldUseEnvMap=!1}get assetReader(){return this.getMainComponent(r.Z)}get sceneNode(){return this.getSystemComponent(a.Z)}update(){const e=this.ins,t=this.getGraphComponent(o.Z);return e.dirty.changed&&(this.shouldUseEnvMap=!1,t.models.forEach((t=>{t.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(n.roughnessMap||n.metalnessMap)&&(this.shouldUseEnvMap=!0,null!==this._texture&&(this._texture.dispose(),this._texture=null),e.imageIndex.set())}))}))),e.imageIndex.changed&&this.shouldUseEnvMap&&(e.imageIndex.value==this._currentIdx&&null!==this._texture||(null!==this._texture&&this._texture.dispose(),this.assetReader.getSystemTexture("images/"+l[e.imageIndex.value]).then((e=>{this._texture=e,this._texture.mapping=i.dSO,this.sceneNode.scene.environment=this._texture})),this._currentIdx=e.imageIndex.value)),!0}fromData(e){this.ins.copyValues({imageIndex:e.index})}toData(){return{index:this.ins.imageIndex.cloneValue()}}}c.typeName="CVEnvironment",c.text="Environment",c.envIns={imageIndex:s.V5.Integer("Environment.Index",{preset:0,options:l.map((function(e,t){return t.toString()}))}),dirty:s.V5.Event("Environment.Dirty")}},97322:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var i=n(2837),s=n(8035),r=n(83866),o=n(71050),a=n(41654),l=n(8173),c=n(17393);const h=n(93523).Z,d=n(62001).Z;class u extends s.K{constructor(){super(new r._(2,2,1,1),new p),this.geometry.rotateX(-90*o.M8.DEG2RAD),this.receiveShadow=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class p extends a.x{constructor(e){super(e),this.defines={},this.type="FloorMaterial",this.isMeshPhongMaterial=!0,this.isFloorMaterial=!0,this.defines={},this.uniforms=l.rD.merge([c.V.phong.uniforms]),this.vertexShader=d,this.fragmentShader=h,this.transparent=!0,this.shininess=0}}class m extends i.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(m.floorIns),this.object3D=new u}get floor(){return this.object3D}update(e){super.update(e);const t=this.ins,n=this.floor;return(t.position.changed||t.radius.changed)&&(n.position.fromArray(t.position.value),n.scale.setScalar(t.radius.value),n.updateMatrix()),t.color.changed&&n.material.color.fromArray(t.color.value),t.opacity.changed&&(n.material.opacity=t.opacity.value),!0}dispose(){this.floor.dispose(),super.dispose()}}m.typeName="CFloor",m.floorIns={position:i.V5.Vector3("Floor.Position",[0,-25,0]),radius:i.V5.Number("Floor.Radius",50),color:i.V5.ColorRGB("Floor.Color",[.6,.75,.8]),opacity:i.V5.Percent("Floor.Opacity",.5),castShadow:i.V5.Boolean("Shadow.Cast"),receiveShadow:i.V5.Boolean("Shadow.Receive")};var f=n(80038),g=n(26629);const v=new(n(19588).P);class y extends m{constructor(e,t){super(e,t),this.addIns=this.addInputs(y.floorAddIns),this.ins.visible.setValue(!1),this.ins.receiveShadow.setValue(!0),this.floor.renderOrder=-1}get settingProperties(){return[this.ins.visible,this.ins.position,this.ins.radius,this.ins.color,this.ins.opacity,this.ins.receiveShadow,this.addIns.autoSize]}get snapshotProperties(){return[this.ins.opacity]}get sceneNode(){return this.getSystemComponent(g.Z)}create(){super.create(),this.sceneNode.outs.boundingBox.on("value",this.recalculateSize,this)}dispose(){this.sceneNode.outs.boundingBox.off("value",this.recalculateSize,this),super.dispose()}update(e){const t=this.addIns;return t.autoSize.changed&&t.autoSize.value&&this.recalculateSize(),super.update(e),!0}recalculateSize(){const{addIns:e}=this;if(e.autoSize.value){const e=this.sceneNode.outs.boundingBox.value;e.getSize(v);const t=Math.max(v.x,v.y,v.z),{min:n,max:i}=e;this.ins.radius.setValue(t),this.ins.position.setValue([(n.x+i.x)/2,n.y,(n.z+i.z)/2])}}fromData(e){e=e||{},this.ins.copyValues({visible:!!e.visible,position:e.position||[0,-25,0],radius:void 0!==e.size?e.size:50,color:e.color||[.6,.75,.8],opacity:void 0!==e.opacity?e.opacity:.5,receiveShadow:!!e.receiveShadow,autoSize:void 0===e.autoSize||e.autoSize})}toData(){const e=this.ins;return{visible:e.visible.value,position:e.position.cloneValue(),size:e.radius.value,color:e.color.cloneValue(),opacity:e.opacity.value,receiveShadow:e.receiveShadow.value,autoSize:this.addIns.autoSize.value}}}y.typeName="CVFloor",y.text="Floor",y.icon="",y.floorAddIns={autoSize:f.V5.Boolean("Floor.AutoSize",!0)}},6461:(e,t,n)=>{"use strict";n.d(t,{Z:()=>x});var i=n(19588),s=n(82587),r=n(93113),o=n(37840),a=n(28092),l=n(64026),c=n(75809),h=n(35322);class d extends a.e{constructor(e){super(d.generate(e),new l.n({color:4294967295,vertexColors:!0}))}set opacity(e){this.material.opacity=e,this.material.transparent=e<1}update(e){this.geometry&&this.geometry.dispose(),this.geometry=d.generate(e)}static generate(e){const t=new r.I(e.mainColor),n=new r.I(e.subColor),i=e.mainDivisions*e.subDivisions,s=e.size/i,o=.5*e.size,a=[],l=[];for(let r=0,c=0,h=-o;r<=i;++r,h+=s){a.push(-o,0,h,o,0,h),a.push(h,0,-o,h,0,o);const i=r%e.subDivisions==0?t:n;i.toArray(l,c),c+=3,i.toArray(l,c),c+=3,i.toArray(l,c),c+=3,i.toArray(l,c),c+=3}const d=new c.u;return d.setAttribute("position",new h.a$(a,3)),d.setAttribute("color",new h.a$(l,3)),d}}var u=n(80038),p=n(2837),m=n(1594),f=n(26629),g=n(29767);const v=new i.P,y=new i.P,b=(new s.y).makeRotationX(.5*Math.PI),_=new s.y;class x extends p.ZP{constructor(){super(...arguments),this.tape=null,this.ins=this.addInputs(x.gridIns),this.outs=this.addOutputs(x.gridOuts),this._lastViewport=null,this._gridProps={size:20,mainDivisions:2,subDivisions:10,mainColor:new r.I(.5,.7,.8),subColor:new r.I(.25,.35,.4)}}get settingProperties(){return[this.ins.visible,this.ins.color,this.ins.opacity]}get snapshotProperties(){return[this.ins.opacity]}get grid(){return this.object3D}create(){this.ins.pickable.setValue(!1),this.ins.visible.setValue(!1),this.tape=this.node.createComponent(g.Z),this.tape.ins.startPosition.setValue([0,0,0]),this.tape.ins.endPosition.setValue([0,0,0]),this.tape.ins.visible.setValue(!1),this.tape.addTag("no_settings"),super.create()}activate(){this.getGraphComponent(f.Z).outs.boundingBox.linkTo(this.ins.boundingBox)}update(){const e=this.ins;if(e.color.changed||e.boundingBox.changed){const t=this._gridProps;if(e.color.changed){const n=t.mainColor,i=t.subColor;n.fromArray(e.color.value),i.r=.5*n.r,i.g=.5*n.g,i.b=.5*n.b}if(e.boundingBox.changed){const e=this.getGraphComponent(f.Z),n=e.outs.boundingBox.value,i=e.ins.units.value;n.getSize(v);let s=Math.max(v.x,v.y,v.z),r=1;for(;s/r>5;)r*=10;s=Math.ceil(s/r)*r*2,t.size=s,this.outs.size.setValue(s),this.outs.units.setValue(i),t.mainDivisions=s/r,t.subDivisions=10,y.set(0,n.min.y,0),this.tape.ins.startPosition.setValue([-s/2,n.min.y+s/100,-s/2-s/100]),this.tape.ins.endPosition.setValue([-s/2+s/t.mainDivisions,n.min.y+s/100,-s/2-s/100])}this.object3D?this.grid.update(t):this.object3D=new d(t),e.boundingBox.changed&&(this.grid.position.copy(y),this.grid.updateMatrix())}return e.visible.changed&&(this.grid.visible=e.visible.value,this.tape.ins.visible.setValue(this.grid.visible&&e.labelEnabled.value)),e.opacity.changed&&(this.grid.opacity=e.opacity.value),e.labelEnabled.changed&&this.tape.ins.visible.setValue(this.grid.visible&&e.labelEnabled.value),!0}preRender(e){const t=e.viewport,n=this.object3D;if(t!==this._lastViewport){this._lastViewport=t;const i=e.viewport.camera;i?n.matrix.extractRotation(i.matrixWorld).multiply(b):n.matrix.extractRotation(_),n.updateMatrixWorld(!0)}}postRender(e){this.object3D.updateMatrix()}fromData(e){e=e||{},this.ins.copyValues({visible:!!e.visible,color:e.color||[.5,.7,.8]})}toData(){const e=this.ins;return{visible:e.visible.cloneValue(),color:e.color.cloneValue()}}}x.typeName="CVGrid",x.text="Grid",x.icon="",x.gridIns={color:u.V5.ColorRGB("Grid.Color",[.5,.7,.8]),opacity:u.V5.Percent("Grid.Opacity",1),boundingBox:u.V5.Object("Scene.BoundingBox",o.Z),labelEnabled:u.V5.Boolean("Grid.LabelEnabled",!0)},x.gridOuts={size:u.V5.Number("Size"),units:u.V5.Enum("Units",m.f_)}},40490:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r,p:()=>i});var i,s=n(80038);!function(e){e[e.none=0]="none",e[e.menu=1]="menu",e[e.title=2]="title",e[e.logo=4]="logo",e[e.language=8]="language",e[e.tour_exit=16]="tour_exit",e[e.help=32]="help"}(i||(i={}));class r extends s.ZP{constructor(){super(...arguments),this.ins=this.addInputs(r.ins),this.outs=this.addOutputs(r.outs)}update(e){return!0}fromData(e){e=e||{},this.ins.setValues({visible:void 0===e.visible||e.visible,logo:void 0===e.logo||e.logo,menu:void 0===e.menu||e.menu,tools:void 0===e.tools||e.tools})}toData(){const e=this.ins;return{visible:e.visible.value,logo:e.logo.value,menu:e.menu.value,tools:e.tools.value}}isShowing(e){return(e&this.ins.visibleElements.value)===e}}r.typeName="CVInterface",r.ins={visible:s.V5.Boolean("Interface.Visible",!0),logo:s.V5.Boolean("Interface.Logo",!0),menu:s.V5.Boolean("Interface.Menu",!0),tools:s.V5.Boolean("Interface.Tools",!0),visibleElements:s.V5.Number("Interface.VisibleElements",63)},r.outs={documentTitle:s.V5.String("Document.Title")}},93072:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(80038),s=n(1594),r=n(68327),o=n(82507);class a extends i.ZP{constructor(){super(...arguments),this._activeLanguages={},this._translations={},this.ins=this.addInputs(a.ins),this.outs=this.addOutputs(a.outs),this.updateLanguage=e=>{const{ins:t,outs:n}=this;t.language.value===e&&(n.language.setValue(e),this.emit({type:"tag-update"}))}}get assetReader(){return this.getMainComponent(r.Z)}get activeLanguages(){return Object.values(this._activeLanguages)}nameString(){return s.oS[s.PD[this.ins.language.value]]}codeString(){return s.PD[this.ins.language.value]}create(){super.create()}update(){const{ins:e,outs:t}=this;if(0==this.activeLanguages.length&&e.language.value==t.language.value&&this.addLanguage(t.language.value),e.language.changed&&e.language.value!=t.language.value){const t=e.language.value;this.addLanguage(t),this.assetReader.getSystemJSON("language/string.resources."+s.PD[this.ins.language.value].toLowerCase()+".json").then((e=>{this._translations=e,this.updateLanguage(t)}))}return!0}fromData(e){var t;const{ins:n,outs:i}=this;e=e||{};const r=null!==(t=s.PD[e.language||"EN"])&&void 0!==t?t:s.PD[s.k$];n.language.value<0&&n.language.setValue(r)}toData(){const e=this.ins;return{language:s.PD[e.language.getValidatedValue()]}}addLanguage(e){var t,n,i;null!==(t=(n=this._activeLanguages)[i=s.PD[e]])&&void 0!==t||(n[i]={id:e,name:s.oS[s.PD[e]]})}getLocalizedString(e){const t=this._translations;return void 0===t?e:t[e]||e}}a.typeName="CVLanguageManager",a.text="Language",a.icon="",a.isSystemSingleton=!0,a.ins={enabled:i.V5.Boolean("Language.Enabled",!1),language:i.V5.Enum("Interface.Language",s.PD,{preset:s.PD[s.k$],enum:s.PD,options:(0,o.q)(s.oS).map((e=>s.oS[e]))})},a.outs={language:i.V5.Enum("Interface.Language",s.PD,s.PD.EN)}},84678:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var i=n(82942);class s extends i.Z{constructor(e){super(),this.addEvent("update"),this._list=e||[],this._dict={},e&&e.forEach((e=>{e.id&&(this._dict[e.id]=e)}))}get length(){return this._list.length}get ids(){return Object.keys(this._dict)}get items(){return this._list}set items(e){this._list=e,this._dict={},e.forEach((e=>{e.id&&(this._dict[e.id]=e)})),this.emit({type:"update",item:null,what:"update"})}append(e){this._list.push(e),e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"add"})}insertBefore(e,t){const n=this._list.indexOf(t);n>=0&&this.insertAt(e,n)}insertAt(e,t){this._list.splice(t,0,e),e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"add"})}replaceItem(e,t){const n=this._list.indexOf(t);n>=0&&this.replaceAt(e,n)}replaceAt(e,t){const n=this._list[t];n.id&&delete this._dict[n.id],this._list[t]=e,e.id&&(this._dict[e.id]=e),this.emit({type:"update",item:e,what:"replace"})}moveItem(e,t){const n=this._list.indexOf(e);this.moveAt(n,t)}moveAt(e,t){const n=this._list;if(e+t<0||e+t>=n.length)return;const i=n[e];if(t>0){for(let i=0;it;--i)n[e+i]=n[e+i-1];n[e+t]=i}this.emit({type:"update",item:i,what:"move"})}removeById(e){const t=this._dict[e];return t&&this.removeItem(t),t}removeItem(e){const t=this._list.indexOf(e);return this.removeAt(t),t}removeAt(e){const t=this._list;if(e<0||e>=t.length)return;const n=t[e];return t.splice(e,1),n.id&&delete this._dict[n.id],this.emit({type:"update",item:n,what:"remove"}),n}getAt(e){return this._list[e]}getById(e){return this._dict[e]}getIndexOf(e){return this._list.indexOf(e)}copy(e){this.items=e.slice()}clone(){return this._list.slice()}}s.prototype[Symbol.iterator]=function(){return{index:0,list:this._list,next:function(){return this.index{e.id&&(this._dict[e.id]=e)}))}get length(){return this.ids.length}get items(){return this.ids.map((e=>this._dict[e]))}set items(e){e.forEach((e=>{e.id&&(this._dict[e.id]=e)})),this.emit({type:"update",item:null,what:"update"})}get ids(){return Object.keys(this._dict)}get dictionary(){return this._dict}set dictionary(e){this._dict=e,this.emit({type:"update",item:null,what:"update"})}insert(e,t){if(!(t=t||e.id))throw new Error("can't insert, missing id");this._dict[t]=e,this.emit({type:"update",item:e,what:"insert"})}remove(e){const t="string"==typeof e?e:e.id,n=this._dict[t];void 0!==n&&(delete this._dict[t],this.emit({type:"update",item:n,what:"remove"}))}get(e){return this._dict[e]}getOrCreate(e,t){let n=this._dict[e];return n||(n=this._dict[e]=t,this.emit({type:"update",item:n,what:"insert"})),n}copy(e){this.dictionary=Object.assign({},e)}clone(){return Object.assign({},this._dict)}}var o=n(80038),a=n(38112),l=n(1594),c=n(93072);class h extends o.ZP{constructor(){super(...arguments),this.collection=new r,this.process=new r,this.images=new r,this.articles=new s,this.leadArticle=null,this.notes=[],this.audio=new r}get language(){return this.getGraphComponent(c.Z,!0)}fromDocument(e,t){if(!isFinite(t.meta))throw new Error("info property missing in node");const n=e.metas[t.meta];if(n.collection&&(this.collection.dictionary=n.collection,this.collection.get("titles")&&Object.keys(this.collection.get("titles")).forEach((e=>{this.language.addLanguage(l.PD[e])}))),n.process&&(this.process.dictionary=n.process),n.images){const e={};n.images.forEach((t=>e[t.quality]=t)),this.images.dictionary=e}if(n.articles&&(this.articles.items=n.articles.map((e=>a.Z.fromJSON(e))),void 0!==n.leadArticle&&(this.leadArticle=this.articles.getAt(n.leadArticle)),this.articles.items.forEach((e=>{Object.keys(e.data.titles).forEach((e=>{this.language.addLanguage(l.PD[e])}))}))),n.audio){const e={};n.audio.forEach((t=>{t.captionUris=t.captionUris||{},t.durations={},e[t.id]=t})),this.audio.dictionary=e}return this.emit("load"),t.meta}toDocument(e,t){let n=null;if(this.collection.length>0&&(n={collection:this.collection.dictionary}),this.process.length>0&&(n=n||{},n.process=this.process.dictionary),this.images.length>0&&(n=n||{},n.images=this.images.items),this.articles.length>0){n=n||{};const e=this.articles.items;n.articles=e.map((e=>e.toJSON())),this.leadArticle&&(n.leadArticle=e.indexOf(this.leadArticle))}if(this.audio.length>0&&(n=n||{},n.audio=this.audio.items,n.audio.forEach((e=>{e.durations={}}))),n){e.metas=e.metas||[];const t=e.metas.length;return e.metas.push(n),t}}}h.typeName="CVMeta",h.text="Meta",h.icon="document"},3388:(e,t,n)=>{"use strict";n.d(t,{Z:()=>V});var i=n(19588),s=n(78943),r=n(37840),o=n(82587),a=n(29187),l=n(75544),c=n(28092),h=n(64026),d=n(35322),u=n(75809);class p extends c.e{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new u.u;i.setIndex(new d.Tl(n,1)),i.setAttribute("position",new d.a$([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new h.n({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}var m=n(10564),f=n(80038),g=n(2837),v=n(79961),y=n(43875),b=n(15577),_=n(10290),x=n(37117),w=n(38642);const S=[],M=[x.$l.Thumb,x.$l.AR,x.$l.Low,x.$l.Medium,x.$l.High,x.$l.Highest];class E{constructor(){this.derivatives={}}select(e,t){const n=x._U[e],i=x.$l[t],s=M.indexOf(t);if(s<0)return console.warn(`derivative quality not supported: '${i}'`),null;const r=this.get(e,t);if(r)return r;for(let t=s+1;t=0;--t){const n=this.get(e,M[t]);if(n)return console.warn(`derivative quality '${i}' not available, using lower quality`),n}return console.warn(`no suitable derivative found for quality '${i}' and usage '${n}'`),null}getByUsage(e){const t=x._U[e];return(this.derivatives[t]||S).sort(((e,t)=>e.data.qualityt.data.quality?1:0))}getByQuality(e){return this.getArray().filter((t=>t.data.quality===e))}getArray(){return Object.keys(this.derivatives).reduce(((e,t)=>e.concat(this.derivatives[t])),[])}get(e,t){const n=x._U[e],i=this.derivatives[n];if(i)for(let e=0,n=i.length;e-1&&t.splice(i,1)}}createModelAsset(e,t){t="string"==typeof t?x.$l[t]:t,t=isFinite(t)?t:x.$l.Medium;const n=this.getOrCreate(x._U.Web3D,t),i=new w.ZP;return i.setModel(e),n.addAsset(i),n}createMeshAsset(e,t,n,i,s){s="string"==typeof s?x.$l[s]:s,s=isFinite(s)?s:x.$l.Medium;const r=this.getOrCreate(x._U.Web3D,s),o=new w.ZP;if(o.setGeometry(e),r.addAsset(o),t){const e=new w.ZP;e.setTexture(t,w.xd.Color),r.addAsset(e)}if(n){const e=new w.ZP;e.setTexture(n,w.xd.Occlusion),r.addAsset(e)}if(i){const e=new w.ZP;e.setTexture(i,w.xd.Normal),r.addAsset(e)}return r}clear(){for(let e in this.derivatives)this.derivatives[e].forEach((e=>e.dispose()));this.derivatives={}}toJSON(){const e=[];for(let t in this.derivatives)this.derivatives[t].forEach((t=>e.push(t.toJSON())));return e}fromJSON(e){this.clear(),e.forEach((e=>{this.getOrCreateBin(x._U[e.usage]).push(new x.ZP(e))}))}toString(e=!1){const t=this.derivatives,n=Object.keys(t);return e?`Derivatives (${n.length}) \n `+n.map((e=>t[e].map((e=>e.toString(!0))).join("\n "))).join("\n "):`Derivatives (${n.length}) `+n.map((e=>`${e} (${t[e].length})`)).join(", ")}getOrCreateBin(e){const t=x._U[e];return this.derivatives[t]||(this.derivatives[t]=[])}}var T=n(51462),C=n(63872),A=n(68327),P=n(15271),R=n(24856),L=n(79815);const N=new i.P,D=new i.P,I=new s._,O=new s._,U=new r.Z,k=new o.y;class V extends g.ZP{constructor(e,t){super(e,t),this.ins=this.addInputs(V.ins),this.outs=this.addOutputs(V.outs),this._derivatives=new E,this._activeDerivative=null,this._visible=!0,this._boxFrame=null,this._localBoundingBox=new r.Z,this._prevPosition=new i.P(0,0,0),this._prevRotation=new i.P(0,0,0),this._materialCache={},this.object3D=new a.Z}get settingProperties(){return[this.ins.name,this.ins.visible,this.ins.quality,this.ins.localUnits,this.ins.tags,this.ins.renderOrder,this.ins.shadowSide,this.ins.shader,this.ins.overlayMap,this.ins.slicerEnabled,this.ins.override,this.ins.color,this.ins.opacity,this.ins.hiddenOpacity,this.ins.roughness,this.ins.metalness,this.ins.occlusion,this.ins.doubleSided]}get snapshotProperties(){return[this.ins.visible,this.ins.quality,this.ins.overlayMap,this.ins.override,this.ins.opacity,this.ins.roughness,this.ins.metalness,this.ins.color,this.ins.slicerEnabled]}get derivatives(){return this._derivatives}get activeDerivative(){return this._activeDerivative}get localBoundingBox(){return this._localBoundingBox}get assetManager(){return this.getMainComponent(C.Z)}get assetReader(){return this.getMainComponent(A.Z)}get renderer(){return this.getMainComponent(P.Z)}create(){super.create();this.node.createComponent(T.Z).ins.unitScale.linkFrom(this.outs.unitScale);const e=this.renderer.outs.maxTextureSize.value;e<2048?this.ins.quality.setValue(y.$l.Low):e<4096?this.ins.quality.setValue(y.$l.Medium):this.ins.quality.setValue(y.$l.High)}update(){const e=this.ins;if(e.name.changed&&(this.node.name=e.name.value),e.tags.changed||e.activeTags.changed||e.visible.changed){let t=e.visible.value;if(t){const n=e.tags.value.split(",").map((e=>e.trim())).filter((e=>e)),i=e.activeTags.value.split(",").map((e=>e.trim())).filter((e=>e));t=!n.length,i.forEach((e=>{n.indexOf(e)>=0&&(t=!0)}))}const n=this.ins.override.value;this._visible=t,t?(this.object3D.visible=!0,n&&this.updateMaterial()):e.visible.value&&n&&this.ins.hiddenOpacity.value>0?(this.object3D.visible=!0,this.updateMaterial()):this.object3D.visible=!1}if(e.tags.changed&&this.emit({type:"tag-update"}),!this.activeDerivative&&e.autoLoad.changed&&e.autoLoad.value)this.autoLoad(e.quality.value);else if(e.quality.changed){const t=this.derivatives.select(y._U.Web3D,e.quality.value);t&&t!==this.activeDerivative&&this.loadDerivative(t).catch((e=>{console.warn("Model.update - failed to load derivative"),console.warn(e)}))}return e.renderOrder.changed&&this.updateRenderOrder(this.object3D,e.renderOrder.value),(e.localUnits.changed||e.globalUnits.changed)&&this.updateUnitScale(),e.shader.changed&&this.updateShader(),e.overlayMap.changed&&this.updateOverlayMap(),e.shadowSide.changed&&this.updateShadowSide(),e.override.value&&e.shader.value===_.p.Default&&(e.override.changed||e.color.changed||e.opacity.changed||e.doubleSided.changed||e.roughness.changed||e.metalness.changed||e.occlusion.changed)?this.updateMaterial():e.override.changed&&!e.override.value&&e.shader.value===_.p.Default&&this.object3D.traverse((e=>{const t=e.material;if(t&&t.isUberPBRMaterial){const e=this._materialCache[t.uuid];t.aoMapMix.setScalar(e.occlusion),t.color.fromArray(e.color),t.opacity=e.opacity,t.transparent=e.transparent,t.roughness=e.roughness,t.metalness=e.metalness,t.side=e.doubleSided?l.ehD:l.Wl3,t.needsUpdate=!0}})),e.center.changed&&this.center(),(e.position.changed||e.rotation.changed)&&this.updateMatrixFromProps(),e.dumpDerivatives.changed&&console.log(this.derivatives.toString(!0)),!0}dispose(){this.derivatives.clear(),this._activeDerivative=null,super.dispose()}center(){const e=this.object3D,t=this.ins.position;e.matrix.decompose(N,I,D),e.matrix.makeRotationFromQuaternion(I),U.makeEmpty(),v.sN(e,U,e.parent),U.getCenter(N),N.multiplyScalar(-1).toArray(t.value),t.set()}setFromMatrix(e){const t=this.ins;e.decompose(N,I,D),N.multiplyScalar(1/this.outs.unitScale.value).toArray(t.position.value),t.position.set(),v.MO(I,V.rotationOrder,t.rotation.value),t.rotation.set()}fromDocument(e,t){const{ins:n,outs:i}=this;if(!isFinite(t.model))throw new Error("model property missing in node");const s=e.models[t.model];n.name.setValue(t.name);const r=y.f_[s.units||"cm"];n.localUnits.setValue(isFinite(r)?r:y.f_.cm),n.visible.setValue(void 0===s.visible||s.visible),n.tags.setValue(s.tags||""),n.renderOrder.setValue(void 0!==s.renderOrder?s.renderOrder:0);const o=y.id[s.shadowSide||"Back"];if(n.shadowSide.setValue(isFinite(o)?o:y.id.Back),n.position.reset(),n.rotation.reset(),s.translation&&(n.position.copyValue(s.translation),this._prevPosition.fromArray(s.translation)),s.rotation&&(I.fromArray(s.rotation),v.MO(I,V.rotationOrder,n.rotation.value),this._prevRotation.fromArray(n.rotation.value),n.rotation.set()),s.boundingBox){const e=this._localBoundingBox;e.min.fromArray(s.boundingBox.min),e.max.fromArray(s.boundingBox.max),this._boxFrame=new p(e,"#009cde"),this.addObject3D(this._boxFrame),this._boxFrame.updateMatrixWorld(!0);const t=this.getGraphComponent(L.Z,!0);t&&t.navigation.ins.autoZoom.value&&t.navigation.ins.zoomExtents.set(),i.updated.set(),this.updateUnitScale()}if(s.derivatives&&this.derivatives.fromJSON(s.derivatives),s.material){const e=s.material;n.copyValues({override:!0,color:e.color||n.color.schema.preset,opacity:void 0!==e.opacity?e.opacity:n.opacity.schema.preset,hiddenOpacity:void 0!==e.hiddenOpacity?e.hiddenOpacity:n.hiddenOpacity.schema.preset,roughness:void 0!==e.roughness?e.roughness:n.roughness.schema.preset,metalness:void 0!==e.metalness?e.metalness:n.metalness.schema.preset,occlusion:void 0!==e.occlusion?e.occlusion:n.occlusion.schema.preset,doubleSided:void 0!==e.doubleSided?e.doubleSided:n.doubleSided.schema.preset})}return s.overlayMap&&n.overlayMap.setValue(s.overlayMap),s.annotations&&this.getComponent(T.Z).fromData(s.annotations),this.emit({type:"tag-update"}),this.ins.autoLoad.set(),t.model}toDocument(e,t){const n={units:y.f_[this.ins.localUnits.getValidatedValue()]},i=this.ins;i.visible.value||(n.visible=!1),i.tags.value&&(n.tags=i.tags.value),0!==i.renderOrder.value&&(n.renderOrder=i.renderOrder.value),i.shadowSide.value!=y.id.Back&&(n.shadowSide=y.id[this.ins.shadowSide.getValidatedValue()]);const s=i.position.value;0===s[0]&&0===s[1]&&0===s[2]||(n.translation=i.position.value);const r=i.rotation.value;0===r[0]&&0===r[1]&&0===r[2]||(v.jU(r,V.rotationOrder,I),n.rotation=I.toArray()),i.override.value&&(n.material={color:i.color.value,opacity:i.opacity.value,hiddenOpacity:i.hiddenOpacity.value,roughness:i.roughness.value,metalness:i.metalness.value,occlusion:i.occlusion.value,doubleSided:i.doubleSided.value}),0!==i.overlayMap.value&&(n.overlayMap=i.overlayMap.value),n.boundingBox={min:this._localBoundingBox.min.toArray(),max:this._localBoundingBox.max.toArray()},n.derivatives=this.derivatives.toJSON();const o=this.getComponent(T.Z).toData();o&&o.length>0&&(n.annotations=o),e.models=e.models||[];const a=e.models.length;return e.models.push(n),a}updateShader(){const e=this.ins.shader.getValidatedValue();this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&n.setShaderMode(e)}))}updateShadowSide(){this.object3D.traverse((e=>{const t=e.material;t&&t.isUberPBRMaterial&&(this.ins.shadowSide.value==y.id.Front?t.shadowSide=l.Wl3:t.shadowSide=l._Li,t.needsUpdate=!0)}))}updateOverlayMap(){const e=this.getGraphComponent(L.Z,!0);if(e&&e.snapshots.outs.tweening.value)return void e.snapshots.outs.end.once("value",(()=>{this.ins.overlayMap.set(),this.update()}));const t=this.ins.overlayMap.getOptionText();"None"!==t?this.assetReader.getTexture(t).then((e=>{this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(e.flipY=!1,n.zoneMap=e,n.enableZoneMap(!0))}))})):this.object3D.traverse((e=>{const t=e.material;t&&t.isUberPBRMaterial&&(t.enableZoneMap(!1),t.zoneMap=null)}))}updateMaterial(){const e=this.ins;this.object3D.traverse((t=>{const n=t.material;n&&n.isUberPBRMaterial&&(n.aoMapMix.setScalar(e.occlusion.value),n.color.fromArray(e.color.value),n.opacity=this._visible?e.opacity.value:e.hiddenOpacity.value,n.transparent=n.opacity<1||this._materialCache[n.uuid].transparent,n.roughness=e.roughness.value,n.metalness=e.metalness.value,n.side=e.doubleSided.value?l.ehD:l.Wl3,n.needsUpdate=!0)}))}updateUnitScale(){const e=this.ins.localUnits.getValidatedValue(),t=this.ins.globalUnits.getValidatedValue();this.outs.unitScale.setValue((0,b.Z)(e,t)),this.updateMatrixFromProps()}updateMatrixFromProps(){const e=this.ins,t=this.outs.unitScale.value,n=this.object3D;N.fromArray(e.position.value).multiplyScalar(t),v.jU(e.rotation.value,V.rotationOrder,I),D.setScalar(t),n.matrix.compose(N,I,D),n.matrixWorldNeedsUpdate=!0,v.jU([this._prevRotation.x,this._prevRotation.y,this._prevRotation.z],V.rotationOrder,O),O.invert(),D.setScalar(1),k.compose(N.fromArray(e.position.value),I,D);const i=this.getComponent(T.Z);i.getAnnotations().forEach((e=>{N.fromArray(e.data.position),N.sub(this._prevPosition),N.applyQuaternion(O),N.applyMatrix4(k),e.data.position=N.toArray(),N.fromArray(e.data.direction),N.applyQuaternion(O),N.applyQuaternion(I),e.data.direction=N.toArray(),e.update(),i.updateAnnotation(e,!0)})),this._prevPosition.copy(N.fromArray(e.position.value)),this._prevRotation.copy(N.fromArray(e.rotation.value)),this.outs.updated.set()}updateRenderOrder(e,t){e.renderOrder=t,e.children.forEach((e=>this.updateRenderOrder(e,t)))}autoLoad(e){const t=[],n=this.derivatives.select(y._U.Web3D,y.$l.Thumb);n&&t.push(n);const i=this.derivatives.select(y._U.Web3D,e);return i&&i!==n&&t.push(i),0===t.length?(m.ZP.show(`No 3D derivatives available for '${this.displayName}'.`),Promise.resolve()):t.reduce(((e,t)=>e.then((()=>{this.loadDerivative(t)}))),Promise.resolve())}loadDerivative(e){if(this.node&&this.assetReader)return e.load(this.assetReader).then((()=>{if(!e.model||!this.node||this._activeDerivative&&e.data.quality!=this.ins.quality.value)return void e.unload();this.assetManager.initialLoad||this._activeDerivative||(this.assetManager.initialLoad=!0),this._activeDerivative&&(this.removeObject3D(this._activeDerivative.model),this._activeDerivative.unload()),this._activeDerivative=e,this.addObject3D(e.model),this.renderer.activeSceneComponent.scene.updateMatrixWorld(!0),this._boxFrame&&(this.removeObject3D(this._boxFrame),this._boxFrame.geometry.dispose(),this._boxFrame=null),this._localBoundingBox.makeEmpty(),v.sN(e.model,this._localBoundingBox),this.outs.updated.set(),this.outs.quality.setValue(e.data.quality),this.object3D.traverse((e=>{const t=e.material;t&&t.isUberPBRMaterial&&(this._materialCache[t.uuid]={color:t.color.toArray(),opacity:t.opacity,hiddenOpacity:this.ins.hiddenOpacity.schema.preset,roughness:t.roughness,metalness:t.metalness,occlusion:t.aoMapMix.x,doubleSided:t.side==l.ehD,transparent:t.transparent})})),this.ins.override.value&&this.updateMaterial(),this.ins.shadowSide.value!=y.id.Back&&this.updateShadowSide(),this.getGraphComponent(R.Z).ins.dirty.set(),0!==this.ins.renderOrder.value&&this.updateRenderOrder(this.object3D,this.ins.renderOrder.value);const t=["None"];t.push(...e.findAssets(y.hH.Image).filter((e=>e.data.mapType===y.xd.Zone)).map((e=>e.data.uri))),this.ins.overlayMap.setOptions(t),0!==this.ins.overlayMap.value&&this.ins.overlayMap.set(),this.emit({type:"model-load",quality:e.data.quality})})).catch((e=>m.ZP.show(`Failed to load model derivative: ${e.message}`)));console.warn("Model load interrupted.")}addObject3D(e){this.object3D.add(e),this.object3D.traverse((e=>{"Mesh"===e.type&&this.registerPickableObject3D(e,!0)}))}}V.typeName="CVModel2",V.text="Model",V.icon="cube",V.rotationOrder="ZYX",V.ins={name:f.V5.String("Model.Name"),globalUnits:f.V5.Enum("Model.GlobalUnits",y.f_,y.f_.cm),localUnits:f.V5.Enum("Model.LocalUnits",y.f_,y.f_.cm),quality:f.V5.Enum("Model.Quality",y.$l,y.$l.High),tags:f.V5.String("Model.Tags"),renderOrder:f.V5.Number("Model.RenderOrder",0),shadowSide:f.V5.Enum("Model.ShadowSide",y.id,y.id.Back),activeTags:f.V5.String("Model.ActiveTags"),autoLoad:f.V5.Boolean("Model.AutoLoad",!0),position:f.V5.Vector3("Model.Position"),rotation:f.V5.Vector3("Model.Rotation"),center:f.V5.Event("Model.Center"),shader:f.V5.Enum("Material.Shader",_.p,_.p.Default),overlayMap:f.V5.Option("Material.OverlayMap",["None"],0),slicerEnabled:f.V5.Boolean("Material.SlicerEnabled",!0),override:f.V5.Boolean("Material.Override",!1),color:f.V5.ColorRGB("Material.BaseColor"),opacity:f.V5.Percent("Material.Opacity",1),hiddenOpacity:f.V5.Percent("Material.HiddenOpacity",0),roughness:f.V5.Percent("Material.Roughness",.8),metalness:f.V5.Percent("Material.Metalness",.1),occlusion:f.V5.Percent("Material.Occlusion",.25),doubleSided:f.V5.Boolean("Material.DoubleSided",!1),dumpDerivatives:f.V5.Event("Derivatives.Dump")},V.outs={unitScale:f.V5.Number("UnitScale",{preset:1,precision:5}),quality:f.V5.Enum("LoadedQuality",y.$l),updated:f.V5.Event("Updated")}},13227:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var i=n(19588),s=n(82587),r=n(78943),o=n(82954),a=n(71050),l=n(92642);const c=new i.P,h=new i.P,d=new s.y,u=new r._,p=new o.U;class m extends l.ZP{get settingProperties(){return[this.ins.position,this.ins.rotation,this.ins.scale]}get snapshotProperties(){return[this.ins.position,this.ins.rotation,this.ins.scale]}fromData(e){const{position:t,rotation:n,order:i,scale:s}=this.ins,r=l.VZ[i.getValidatedValue()];e.matrix?(d.fromArray(e.matrix),d.decompose(c,u,h),c.toArray(t.value),p.setFromQuaternion(u,r),c.setFromEuler(p).multiplyScalar(a.M8.RAD2DEG).toArray(n.value),h.toArray(s.value),t.set(),n.set(),s.set()):(e.translation&&t.setValue(e.translation.slice()),e.rotation&&(u.fromArray(e.rotation),p.setFromQuaternion(u,r),c.setFromEuler(p).multiplyScalar(a.M8.RAD2DEG).toArray(n.value),n.set()),e.scale&&s.setValue(e.scale.slice()),this.transform.changed=!0)}toData(){this.object3D.matrix.decompose(c,u,h);const e={};return 0===c.x&&0===c.y&&0===c.z||(e.translation=c.toArray()),0===u.x&&0===u.y&&0===u.z&&1===u.w||(e.rotation=u.toArray()),1===h.x&&1===h.y&&1===h.z||(e.scale=h.toArray()),e}}m.typeName="CVNode",m.text="Transform",m.icon=""},27924:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(31491),s=n(80038),r=n(25864);class o extends s.ZP{constructor(){super(...arguments),this.activeDocument=null}get documentProvider(){return this.getGraphComponent(r.Z)}startObserving(){const e=this.documentProvider;e.on("active-component",this.onActiveDocumentEvent,this),e.activeComponent&&(this.activeDocument=e.activeComponent,this.onActiveDocument(null,e.activeComponent))}stopObserving(){const e=this.documentProvider;e.off("active-component",this.onActiveDocumentEvent,this),e.activeComponent&&(this.activeDocument=null,this.onActiveDocument(e.activeComponent,null))}onActiveDocument(e,t){}onActiveDocumentEvent(e){this.activeDocument=e.next,this.onActiveDocument(e.previous,e.next)}}o.typeName="CVDocumentObserver";class a extends o{constructor(){super(...arguments),this.activeNode=null}get nodeProvider(){return this.getGraphComponent(i.Z)}startObserving(){super.startObserving();const e=this.nodeProvider;e.on("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=e.activeNode,this.onActiveNode(null,e.activeNode))}stopObserving(){const e=this.nodeProvider;e.off("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=null,this.onActiveNode(e.activeNode,null)),super.stopObserving()}onActiveNode(e,t){}onActiveNodeEvent(e){this.activeNode=e.next,this.onActiveNode(e.previous,e.next)}}a.typeName="CVNodeObserver"},31491:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(80038),s=n(92989),r=n(75222),o=n(25864);class a extends s.Z{constructor(e,t){super(e,t),this.outs=this.addOutputs(a.outs),this.scope=s.F.Graph}get documentProvider(){return this.getComponent(o.Z)}create(){super.create(),this.documentProvider.on("active-component",this.onActiveDocument,this)}dispose(){this.documentProvider.off("active-component",this.onActiveDocument,this),super.dispose()}onActiveDocument(e){this.scopedGraph=e.next}onActiveNode(e,t){this.outs.activeNode.setValue(t);const n=this.selection;t?n.nodeContainsSelectedComponent(t)||n.selectNode(t):e&&n.clearSelection()}onScopedNodes(){this.outs.changedNodes.set()}}a.typeName="CVNodeProvider",a.nodeType=r.Z,a.followComponentSelection=!0,a.outs={activeNode:i.V5.Object("Nodes.Active",r.Z),changedNodes:i.V5.Event("Nodes.Changed")}},44661:(e,t,n)=>{"use strict";n.d(t,{LY:()=>i,ZP:()=>m,dT:()=>s});var i,s,r=n(2837),o=n(28097),a=n(92642),l=n(26775),c=n(26629),h=n(63872),d=n(30242);!function(e){e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Top=2]="Top",e[e.Bottom=3]="Bottom",e[e.Front=4]="Front",e[e.Back=5]="Back",e[e.None=6]="None"}(i||(i={})),function(e){e[e.Orbit=0]="Orbit",e[e.Zoom=1]="Zoom",e[e.Pan=2]="Pan"}(s||(s={}));const u=[];u[i.Left]=[0,-90,0],u[i.Right]=[0,90,0],u[i.Front]=[0,0,0],u[i.Back]=[0,180,0],u[i.Top]=[-90,0,0],u[i.Bottom]=[90,0,0];const p=function(e,t){for(let n=0,i=e.length;ne.outs.updated.changed))&&e.update(null),this._modelBoundingBox=e.outs.boundingBox.value,(!this._isAutoZooming||this.ins.autoZoom.value&&!this._modelBoundingBox.isEmpty())&&(t.camera&&(n.camera.aspect=t.camera.aspect),t.camera=n.camera,t.zoomExtents(this._modelBoundingBox),n.ins.zoom.set(),this._hasZoomed=!0),this._isAutoZooming=!1}return e.autoRotation.changed&&(this._autoRotationStartTime=e.autoRotation.value?performance.now():null),e.promptActive.changed&&!this._autoRotationStartTime&&(this._initYOrbit=t.orbit.y,this._autoRotationStartTime=e.promptActive.value?performance.now():null),!0}tick(){const e=this.ins,t=this._scene.activeCameraComponent;if(!e.enabled.value||!t)return;const n=this._controller;n.camera=t.camera;const s=t.transform,r=this.changed||e.autoRotation.value||e.promptActive.value;if((e.autoRotation.value||e.promptActive.value)&&this._autoRotationStartTime){const t=performance.now(),i=.001*(t-this._autoRotationStartTime);if(e.autoRotation.value)n.orbit.y=(n.orbit.y+e.autoRotationSpeed.value*i)%360,this._autoRotationStartTime=t;else{const e=this.arManager.shadowRoot.getElementById("prompt");if(e){const t=2,s=1.5,r=2*s,o=.2*s;let a=i%(r+t);a>r&&a{"use strict";n.d(t,{ZP:()=>d});var i=n(80038),s=n(60206),r=n(38112),o=n(84678),a=n(63872),l=n(68327),c=n(11359),h=n(93072);class d extends i.ZP{constructor(){super(...arguments),this.ins=this.addInputs(d.ins),this.outs=this.addOutputs(d.outs)}get settingProperties(){return[this.ins.enabled,this.ins.position]}get snapshotProperties(){return[this.ins.enabled,this.ins.position,this.ins.articleId]}get articles(){return Object.keys(this._articles).map((e=>this._articles[e]))}get activeArticle(){return this.outs.article.value}get assetManager(){return this.getMainComponent(a.Z)}get assetReader(){return this.getMainComponent(l.Z)}get analytics(){return this.getMainComponent(c.Z)}get language(){return this.getGraphComponent(h.Z)}create(){super.create(),this.getGraphComponents(o.Z).forEach((e=>e.on("update",this.updateArticles,this))),this.graph.components.on(o.Z,this.onMetaComponent,this),this.graph.components.on(h.Z,this.onLanguageComponent,this),this.updateArticles()}dispose(){this.graph.components.off(h.Z,this.onLanguageComponent,this),this.graph.components.off(o.Z,this.onMetaComponent,this),this.getGraphComponents(o.Z).forEach((e=>e.off("update",this.updateArticles,this))),super.dispose()}update(e){const t=this.ins,n=this.outs;if(t.enabled.changed,t.articleId.changed){const e=this._articles[t.articleId.value]||null,i=e&&e.article;n.article.setValue(i),n.content.setValue(""),i&&(this.readArticle(i),this.analytics.sendProperty("Reader_ArticleId",i.defaultTitle))}return t.refresh.changed&&this.refreshArticle(),!0}readArticle(e){const t=this.outs,n=e.uri;if(n)return this.assetReader.getText(n).then((e=>this.parseArticle(e,n))).then((e=>t.content.setValue(e))).catch((e=>t.content.setValue(`

Article not found at ${n}

`)));t.content.setValue("

Can't display article: no URI.

")}parseArticle(e,t){e=e.replace(/[\n\r]/g,"");const n=this.assetManager.getAssetBasePath(t);return e=e.replace(/(src=\")(.*?)(\")/g,((e,t,i,s)=>(i.startsWith("/")||i.startsWith("http")||(i=this.assetManager.getAssetUrl(n+i)),t+i+s))),Promise.resolve(e)}onMetaComponent(e){e.add&&e.object.articles.on("update",this.updateArticles,this),e.remove&&e.object.articles.off("update",this.updateArticles,this),this.updateArticles()}onLanguageComponent(e){e.add&&e.object.outs.language.on("value",this.updateLanguage,this),e.remove&&e.object.outs.language.off("value",this.updateLanguage,this)}refreshArticle(){const e=this._articles[this.ins.articleId.value]||null,t=e&&e.article;t&&this.readArticle(t)}updateArticles(){const e=this.getGraphComponents(o.Z),t=this._articles={};e.forEach((e=>{const n=e.articles,i=e.node;n.items.forEach((e=>{t[e.id]={article:e,node:i}}))}))}updateLanguage(){this.ins;this.articles.forEach((e=>{e.article.language=this.language.outs.language.value})),this.ins.refresh.set()}fromData(e){e=e||{},this.ins.setValues({enabled:!!e.enabled,position:s.we[e.position]||s.we.Overlay})}toData(){const e=this.ins;return{enabled:e.enabled.value,position:s.we[e.position.value]||"Overlay"}}}d.typeName="CVReader",d.text="Reader",d.icon="",d.ins={enabled:i.V5.Boolean("Reader.Enabled"),visible:i.V5.Boolean("Reader.Visible",!0),closed:i.V5.Event("Reader.Closed"),refresh:i.V5.Event("Reader.Refresh"),position:i.V5.Enum("Reader.Position",s.we),articleId:i.V5.String("Article.ID"),focus:i.V5.Boolean("Reader.Focus")},d.outs={article:i.V5.Object("Article.Active",r.Z),content:i.V5.String("Article.Content"),count:i.V5.Integer("Article.Count")}},26629:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var i=n(19588),s=n(37840),r=n(80038),o=n(1594),a=n(13227),l=n(3388),c=n(15577),h=n(92642),d=n(27884),u=n(79815),p=n(15271),m=n(41282),f=n(76288);const g=new i.P,v=new i.P;class y extends a.Z{constructor(){super(...arguments),this.ins=this.addInputs(y.ins),this.outs=this.addOutputs(y.outs),this.updateCameraHelper=()=>{const e=this.setup.navigation.ins.offset.value,t=g.set(e[0],e[1],e[2]).length();if(!this.system.getComponent("CVStoryApplication",!0)){const e=2.5*Math.max(t,this.outs.boundingRadius.value),n=this.setup.navigation.ins.maxOffset.value;this.setup.navigation.ins.maxOffset.setValue([n[0],n[1],e])}this.cameras.forEach((e=>{if(e.addIns.autoNearFar.value){const n=4*Math.max(t,this.outs.boundingRadius.value),i=Math.min(n/1e3,this.outs.boundingRadius.value/100);(n{e.ins.globalUnits.linkFrom(this.ins.units),this.ins.modelUpdated.linkFrom(e.outs.updated)}))}update(e){const t=this.ins,n=this.outs;return t.units.changed&&(this.updateTransformHierarchy(),this.updateModelBoundingBox(),this.updateLights(),this.updateCameras(),n.units.setValue(t.units.value)),t.modelUpdated.changed&&(this.updateModelBoundingBox(),this.updateLights(),this.updateCameras()),t.sceneTransformed.changed&&this.updateModelBoundingBox(),!0}dispose(){this.graph.components.off(l.Z,this.onModelComponent,this),super.dispose()}fromDocument(e,t){this.ins.units.setValue(o.f_[t.units]||0),this.outs.units.setValue(o.f_[t.units]||0)}toDocument(e,t){t.units=o.f_[this.ins.units.getValidatedValue()]}onModelComponent(e){const t=e.object;e.add&&(t.ins.globalUnits.linkFrom(this.ins.units),this.ins.modelUpdated.linkFrom(t.outs.updated))}updateModelBoundingBox(){const e=this.outs.boundingBox.value;e.makeEmpty(),this.models.forEach((t=>{t.object3D.visible&&e.expandByObject(t.object3D)})),e.getSize(g),g.length()>0?(this.outs.boundingBox.set(),this.outs.boundingRadius.setValue(.5*g.length())):this.outs.boundingRadius.setValue(10)}updateTransformHierarchy(){if(0===this.models.length)return;const{ins:e,outs:t}=this,n=(0,c.Z)(t.units.value,e.units.value),i=this.models[0].object3D.parent.parent;i.position.multiplyScalar(n),i.updateMatrix(),i.updateMatrixWorld(!0),this.models.forEach((e=>{const t=e.object3D.parent;t.position.multiplyScalar(n),t.updateMatrix(),t.updateMatrixWorld(!0)}))}updateLights(){const{ins:e,outs:t}=this,n=this.graph.findNodeByName("Lights");if(n){const i=n.getComponent(h.ZP,!0),s=(0,c.Z)(t.units.value,e.units.value);i.ins.scale.setValue([1,1,1]),i.children.forEach((e=>{const t=e.getComponents(m.f);for(let e of t){if(e instanceof f.Z){g.copy(e.light.position),v.copy(e.light.target.position);const t=v.sub(g).normalize();t.applyEuler(e.transform.object3D.rotation),g.copy(t.negate().multiplyScalar(1.2*this.outs.boundingRadius.value)),g.multiplyScalar(s),e.transform.ins.position.setValue(g.toArray()),g.setScalar(this.outs.boundingRadius.value*s*.2),e.transform.ins.scale.setValue(g.toArray()),e.light.updateMatrix()}e.ins.shadowEnabled.value&&("shadowSize"in e.ins&&e.ins.shadowSize.setValue(2*this.outs.boundingRadius.value),e.light.shadow.camera.far=4*this.outs.boundingRadius.value)}}))}}updateCameras(){this.renderer.views[0]&&this.renderer.views[0].renderer.xr.isPresenting||this.updateCameraHelper()}}y.typeName="CVScene",y.text="Scene",y.icon="hierarchy",y.ins={units:r.V5.Enum("Scene.Units",o.f_,o.f_.cm),modelUpdated:r.V5.Event("Scene.ModelUpdated"),sceneTransformed:r.V5.Event("Scene.Transformed")},y.outs={units:r.V5.Enum("Scene.Units",o.f_,o.f_.cm),boundingBox:r.V5.Object("Models.BoundingBox",s.Z),boundingRadius:r.V5.Number("Models.BoundingRadius")}},79815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var i=n(80038),s=n(92642),r=n(40490),o=n(27643),a=n(5249),l=n(44661),c=n(71507),h=n(97322),d=n(6461),u=n(29767),p=n(63531),m=n(7134),f=n(74572),g=n(24856),v=n(93072),y=n(17467);class b extends i.ZP{constructor(){super(...arguments),this._savedSetupData={},this.ins=this.addInputs(b.ins)}get featureMap(){return this.constructor.featureMap}get transform(){return this.getComponent(s.ZP)}create(){super.create();const e=this.node,t=b.featureMap;for(const n in t)this[n]=e.createComponent(t[n]);this.snapshots=e.createComponent(f.Z)}update(){const e=this.ins;return e.saveState.changed&&this.cacheSetupState(),e.restoreState.changed&&this.restoreSetupState(),!0}fromDocument(e,t,n){const i=e.scenes[t];if(!isFinite(i.setup))throw new Error("setup property missing in node");const s=this._savedSetupData=e.setups[i.setup],r=b.featureMap;for(const e in r){n.set(`scenes/${t}/setup/${e}`,this[e]);const i=s[e];i&&this[e].fromData(i)}}toDocument(e,t,n){const i=this._savedSetupData,s=b.featureMap;for(const e in s)n.set(this[e],`scenes/${t}/setup/${e}`);const r=this.tours.toData();r?i.tours=r:i.tours&&delete i.tours;const o=this.snapshots.toData(n);if(o&&(i.snapshots=o),i){e.setups=e.setups||[];const n=e.setups.length;e.setups.push(i),e.scenes[t].setup=n}}cacheSetupState(){const e=b.featureMap;for(const t in e){const e=this[t].toData();e&&(this._savedSetupData[t]=e)}}restoreSetupState(){const e=this._savedSetupData,t=b.featureMap;for(const n in t){const t=e[n];t&&"tours"!==n&&this[n].fromData(t)}}}b.typeName="CVSetup",b.ins={saveState:i.V5.Event("Setup.SaveState"),restoreState:i.V5.Event("Setup.RestoreState")},b.featureMap={interface:r.Z,reader:a.ZP,viewer:o.Z,navigation:l.ZP,background:c.Z,environment:g.Z,language:v.Z,floor:h.Z,grid:d.Z,tape:u.Z,slicer:p.Z,tours:m.Z,audio:y.Z}},63531:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var i=n(37840),s=n(80038),r=n(60206),o=n(26629),a=n(3388);const l=[[-1,0,0,0],[0,-1,0,0],[0,0,-1,0],[1,0,0,0],[0,1,0,0],[0,0,1,0]];class c extends s.ZP{constructor(){super(...arguments),this.ins=this.addInputs(c.ins),this.plane=null,this.axisIndex=-1}get settingProperties(){return[this.ins.enabled,this.ins.color]}get snapshotProperties(){return[this.ins.enabled,this.ins.axis,this.ins.position,this.ins.inverted]}create(){super.create();const e=this.getGraphComponent(o.Z);this.ins.boundingBox.linkFrom(e.outs.boundingBox)}update(e){const t=this.ins;if(t.axis.changed){const e=t.axis.getValidatedValue();e===this.axisIndex?t.inverted.setValue(!t.inverted.value):(t.inverted.setValue(!1),this.axisIndex=e)}if(!t.enabled.value&&!t.enabled.changed)return!1;const n=t.axis.getValidatedValue(),i=t.inverted.value,s=n+(i?3:0),r=this.ins.boundingBox.value;if(!r)return!0;this.plane=l[s];const o=r.min.getComponent(n),c=r.max.getComponent(n),h=1-t.position.value;this.plane[3]=i?h*(c-o)-c:c-h*(c-o);return this.getGraphComponents(a.Z).forEach((e=>{if(e.ins.slicerEnabled.value){e.object3D.traverse((e=>{if(e.isMesh){const t=e.material;t.isUberPBRMaterial&&this.updateMaterial(t)}}))}})),!0}fromData(e){e=e||{},this.ins.setValues({enabled:e.enabled||!1,axis:r.fi[e.axis]||r.fi.X,position:e.position||0,inverted:e.inverted||!1,color:e.color||[0,.61,.87]})}toData(){const e=this.ins;return{enabled:e.enabled.value,axis:r.fi[e.axis.getValidatedValue()],position:e.position.value,inverted:e.inverted.value,color:e.color.value}}updateMaterial(e){const t=this.ins;t.enabled.changed&&(e.enableCutPlane(t.enabled.value),e.needsUpdate=!0),e.cutPlaneDirection.fromArray(this.plane),e.cutPlaneColor.fromArray(t.color.value)}}c.typeName="CVSlicer",c.text="Slicer",c.icon="",c.ins={enabled:s.V5.Boolean("Slice.Enabled"),axis:s.V5.Enum("Slice.Axis",r.fi),position:s.V5.Number("Slice.Position",{min:0,max:1,preset:.5}),inverted:s.V5.Boolean("Slice.Inverted"),color:s.V5.ColorRGB("Slice.Color",[0,.61,.87]),boundingBox:s.V5.Object("Scene.BoundingBox",i.Z)}},74572:(e,t,n)=>{"use strict";n.d(t,{P:()=>i.P,Z:()=>l});var i=n(403),s=n(16967),r=n(79815),o=n(3388),a=n(7134);class l extends i.Z{constructor(){super(...arguments),this.targetFeatures={}}create(){super.create();const e=this.getGraphComponent(r.Z);Object.keys(e.featureMap).forEach((e=>{this.targetFeatures[e]=!1})),this.targetFeatures.models=!1,this.targetFeatures.lights=!1,this.initializeTargetFeatures()}initializeTargetFeatures(){const e=this.targetFeatures;Object.keys(e).forEach((t=>e[t]=!1)),e.navigation=!0,e.reader=!0,e.viewer=!0,this.updateTargets()}updateTargets(){const e=this.targetFeatures,t=this.getGraphComponent(r.Z);Object.keys(e).forEach((n=>{const i=t[n],s=e[n];i&&this.updateComponentTarget(i,s)}));this.getGraphComponents(o.Z).forEach((t=>{this.updateComponentTarget(t.transform,!!e.models),this.updateComponentTarget(t,!!e.models)}));this.getGraphComponents(s.Z).forEach((t=>{this.updateComponentTarget(t.transform,!!e.lights),this.updateComponentTarget(t,!!e.lights)}))}updateComponentTarget(e,t){const n=e.snapshotProperties;n&&n.forEach((e=>{if(!e.schema.event&&"object"!==e.type){const n=this.hasTargetProperty(e);t&&!n?this.addTargetProperty(e):!t&&n&&this.removeTargetProperty(e)}}))}fromData(e,t){this.clear();const n=this.targetFeatures,s=Object.keys(n);e.features?s.forEach((t=>n[t]=e.features.indexOf(t)>=0)):this.initializeTargetFeatures();const r=new Set;e.targets.forEach(((e,n)=>{const i=e.lastIndexOf("/"),s=e.substr(0,i),o=e.substr(i+1),a=t.get(s),l=a?a.ins[o]:null;l?this.addTargetProperty(l):(console.warn(`missing snapshot target property for '${e}'`),r.add(n))})),e.states.forEach((e=>{e.id!==a.Z.sceneSnapshotId&&this.setState({id:e.id,curve:void 0!==e.curve?i.P[e.curve]:i.P.EaseQuad,duration:void 0!==e.duration?e.duration:2,threshold:void 0!==e.threshold?e.threshold:.5,values:e.values.filter(((e,t)=>!r.has(t)))})}))}toData(e){const t=this.targetFeatures,n={features:Object.keys(t).filter((e=>t[e])),targets:this.targets.map((t=>{const n=t.property.group.linkable,i=t.property.key,s=e.get(n);if(!s)throw new Error(`snapshot path not registered for component '${n.displayName}'`);return s+"/"+i})),states:Object.keys(this.states).map((e=>{const t=this.states[e],n={id:t.id,values:t.values};return t.curve!==i.P.EaseQuad&&(n.curve=i.P[t.curve]),2!==t.duration&&(n.duration=t.duration),.5!==t.threshold&&(n.threshold=t.threshold),n}))};return n.targets.length>0&&n.states.length>0?n:null}}l.typeName="CVSnapshots"},31105:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(28110),s=n(2837),r=(n(44466),n(41029));n(91013),n(13301),n(10160);class o extends s.ZP{constructor(e,t){super(e,t),this._annotations={},this._viewports=new Set,this._sprites={},this.object3D=new i.Z,this.object3D.setVisible(!1)}update(e){super.update(e);const t=this.ins,n=this.object3D;return t.visible.changed&&n.setVisible(t.visible.value),!0}tock(){if(this.updated)return!0}postRender(e){const t=e.viewport;this._viewports.has(t)||(t.on("dispose",this.onViewportDispose,this),this._viewports.add(t));this.object3D.render(t.overlay,e.camera)}dispose(){this.object3D.dispose(),this._viewports.forEach((e=>e.off("dispose",this.onViewportDispose,this))),this._viewports.clear(),super.dispose()}addAnnotation(e){this._annotations[e.id]=e,this.createSprite(e),this.changed=!0}removeAnnotation(e){Object.keys(this._annotations);delete this._annotations[e.id],this.removeSprite(e),this.changed=!0}updateAnnotation(e,t){t&&this.updateSprite(e),this.changed=!0}onViewportDispose(e){this.object3D.disposeHTMLElements(e.viewport.overlay)}createSprite(e){this.removeSprite(e);const t=r.Z.createInstance(e);this._sprites[e.id]=t,this.object3D.add(t)}removeSprite(e){const t=this._sprites[e.id];t&&(t.dispose(),this._sprites[e.id]=void 0,this.object3D.remove(t))}updateSprite(e){const t=this._sprites[e.id];t&&t.update()}}o.typeName="CVStaticAnnotationView"},29767:(e,t,n)=>{"use strict";n.d(t,{T:()=>P,Z:()=>R});var i=n(23130),s=n(19588),r=n(29187),o=n(75809),a=n(64026),l=n(93122),c=n(37840),h=n(2837),d=n(6965),u=n(8035),p=n(40693),m=n(35322),f=n(71050);class g extends o.u{constructor(e=[new p.F(0,-.5),new p.F(.5,0),new p.F(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=f.uZ(i,0,2*Math.PI);const r=[],o=[],a=[],l=[],c=[],h=1/t,d=new s.P,u=new p.F,g=new s.P,v=new s.P,y=new s.P;let b=0,_=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:b=e[t+1].x-e[t].x,_=e[t+1].y-e[t].y,g.x=1*_,g.y=-b,g.z=0*_,y.copy(g),g.normalize(),l.push(g.x,g.y,g.z);break;case e.length-1:l.push(y.x,y.y,y.z);break;default:b=e[t+1].x-e[t].x,_=e[t+1].y-e[t].y,g.x=1*_,g.y=-b,g.z=0*_,v.copy(g),g.x+=y.x,g.y+=y.y,g.z+=y.z,g.normalize(),l.push(g.x,g.y,g.z),y.copy(v)}for(let s=0;s<=t;s++){const r=n+s*h*i,p=Math.sin(r),m=Math.cos(r);for(let n=0;n<=e.length-1;n++){d.x=e[n].x*p,d.y=e[n].y,d.z=e[n].x*m,o.push(d.x,d.y,d.z),u.x=s/t,u.y=n/(e.length-1),a.push(u.x,u.y);const i=l[3*n+0]*p,r=l[3*n+1],h=l[3*n+0]*m;c.push(i,r,h)}}for(let n=0;n0)):(this.system.off("pointer-up",this.onPointerUp,this),this.annotationView.ins.visible.setValue(!1))),r.visible.changed)if(r.visible.value){const e=r.startPosition.value,t=r.endPosition.value;e[0]==t[0]&&e[1]==t[1]&&e[2]==t[2]||(n.visible=!0,i.visible=!0,s.visible=!0,this.annotationView.ins.visible.setValue(!0))}else this.annotationView.ins.visible.setValue(!1);if(r.globalUnits.changed&&this.updateUnitScale(),r.startPosition.changed||r.startDirection.changed){n.position.fromArray(r.startPosition.value),T.fromArray(r.startDirection.value),n.quaternion.setFromUnitVectors(A,T),n.updateMatrix();const e=t.attributes.position.array;e[0]=n.position.x,e[1]=n.position.y,e[2]=n.position.z,t.attributes.position.needsUpdate=!0,this.annotationView.ins.visible.setValue(!1)}if(r.endPosition.changed||r.endDirection.changed){i.position.fromArray(r.endPosition.value),T.fromArray(r.endDirection.value),i.quaternion.setFromUnitVectors(A,T),i.updateMatrix();const e=t.attributes.position.array;e[3]=i.position.x,e[4]=i.position.y,e[5]=i.position.z,t.attributes.position.needsUpdate=!0,T.fromArray(r.startPosition.value),C.fromArray(r.endPosition.value);const n=T.distanceTo(C);this.outs.distance.setValue(n);this.label.data.position=[(e[0]+e[3])/2,(e[1]+e[4])/2,(e[2]+e[5])/2];const s=this.ins.globalUnits.getOptionText();this.label.title=n.toFixed(2)+" "+s,this.annotationView.updateAnnotation(this.label,!0),n>0&&this.ins.visible.value&&this.annotationView.ins.visible.setValue(!0)}return!0}fromData(e){this.ins.copyValues({visible:e.enabled})}toData(){return{enabled:this.ins.visible.cloneValue()}}onPointerUp(e){if(e.isDragging||!e.component||!e.component.is(y.Z))return;const t=e.component,n=(0,w.k)(t.object3D,e.object3D),i=t.localBoundingBox.clone().applyMatrix4(n),s=e.object3D.matrixWorld;E.getNormalMatrix(s);const r=e.view.pickPosition(e,i).applyMatrix4(s),o=e.view.pickNormal(e).applyMatrix3(E).normalize(),{startPin:a,endPin:l,line:c,ins:h,outs:d}=this;d.state.value===P.SetStart?(r.toArray(h.startPosition.value),o.toArray(h.startDirection.value),h.startPosition.set(),h.startDirection.set(),a.visible=!0,l.visible=!1,c.visible=!1,d.state.setValue(P.SetEnd)):(r.toArray(h.endPosition.value),o.toArray(h.endDirection.value),h.endPosition.set(),h.endDirection.set(),a.visible=!0,l.visible=!0,c.visible=!0,d.state.setValue(P.SetStart))}updateUnitScale(){const e=this.ins,t=e.localUnits.getValidatedValue(),n=e.globalUnits.getValidatedValue();this.outs.unitScale.setValue((0,x.Z)(t,n)),T.fromArray(e.startPosition.value),e.startPosition.setValue(T.multiplyScalar(this.outs.unitScale.value).toArray()),T.fromArray(e.endPosition.value),e.endPosition.setValue(T.multiplyScalar(this.outs.unitScale.value).toArray()),e.localUnits.setValue(n)}}R.typeName="CVTape",R.text="Tape",R.icon="",R.tapeIns={startPosition:h.V5.Vector3("Start.Position"),startDirection:h.V5.Vector3("Start.Direction"),endPosition:h.V5.Vector3("End.Position"),endDirection:h.V5.Vector3("End.Direction"),boundingBox:h.V5.Object("Scene.BoundingBox",c.Z),globalUnits:h.V5.Enum("Model.GlobalUnits",_.f_,_.f_.cm),localUnits:h.V5.Enum("Model.LocalUnits",_.f_,_.f_.cm),enabled:h.V5.Boolean("Tape.Enabled",!1)},R.tapeOuts={state:h.V5.Enum("Tape.State",P),distance:h.V5.Number("Tape.Distance"),unitScale:h.V5.Number("UnitScale",{preset:1,precision:5})}},97008:(e,t,n)=>{"use strict";n.d(t,{Mo:()=>o.Mo,V5:()=>i.V5,ZP:()=>l,dy:()=>o.dy,v5:()=>c});var i=n(80038),s=n(27924),r=n(11359),o=n(11598),a=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};class l extends s.Z{constructor(){super(...arguments),this.ins=this.addInputs(l.toolIns),this.outs=this.addOutputs(l.toolOuts),this._isActiveTool=!1}get isActiveTool(){return this._isActiveTool}dispose(){this._isActiveTool&&this.deactivateTool(),super.dispose()}createView(){throw new Error("must override")}activateTool(){this._isActiveTool=!0,this.startObserving()}deactivateTool(){this.stopObserving(),this._isActiveTool=!1}}l.typeName="CVTool",l.toolIns={},l.toolOuts={};class c extends o.ZP{constructor(e){super(e.system),this.tool=null,this.needsFocus=!1,this.tool=e}get analytics(){return this.system.getMainComponent(r.Z)}firstConnected(){this.classList.add("sv-group","sv-tool-view"),this.needsFocus=!0}connected(){super.connected(),this.tool.on("update",this.onUpdate,this)}disconnected(){this.tool.off("update",this.onUpdate,this),super.disconnected()}updated(e){super.updated(e),this.needsFocus&&(this.setFocus(),this.needsFocus=!1)}setFocus(){}}a([(0,o.Cb)({attribute:!1})],c.prototype,"tool",void 0)},22040:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(80038),s=n(63833),r=n(97008),o=n(11359);class a extends s.Z{constructor(e,t){super(e,t),this.ins=this.addInputs(a.ins),this.scope=s.$.Node}get analytics(){return this.getMainComponent(o.Z)}update(e){return this.ins.visible.changed,!0}activateComponent(e){e.activateTool(),this.analytics.sendProperty("Tools_ActiveTool",e.text)}deactivateComponent(e){e.deactivateTool()}onActiveComponent(e,t){}}a.typeName="CVToolProvider",a.isSystemSingleton=!0,a.componentType=r.ZP,a.ins={visible:i.V5.Boolean("Tools.Visible"),closed:i.V5.Event("Tools.Closed")}},7134:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var i=n(80038),s=n(1594),r=n(74572),o=n(11359),a=n(93072),l=n(79815);class c extends i.ZP{constructor(){super(...arguments),this.ins=this.addInputs(c.ins),this.outs=this.addOutputs(c.outs),this._tours=[]}get analytics(){return this.getMainComponent(o.Z)}get language(){return this.getGraphComponent(a.Z)}get setup(){return this.getGraphComponent(l.Z)}get snapshots(){return this.getComponent(r.Z)}get tours(){return this._tours}get activeSteps(){const e=this.activeTour;return e?e.steps:null}get activeTour(){return this._tours[this.outs.tourIndex.value]}get activeStep(){const e=this.activeTour;return e?e.steps[this.outs.stepIndex.value]:null}get title(){const e=this.activeTour;return 0===Object.keys(e.titles).length&&(e.titles[s.k$]=e.title),e.titles[s.PD[this.language.outs.language.value]]||"undefined"}set title(e){this.activeTour.titles[s.PD[this.language.outs.language.value]]=e}get lead(){const e=this.activeTour;return 0===Object.keys(e.leads).length&&(e.leads[s.k$]=e.lead),e.leads[s.PD[this.language.outs.language.value]]||""}set lead(e){this.activeTour.leads[s.PD[this.language.outs.language.value]]=e}get taglist(){const e=this.activeTour;return 0===Object.keys(e.taglist).length&&e.tags.length>0&&(e.taglist[s.k$]=e.tags),e.taglist[s.PD[this.language.outs.language.value]]||[]}set taglist(e){this.activeTour.taglist[s.PD[this.language.outs.language.value]]=e}get stepTitle(){const e=this.activeStep;return e?(0===Object.keys(e.titles).length&&(e.titles[s.k$]=e.title),e.titles[s.PD[this.language.outs.language.value]]||"undefined"):null}set stepTitle(e){const t=this.activeStep;t&&(t.titles[s.PD[this.language.outs.language.value]]=e)}create(){super.create(),this.language.outs.language.on("value",this.update,this)}dispose(){this.language.outs.language.off("value",this.update,this),super.dispose()}update(e){const{ins:t,outs:n}=this,i=this._tours,s=this.snapshots,o=this.setup.navigation;if(t.enabled.changed){if(!t.enabled.value)return n.tourIndex.set(),this.normalizeViewOrbit(c.sceneSnapshotId),s.tweenTo(c.sceneSnapshotId,e.secondsElapsed),s.deleteState(c.sceneSnapshotId),!0;{const e={id:c.sceneSnapshotId,curve:r.P.EaseOutQuad,duration:1,threshold:0,values:s.getCurrentValues()};s.setState(e)}}const a=Math.min(i.length-1,Math.max(-1,t.tourIndex.value)),l=i[a],h=l?l.steps.length:0;n.stepCount.setValue(h);let d=-1;if((t.tourIndex.changed||t.enabled.changed)&&(a!==n.tourIndex.value&&(d=0),n.tourIndex.setValue(a),n.tourTitle.setValue(l?this.title:""),n.tourLead.setValue(l?this.lead:"")),0===h)return n.stepIndex.setValue(-1),n.stepTitle.setValue(""),!0;let u=!0;if(t.enabled.changed&&(d=n.stepIndex.value),t.stepIndex.changed&&(d=Math.min(l.steps.length-1,Math.max(0,t.stepIndex.value)),u=!1),t.first.changed&&(d=0),t.next.changed&&(d=n.stepIndex.value+1,d>=h&&(n.ending.setValue(!0),n.tourIndex.setValue(-1),n.tourTitle.setValue(""),n.tourLead.setValue(""),n.stepIndex.set(),d=-1)),t.previous.changed&&(d=(n.stepIndex.value+h-1)%h),0===d&&this.normalizeViewOrbit(l.steps[0].id),d>=0){o.setChanged(!0);const e=l.steps[d];n.stepIndex.setValue(d),n.stepTitle.setValue(this.stepTitle||"undefined"),s.ins.id.setValue(e.id),u?s.ins.tween.set():s.ins.recall.set()}return!0}fromData(e){this._tours=e.map((e=>({title:e.title,titles:e.titles||{},steps:e.steps.map((e=>({title:e.title,titles:e.titles||{},id:e.id}))),lead:e.lead||"",leads:e.leads||{},tags:e.tags||[],taglist:e.taglist||{}}))),this._tours.forEach((e=>{Object.keys(e.titles).forEach((e=>{this.language.addLanguage(s.PD[e])})),e.steps.forEach((e=>{0==Object.keys(e.titles).length&&(e.titles[s.k$]=e.title||null)}))})),this.ins.tourIndex.setValue(-1),this.outs.count.setValue(this._tours.length)}toData(){return 0===this._tours.length?null:this._tours.map((e=>{const t={steps:e.steps.map((e=>{const t={};return t.id=e.id,Object.keys(e.titles).length>0?t.titles=e.titles:e.title&&(t.title=e.title),t}))};return Object.keys(e.titles).length>0?t.titles=e.titles:e.title&&(t.title=e.title),Object.keys(e.leads).length>0?t.leads=e.leads:e.lead&&(t.lead=e.lead),Object.keys(e.taglist).length>0?t.taglist=e.taglist:e.tags.length>0&&(t.tags=e.tags),t}))}normalizeViewOrbit(e){const t=this.snapshots.getTargetProperties().findIndex((e=>"Orbit"==e.name)),n=this.snapshots.getState(e),i=this.snapshots.getCurrentValues()[t];n&&i.forEach(((e,i)=>{const s=Math.round((n.values[t][i]-e)/360);this.snapshots.getTargetProperties()[t].value[i]+=360*s}))}}c.typeName="CVTours",c.sceneSnapshotId="scene-default",c.ins={enabled:i.V5.Boolean("Tours.Enabled"),tourIndex:i.V5.Integer("Tours.Index",-1),closed:i.V5.Event("Tours.Closed"),stepIndex:i.V5.Integer("Step.Index"),next:i.V5.Event("Step.Next"),previous:i.V5.Event("Step.Previous"),first:i.V5.Event("Step.First")},c.outs={count:i.V5.Integer("Tours.Count"),tourIndex:i.V5.Integer("Tour.Index",-1),tourTitle:i.V5.String("Tour.Title"),tourLead:i.V5.String("Tour.Lead"),stepCount:i.V5.Integer("Tour.Steps"),ending:i.V5.Boolean("Tour.Ending"),stepIndex:i.V5.Integer("Step.Index"),stepTitle:i.V5.String("Step.Title")}},27643:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var i=n(75544),s=n(80038),r=n(15271),o=n(60206),a=n(43875),l=n(3388),c=n(51462),h=n(11359),d=n(93072),u=n(30242);class p extends s.ZP{constructor(){super(...arguments),this._rootElement=null,this.ins=this.addInputs(p.ins),this.outs=this.addOutputs(p.outs)}get settingProperties(){return[this.ins.annotationsVisible,this.ins.activeTags,this.ins.sortedTags,this.ins.radioTags,this.ins.shader,this.ins.toneMapping,this.ins.exposure,this.ins.gamma,this.ins.isWallMountAR,this.ins.arScale]}get snapshotProperties(){return[this.ins.annotationsVisible,this.ins.activeAnnotation,this.ins.activeTags,this.ins.shader,this.ins.exposure]}get analytics(){return this.getMainComponent(h.Z)}get renderer(){return this.getMainComponent(r.Z)}get ar(){return this.getMainComponent(u.Z)}get rootElement(){return this._rootElement}set rootElement(e){this._rootElement=e}create(){super.create(),this.graph.components.on(l.Z,this.onModelComponent,this),this.graph.components.on(c.Z,this.onAnnotationsComponent,this),this.graph.components.on(d.Z,this.onLanguageComponent,this),this.ar.ins.wallMount.linkFrom(this.ins.isWallMountAR),this.ar.ins.arScale.linkFrom(this.ins.arScale)}dispose(){this.graph.components.off(l.Z,this.onModelComponent,this),this.graph.components.off(c.Z,this.onAnnotationsComponent,this),this.graph.components.off(d.Z,this.onLanguageComponent,this),super.dispose()}update(e){const t=this.ins;if(t.shader.changed){const e=t.shader.getValidatedValue();this.getGraphComponents(l.Z).forEach((t=>t.ins.shader.setValue(e)))}if(t.exposure.changed&&this.renderer.ins.exposure.setValue(t.exposure.value),t.toneMapping.changed){this.renderer.views.forEach((e=>e.renderer.toneMapping=t.toneMapping.value?i.LY2:i.uL9));const e=this.renderer.activeScene;e&&e.traverse((e=>{const t=e;t.isMesh&&(Array.isArray(t.material)?t.material.forEach((e=>e.needsUpdate=!0)):t.material.needsUpdate=!0)}))}if(t.gamma.changed,t.quality.changed){const e=t.quality.getValidatedValue();this.getGraphComponents(l.Z).forEach((t=>t.ins.quality.setValue(e)))}if(t.activeAnnotation.changed){const e=t.activeAnnotation.value;this.getGraphComponents(c.Z).forEach((t=>t.setActiveAnnotationById(e)))}if(t.annotationsVisible.changed){const e=t.annotationsVisible.value;this.getGraphComponents(c.Z).forEach((t=>t.ins.visible.setValue(e)))}if(t.activeTags.changed){const e=t.activeTags.value;this.getGraphComponents(c.Z).forEach((t=>t.ins.activeTags.setValue(e))),this.getGraphComponents(l.Z).forEach((t=>t.ins.activeTags.setValue(e)))}return t.sortedTags.changed&&this.refreshTagCloud(),!0}fromData(e){const t=this.ins;t.copyValues({shader:o.pH[e.shader]||o.pH.Default,exposure:void 0!==e.exposure?e.exposure:t.exposure.schema.preset,toneMapping:e.toneMapping||!1,gamma:void 0!==e.gamma?e.gamma:t.gamma.schema.preset,isWallMountAR:e.isWallMountAR||!1,arScale:e.arScale||1,annotationsVisible:!!e.annotationsVisible,activeTags:e.activeTags||"",sortedTags:e.sortedTags||"",radioTags:void 0!==e.radioTags?!!e.radioTags:t.radioTags.schema.preset})}toData(){const e=this.ins,t={shader:o.pH[e.shader.value],exposure:e.exposure.value,toneMapping:e.toneMapping.value,gamma:e.gamma.value,isWallMountAR:e.isWallMountAR.value,arScale:e.arScale.value};return e.annotationsVisible.value&&(t.annotationsVisible=!0),e.activeTags.value&&(t.activeTags=e.activeTags.value),e.sortedTags.value&&(t.sortedTags=e.sortedTags.value),e.radioTags.value&&(t.radioTags=e.radioTags.value),t}refreshTagCloud(){const e=new Set;this.getGraphComponents(l.Z).forEach((t=>{t.ins.tags.value.split(",").map((e=>e.trim())).filter((e=>e)).forEach((t=>e.add(t)))}));this.getGraphComponents(c.Z).forEach((t=>{t.getAnnotations().forEach((t=>{t.tags.forEach((t=>{e.add(t)}))}))}));const t=Array.from(e),n=this.ins.sortedTags.value.split(",").map((e=>e.trim())).filter((e=>e));t.sort(((e,t)=>{const i=n.indexOf(e),s=n.indexOf(t);return is?1:0})),this.outs.tagCloud.setValue(t.join(", ")),this.ins.activeTags.set(),this.ins.annotationsVisible.set()}onAnnotationClick(e){const t=e.annotation?e.annotation.id:"";this.ins.activeAnnotation.setValue(t),this.rootElement.dispatchEvent(new CustomEvent("annotation-active",{detail:t}))}onModelComponent(e){const t=e.object;e.add?(t.on("tag-update",this.refreshTagCloud,this),t.on("model-load",this.onModelLoad,this)):e.remove&&(t.off("tag-update",this.refreshTagCloud,this),t.off("model-load",this.onModelLoad,this))}onAnnotationsComponent(e){const t=e.object;e.add?(t.on("tag-update",this.refreshTagCloud,this),t.on("click",this.onAnnotationClick,this),t.ins.visible.setValue(this.ins.annotationsVisible.value)):e.remove&&(t.off("tag-update",this.refreshTagCloud,this),t.off("click",this.onAnnotationClick,this))}onLanguageComponent(e){const t=e.object;e.add?t.on("tag-update",this.refreshTagCloud,this):e.remove&&t.off("tag-update",this.refreshTagCloud,this)}onModelLoad(e){this.rootElement.dispatchEvent(new CustomEvent("model-load",{detail:a.$l[e.quality]})),this.refreshTagCloud()}}p.typeName="CVViewer",p.text="Viewer",p.icon="",p.ins={annotationsVisible:s.V5.Boolean("Annotations.Visible"),activeAnnotation:s.V5.String("Annotations.ActiveId"),activeTags:s.V5.String("Tags.Active"),sortedTags:s.V5.String("Tags.Sorted"),radioTags:s.V5.Boolean("Tags.Radio"),shader:s.V5.Enum("Renderer.Shader",o.pH),toneMapping:s.V5.Boolean("Renderer.ToneMapping",!1),exposure:s.V5.Number("Renderer.Exposure",1),gamma:s.V5.Number("Renderer.Gamma",2),quality:s.V5.Enum("Models.Quality",a.$l,a.$l.High),isWallMountAR:s.V5.Boolean("AR.IsWallMount",!1),arScale:s.V5.Number("AR.Scale",1)},p.outs={tagCloud:s.V5.String("Tags.Cloud")}},53414:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(76288),s=n(16967);class r extends i.Z{get settingProperties(){return[this.ins.color,this.ins.intensity,this.ins.shadowEnabled,this.ins.shadowSize,this.ins.shadowResolution,this.ins.shadowBlur]}get snapshotProperties(){return[this.ins.color,this.ins.intensity]}dispose(){this.ins.shadowEnabled.value&&this.light.shadow.map&&this.light.shadow.map.dispose(),super.dispose()}fromDocument(e,t){if(!isFinite(t.light))throw new Error("light property missing in node");const n=e.lights[t.light],i=this.ins;if("directional"!==n.type)throw new Error("light type mismatch: not a directional light");return i.copyValues({color:void 0!==n.color?n.color:i.color.schema.preset,intensity:void 0!==n.intensity?n.intensity:i.intensity.schema.preset,position:i.position.schema.preset,target:i.target.schema.preset,shadowEnabled:n.shadowEnabled||!1,shadowSize:void 0!==n.shadowSize?n.shadowSize:i.shadowSize.schema.preset,shadowResolution:void 0!==n.shadowResolution?s.B[n.shadowResolution]||0:i.shadowResolution.schema.preset,shadowBlur:void 0!==n.shadowBlur?n.shadowBlur:i.shadowBlur.schema.preset}),t.light}toDocument(e,t){const n=this.ins,i={color:n.color.cloneValue(),intensity:n.intensity.value};i.type=r.type,n.shadowEnabled.value&&(i.shadowEnabled=!0,n.shadowSize.isDefault()||(i.shadowSize=n.shadowSize.value),n.shadowBlur.isDefault()||(i.shadowBlur=n.shadowBlur.value),n.shadowResolution.isDefault()||(i.shadowResolution=s.B[n.shadowResolution.value])),e.lights=e.lights||[];const o=e.lights.length;return e.lights.push(i),o}}r.typeName="CVDirectionalLight",r.type="directional",r.text="Directional Light",r.icon="sun"},41282:(e,t,n)=>{"use strict";n.d(t,{f:()=>s.Z});var i,s=n(16967);!function(e){e[e.directional=0]="directional",e[e.point=1]="point",e[e.spot=2]="spot",e[e.ambient=3]="ambient",e[e.hemisphere=4]="hemisphere",e[e.rect=5]="rect"}(i||(i={}))},44466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(2627),s=n(41029),r=n(1594);class o extends i.Z{constructor(){super(...arguments),this._language=r.PD.EN,this._leadChanged=!1}get title(){return 0===Object.keys(this.data.titles).length&&(this.data.titles[r.k$]=this.data.title),this.data.titles[r.PD[this.language]]||"undefined"}set title(e){this.data.titles[r.PD[this.language]]=e,this.update()}get lead(){return 0===Object.keys(this.data.leads).length&&(this.data.leads[r.k$]=this.data.lead),this.data.leads[r.PD[this.language]]||""}set lead(e){this.data.leads[r.PD[this.language]]=e,this.update()}get tags(){return 0===Object.keys(this.data.taglist).length&&this.data.tags.length>0&&(this.data.taglist[r.k$]=this.data.tags),this.data.taglist[r.PD[this.language]]||[]}set tags(e){this.data.taglist[r.PD[this.language]]=e,this.update()}get language(){return this._language}set language(e){this._language=e}get imageCredit(){return this.data.imageCredit[r.PD[this.language]]||""}set imageCredit(e){this.data.imageCredit[r.PD[this.language]]=e,this.update()}get imageAltText(){return this.data.imageAltText[r.PD[this.language]]||""}set imageAltText(e){this.data.imageAltText[r.PD[this.language]]=e,this.update()}get leadChanged(){return this._leadChanged}set leadChanged(e){this._leadChanged=e}static fromJSON(e){return new o(e)}init(){return{id:i.Z.generateId(),title:"New Annotation",titles:{},lead:"",leads:{},marker:"",tags:[],taglist:{},articleId:"",imageUri:"",imageCredit:{},imageAltText:{},audioId:"",viewId:"",style:s.Z.defaultTypeName,visible:!0,expanded:!1,position:null,direction:null,scale:1,offset:0,tilt:0,azimuth:0,color:[0,.61,.87],zoneIndex:-1}}deflate(e,t){t.id=e.id,Object.keys(this.data.titles).length>0?(t.titles={},Object.keys(this.data.titles).forEach((n=>{t.titles[n]=e.titles[n]}))):e.title&&(t.title=e.title),Object.keys(this.data.leads).length>0?(t.leads={},Object.keys(this.data.leads).forEach((n=>{t.leads[n]=e.leads[n]}))):e.lead&&(t.lead=e.lead),e.marker&&(t.marker=e.marker),Object.keys(this.data.taglist).length>0?(t.taglist={},Object.keys(this.data.taglist).forEach((n=>{t.taglist[n]=e.taglist[n].slice()}))):e.tags.length>0&&(t.tags=e.tags),e.articleId&&(t.articleId=e.articleId),e.imageUri&&(t.imageUri=e.imageUri),e.imageUri&&(t.imageUri=e.imageUri),Object.keys(this.data.imageCredit).length>0&&(t.imageCredit={},Object.keys(this.data.imageCredit).forEach((n=>{t.imageCredit[n]=e.imageCredit[n]}))),Object.keys(this.data.imageAltText).length>0&&(t.imageAltText={},Object.keys(this.data.imageAltText).forEach((n=>{t.imageAltText[n]=e.imageAltText[n]}))),e.audioId&&(t.audioId=e.audioId),e.viewId&&(t.viewId=e.viewId),e.style!==s.Z.defaultTypeName&&(t.style=e.style),!1===e.visible&&(t.visible=e.visible),e.position&&(t.position=e.position.slice()),e.direction&&(t.direction=e.direction.slice()),1!==e.scale&&(t.scale=e.scale),0!==e.offset&&(t.offset=e.offset),0!==e.tilt&&(t.tilt=e.tilt),0!==e.azimuth&&(t.azimuth=e.azimuth);const n=e.color;return!n||0===n[0]&&.61===n[1]&&.87===n[2]||(t.color=n.slice()),e.zoneIndex>-1&&(t.zoneIndex=e.zoneIndex),e}inflate(e,t){t.id=e.id,t.title=e.title||"",t.titles=e.titles||{},t.lead=e.lead||"",t.leads=e.leads||{},t.marker=e.marker||"",t.tags=e.tags||[],t.taglist=e.taglist||{},t.articleId=e.articleId||"",t.imageUri=e.imageUri||"",t.imageCredit=e.imageCredit||{},t.imageAltText=e.imageAltText||{},t.audioId=e.audioId||"",t.viewId=e.viewId||"",t.style=e.style||s.Z.defaultTypeName,t.visible=void 0===e.visible||e.visible,t.expanded=!1,t.position=e.position.slice(),t.direction=e.direction.slice(),t.scale=void 0!==e.scale?e.scale:1,t.offset=e.offset||0,t.tilt=e.tilt||0,t.azimuth=e.azimuth||0,t.color=e.color||o.defaultColor.slice(),t.zoneIndex=void 0!==e.zoneIndex?e.zoneIndex:-1}}o.defaultColor=[0,.61,.87]},38112:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(2627),s=n(1594);class r extends i.Z{constructor(){super(...arguments),this._language=s.PD.EN}static fromJSON(e){return new r(e)}toString(){return this.title}get title(){return 0===Object.keys(this.data.titles).length&&(this.data.titles[s.k$]=this.data.title),this.data.titles[s.PD[this.language]]||"undefined"}set title(e){this.data.titles[s.PD[this.language]]=e,this.update()}get defaultTitle(){return 0===Object.keys(this.data.titles).length&&(this.data.titles[s.k$]=this.data.title),this.data.titles[s.k$]||"undefined"}get uri(){return 0===Object.keys(this.data.uris).length&&(this.data.uris[s.k$]=this.data.uri),this.data.uris[s.PD[this.language]]}set uri(e){this.data.uris[s.PD[this.language]]=e,this.update()}get lead(){return 0===Object.keys(this.data.leads).length&&(this.data.leads[s.k$]=this.data.lead),this.data.leads[s.PD[this.language]]||""}set lead(e){this.data.leads[s.PD[this.language]]=e,this.update()}get tags(){return 0===Object.keys(this.data.taglist).length&&this.data.tags.length>0&&(this.data.taglist[s.k$]=this.data.tags),this.data.taglist[s.PD[this.language]]||[]}set tags(e){this.data.taglist[s.PD[this.language]]=e,this.update()}get language(){return this._language}set language(e){this._language=e}init(){return{id:i.Z.generateId(),title:"New Article",titles:{},lead:"",leads:{},tags:[],taglist:{},uri:"",uris:{},mimeType:"",thumbnailUri:""}}deflate(e,t){t.id=e.id,Object.keys(this.data.uris).length>0?(t.uris={},Object.keys(this.data.uris).forEach((n=>{t.uris[n]=e.uris[n]}))):e.uri&&(t.uri=e.uri),Object.keys(this.data.titles).length>0?(t.titles={},Object.keys(this.data.titles).forEach((n=>{t.titles[n]=e.titles[n]}))):e.title&&(t.title=e.title),Object.keys(this.data.leads).length>0?(t.leads={},Object.keys(this.data.leads).forEach((n=>{t.leads[n]=e.leads[n]}))):e.lead&&(t.lead=e.lead),Object.keys(this.data.taglist).length>0?(t.taglist={},Object.keys(this.data.taglist).forEach((n=>{t.taglist[n]=e.taglist[n].slice()}))):e.tags.length>0&&(t.tags=e.tags.slice()),e.mimeType&&(t.mimeType=e.mimeType),e.thumbnailUri&&(t.thumbnailUri=e.thumbnailUri)}inflate(e,t){t.id=e.id,t.uri=e.uri||"",t.uris=e.uris||{},t.title=e.title||"",t.titles=e.titles||{},t.lead=e.lead||"",t.leads=e.leads||{},t.tags=e.tags||[],t.taglist=e.taglist||{},t.mimeType=e.mimeType||"",t.thumbnailUri=e.thumbnailUri||""}}},38642:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>r,hH:()=>s.hH,xd:()=>s.xd});var i=n(2627),s=n(43875);class r extends i.Z{setModel(e){this.data.uri=e,this.data.type=s.hH.Model,this.data.mimeType=this.guessAssetMimeType()}setGeometry(e){this.data.uri=e,this.data.type=s.hH.Geometry,this.data.mimeType=this.guessAssetMimeType()}setTexture(e,t){this.data.uri=e,this.data.type=s.hH.Image,this.data.mimeType=this.guessAssetMimeType(),this.data.mapType=t}isValid(){return!!this.data.uri&&void 0!==this.data.type}toString(){const e=this.data;return`Asset - type: '${s.hH[e.type]}', uri: '${e.uri}', mime type: '${e.mimeType||"(not set)"}'`}init(){return{uri:"",mimeType:"",type:void 0,mapType:void 0,byteSize:0,numFaces:0,numVertices:0,imageSize:0}}deflate(e,t){t.uri=e.uri,t.type=s.hH[e.type],e.mimeType&&(t.mimeType=e.mimeType),void 0!==e.mapType&&(t.mapType=s.xd[e.mapType]),e.byteSize>0&&(t.byteSize=e.byteSize),e.type!==s.hH.Model&&e.type!==s.hH.Geometry||e.numFaces>0&&(t.numFaces=e.numFaces),e.type!==s.hH.Model&&e.type!==s.hH.Image&&e.type!==s.hH.Texture||e.imageSize>0&&(t.imageSize=e.imageSize)}inflate(e,t){t.uri=e.uri,t.mimeType=e.mimeType||"",t.type=s.hH[e.type],t.mapType=s.xd[e.mapType],t.byteSize=e.byteSize||0,t.numFaces=e.numFaces||0,t.imageSize=e.imageSize||0,void 0===t.type&&(t.type=this.guessAssetType(),void 0===t.type&&console.warn(`failed to determine asset type from asset: ${t.uri}`))}guessAssetType(){const e=this.data;if(void 0!==e.type&&s.hH[e.type])return e.type;if(e.mimeType){if(e.mimeType===r.mimeType.gltfJson||e.mimeType===r.mimeType.gltfBinary)return s.hH.Model;if(e.mimeType===r.mimeType.imageJpeg||e.mimeType===r.mimeType.imagePng)return s.hH.Image}const t=e.uri.split(".").pop().toLowerCase();return"gltf"===t||"glb"===t?s.hH.Model:"obj"===t||"ply"===t?s.hH.Geometry:"jpg"===t||"png"===t?s.hH.Image:void 0}guessAssetMimeType(){const e=this.data;if(e.mimeType)return e.mimeType;const t=e.uri.split(".").pop().toLowerCase();return"gltf"===t?r.mimeType.gltfJson:"glb"===t?r.mimeType.gltfBinary:"jpg"===t?r.mimeType.imageJpeg:"png"===t?r.mimeType.imagePng:""}}r.mimeType={gltfJson:"model/gltf+json",gltfBinary:"model/gltf-binary",imageJpeg:"image/jpeg",imagePng:"image/png"}},37117:(e,t,n)=>{"use strict";n.d(t,{$l:()=>o.$l,ZP:()=>c,_U:()=>o._U,hH:()=>l.hH});var i=n(8035),s=n(79961),r=n(2627),o=n(43875),a=n(10290),l=n(38642);class c extends r.Z{constructor(){super(...arguments),this.model=null}static fromJSON(e){return new c(e)}dispose(){this.unload(),super.dispose()}load(e){if(this.data.usage!==o._U.Web3D)throw new Error("can't load, not a Web3D derivative");const t=this.findAsset(l.hH.Model);if(t)return e.getModel(t.data.uri).then((e=>(this.model&&(0,s.D7)(this.model),this.model=e,e)));const n=this.findAsset(l.hH.Geometry),r=this.findAssets(l.hH.Image);return n?e.getGeometry(n.data.uri).then((t=>(this.model=new i.K(t,new a.Z),Promise.all(r.map((t=>e.getTexture(t.data.uri)))).catch((e=>(console.warn("failed to load texture files"),[])))))).then((e=>{const t=this.model.material;return this.assignTextures(r,e,t),t.map||(t.color.setScalar(.5),t.roughness=.8,t.metalness=0),this.model})):void 0}unload(){this.model&&((0,s.D7)(this.model),this.model=null)}createAsset(e,t){const n=new l.ZP;return n.data.type=e,n.data.uri=t,this.addAsset(n),n}addAsset(e){if(!e.data.uri)throw new Error("uri must be specified");this.data.assets.push(e),this.update()}removeAsset(e){const t=this.data.assets.indexOf(e);t>=0&&this.data.assets.splice(t,1)}findAsset(e){return this.data.assets.find((t=>t.data.type===e))}findAssets(e){return this.data.assets.filter((t=>t.data.type===e))}toString(e=!1){const t=this.data;return e?`Derivative - usage: '${o._U[t.usage]}', quality: '${o.$l[t.quality]}'\n `+t.assets.map((e=>e.toString())).join("\n "):`Derivative - usage: '${o._U[t.usage]}', quality: '${o.$l[t.quality]}', #assets: ${t.assets.length})`}init(){return{usage:o._U.Web3D,quality:o.$l.Medium,assets:[]}}deflate(e,t){t.usage=o._U[e.usage],t.quality=o.$l[e.quality],t.assets=e.assets.map((e=>e.toJSON()))}inflate(e,t){if(t.usage=o._U[e.usage],void 0===t.usage)throw new Error(`unknown derivative usage: ${e.usage}`);if(t.quality=o.$l[e.quality],void 0===t.quality)throw new Error(`unknown derivative quality: ${e.quality}`);t.assets=e.assets.map((e=>new l.ZP(e)))}assignTextures(e,t,n){for(let i=0;i{"use strict";n.d(t,{Z:()=>a});var i=n(90199),s=n(36283),r=n(25864),o=n(31491);class a extends i.Z{get scene(){return this.components.get(s.Z)}get documentProvider(){return this.components.get(r.Z)}get nodeProvider(){return this.components.get(o.Z)}createComponents(){this.createComponent(s.Z,"Master Scene"),this.createComponent(r.Z),this.createComponent(o.Z)}}a.typeName="NVDocuments"},38303:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var i=n(90199),s=n(26220),r=n(15271),o=n(18345),a=n(38080),l=n(63872),c=n(68327),h=n(11359),d=n(30242);class u extends i.Z{get pulse(){return this.components.get(s.Z)}get renderer(){return this.components.get(r.Z)}get fullscreen(){return this.components.get(a.Z)}get selection(){return this.components.get(o.Z)}get assetManager(){return this.components.get(l.Z)}get assetReader(){return this.components.get(c.Z)}get analytics(){return this.components.get(h.Z)}get arManager(){return this.components.get(d.Z)}createComponents(){this.createComponent(s.Z),this.createComponent(r.Z),this.createComponent(a.Z),this.createComponent(l.Z),this.createComponent(c.Z),this.createComponent(h.Z),this.createComponent(d.Z);this.createComponent(o.Z).ins.viewportBrackets.setValue(!1)}}u.typeName="NVEngine"},75222:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var i=n(90199),s=n(13227),r=n(27884),o=n(41282),a=n(84678),l=n(3388),c=n(26629),h=n(89167);class d extends i.Z{get transform(){return this.components.get(s.Z)}get meta(){return this.components.get(a.Z,!0)}get model(){return this.components.get(l.Z,!0)}get camera(){return this.components.get(r.Z,!0)}get light(){return this.components.get(o.f,!0)}get scene(){return this.components.get(c.Z,!0)}createComponents(){this.name="Node",this.createComponent(s.Z)}createModel(){this.name="Model",this.createComponent(a.Z),this.createComponent(l.Z)}fromDocument(e,t,n){const i=e.nodes[t];this.transform.fromData(i),n.set(`node/${t}`,this.transform);let s="Node";if(isFinite(i.meta)&&(this.createComponent(a.Z).fromDocument(e,i),n.set(`meta/${i.meta}`,this.meta),s="Meta"),isFinite(i.model)&&(this.createComponent(l.Z).fromDocument(e,i),n.set(`model/${i.model}`,this.model),s="Model"),isFinite(i.camera)&&(this.addTag("controlled"),this.createComponent(r.Z).fromDocument(e,i),n.set(`camera/${i.camera}`,this.camera),s="Camera"),isFinite(i.light)){this.addTag("controlled");const t=e.lights[i.light].type;let r=h.J.find((e=>e.type==t));if(!r)throw new Error(`unknown light type: '${t}'`);this.createComponent(r).fromDocument(e,i),s=r.text,n.set(`light/${i.light}`,this.light)}this.name=i.name||s;const o=i.children;o&&o.forEach((t=>{const i=this.graph.createCustomNode(d);this.transform.addChild(i.transform),i.fromDocument(e,t,n)}))}toDocument(e,t,n){n=n||{meta:!0,setup:!0,model:!0,camera:!0,light:!0},e.nodes=e.nodes||[];const i=e.nodes.length,s=this.transform.toData();e.nodes.push(s),t.set(this.transform,`node/${i}`),this.name&&(s.name=this.name),this.model&&n.model&&(s.model=this.model.toDocument(e,s),t.set(this.model,`model/${s.model}`)),this.camera&&n.camera&&(s.camera=this.camera.toDocument(e,s),t.set(this.camera,`camera/${s.camera}`)),this.light&&n.light&&(s.light=this.light.toDocument(e,s),t.set(this.light,`light/${s.light}`)),this.meta&&n.meta&&(s.meta=this.meta.toDocument(e,s),t.set(this.meta,`info/${s.meta}`));const r=this.transform.children.map((e=>e.node)).filter((e=>e.is(d)));return r.forEach((i=>{if(i.hasNodeComponents(n)){const r=i.toDocument(e,t,n);s.children=s.children||[],s.children.push(r)}})),i}hasNodeComponents(e){if(!e)return!0;const t=this.transform,n=this.components;return!(!e.model||!n.has(l.Z)&&!t.hasChildComponents(l.Z,!0))||(!(!e.camera||!n.has(r.Z)&&!t.hasChildComponents(r.Z,!0))||!(!e.light||!n.has(o.f)&&!t.hasChildComponents(o.f,!0)))}}d.typeName="NVNode"},82567:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(75222),s=n(26629),r=n(79815),o=n(84678);class a extends i.Z{get setup(){return this.components.get(r.Z,!0)}createComponents(){this.createComponent(s.Z),this.createComponent(r.Z),this.createComponent(o.Z)}fromDocument(e,t,n){const s=e.scenes[t];s.name&&(this.name=s.name),this.scene.fromDocument(e,s),isFinite(s.meta)&&(this.meta.fromDocument(e,s),n.set(`meta/${s.meta}`,this.meta)),isFinite(s.setup)&&this.setup.fromDocument(e,t,n);const r=s.nodes;if(r&&r.forEach((t=>{const s=this.graph.createCustomNode(i.Z);this.transform.addChild(s.transform),s.fromDocument(e,t,n)})),isFinite(s.setup)){const t=e.setups[s.setup];t.snapshots&&this.setup.snapshots.fromData(t.snapshots,n)}}toDocument(e,t,n){e.scenes=e.scenes||[];const s=e.scenes.length,r={units:"cm"};e.scenes.push(r),this.name&&(r.name=this.name),this.scene.toDocument(e,r);return this.transform.children.map((e=>e.node)).filter((e=>e.is(i.Z))).forEach((i=>{if(i.hasNodeComponents(n)){const s=i.toDocument(e,t,n);r.nodes=r.nodes||[],r.nodes.push(s)}})),n&&!n.setup||(this.meta&&(r.meta=this.meta.toDocument(e,r),t.set(this.meta,`meta/${r.meta}`)),this.setup&&this.setup.toDocument(e,s,t)),s}}a.typeName="NVScene"},1594:(e,t,n)=>{"use strict";var i,s,r;n.d(t,{PD:()=>s,f_:()=>i,k$:()=>o,oS:()=>r}),function(e){e[e.mm=0]="mm",e[e.cm=1]="cm",e[e.m=2]="m",e[e.km=3]="km",e[e.in=4]="in",e[e.ft=5]="ft",e[e.yd=6]="yd",e[e.mi=7]="mi"}(i||(i={})),function(e){e[e.EN=0]="EN",e[e.ES=1]="ES",e[e.DE=2]="DE",e[e.NL=3]="NL",e[e.JA=4]="JA",e[e.FR=5]="FR",e[e.HAW=6]="HAW"}(s||(s={})),function(e){e.EN="English",e.ES="Spanish (Español)",e.DE="German (Deutsch)",e.NL="Dutch (Nederlands)",e.JA="Japanese (日本語)",e.FR="French (Français)",e.HAW="Hawaiian (ʻŌlelo Hawaiʻi)"}(r||(r={}));const o="EN"},43875:(e,t,n)=>{"use strict";n.d(t,{$l:()=>s,_U:()=>i,f_:()=>l.f_,hH:()=>r,id:()=>a,xd:()=>o});var i,s,r,o,a,l=n(1594);!function(e){e[e.Image2D=0]="Image2D",e[e.Web3D=1]="Web3D",e[e.App3D=2]="App3D",e[e.iOSApp3D=3]="iOSApp3D",e[e.Print3D=4]="Print3D",e[e.Editorial3D=5]="Editorial3D"}(i||(i={})),function(e){e[e.Thumb=0]="Thumb",e[e.Low=1]="Low",e[e.Medium=2]="Medium",e[e.High=3]="High",e[e.Highest=4]="Highest",e[e.AR=5]="AR"}(s||(s={})),function(e){e[e.Model=0]="Model",e[e.Geometry=1]="Geometry",e[e.Image=2]="Image",e[e.Texture=3]="Texture",e[e.Points=4]="Points",e[e.Volume=5]="Volume"}(r||(r={})),function(e){e[e.Color=0]="Color",e[e.Emissive=1]="Emissive",e[e.Occlusion=2]="Occlusion",e[e.Normal=3]="Normal",e[e.MetallicRoughness=4]="MetallicRoughness",e[e.Zone=5]="Zone"}(o||(o={})),function(e){e[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double"}(a||(a={}))},60206:(e,t,n)=>{"use strict";var i,s,r,o,a;n.d(t,{fi:()=>a,pH:()=>i,u6:()=>s,we:()=>o}),function(e){e[e.Default=0]="Default",e[e.Clay=1]="Clay",e[e.XRay=2]="XRay",e[e.Normals=3]="Normals",e[e.Wireframe=4]="Wireframe"}(i||(i={})),function(e){e[e.Solid=0]="Solid",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient"}(s||(s={})),function(e){e[e.Orbit=0]="Orbit",e[e.Walk=1]="Walk"}(r||(r={})),function(e){e[e.Overlay=0]="Overlay",e[e.Left=1]="Left",e[e.Right=2]="Right"}(o||(o={})),function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(a||(a={}))},10290:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p,p:()=>h.pH});var i=n(6965),s=n(93113),r=n(75544),o=n(8173),a=n(17393),l=n(19588),c=n(84538),h=n(60206);const d=n(8669).Z,u=n(9849).Z;class p extends i.W{constructor(e){super(),this._clayColor=new s.I("#a67a6c").convertLinearToSRGB(),this._wireColor=new s.I("#004966").convertLinearToSRGB(),this._wireEmissiveColor=new s.I("#004966").convertLinearToSRGB(),this._objectSpaceNormalMap=!1,this._paramCopy={},this._sideCopy=r.Wl3,this.type="UberPBRMaterial",this.isUberPBRMaterial=!0,this.isMeshStandardMaterial=!0,this.isMeshPhysicalMaterial=!1,this.defines={STANDARD:!0,PHYSICAL:!1,OBJECTSPACE_NORMALMAP:!1,MODE_NORMALS:!1,MODE_XRAY:!1,CUT_PLANE:!1,USE_ZONEMAP:!1},this.uniforms=o.rD.merge([a.V.standard.uniforms,{aoMapMix:{value:new l.P(.25,.25,.25)},cutPlaneDirection:{value:new c.L(0,0,-1,0)},cutPlaneColor:{value:new l.P(1,0,0)},zoneMap:{value:null}}]),this._aoMapMix=this.uniforms.aoMapMix.value,this._cutPlaneDirection=this.uniforms.cutPlaneDirection.value,this._cutPlaneColor=this.uniforms.cutPlaneColor.value,this._zoneMap=this.uniforms.zoneMap.value,this.vertexShader=u,this.fragmentShader=d,this.color=new s.I(16777215),this.roughness=.7,this.metalness=0,e&&this.setValues(e)}set cutPlaneDirection(e){this._cutPlaneDirection.copy(e)}get cutPlaneDirection(){return this._cutPlaneDirection}set cutPlaneColor(e){this._cutPlaneColor.copy(e)}get cutPlaneColor(){return this._cutPlaneColor}set aoMapMix(e){this._aoMapMix.copy(e)}get aoMapMix(){return this._aoMapMix}set zoneMap(e){this._zoneMap=e,this.uniforms.zoneMap.value=e,this.needsUpdate=!0}get zoneMap(){return this._zoneMap}setShaderMode(e){switch(Object.assign(this,this._paramCopy),this.defines.MODE_NORMALS=!1,this.defines.MODE_XRAY=!1,this.defines.OBJECTSPACE_NORMALMAP=!(!this.normalMap||!this._objectSpaceNormalMap),this.side=this.defines.CUT_PLANE?r.ehD:this.side,this.needsUpdate=!0,e){case h.pH.Clay:this._paramCopy={color:this.color,map:this.map,roughness:this.roughness,metalness:this.metalness,aoMapIntensity:this.aoMapIntensity,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.color=this._clayColor,this.map=null,this.roughness=1,this.metalness=0,this.aoMapIntensity*=1,this.blending=r.jFi,this.transparent=!1,this.depthWrite=!0;break;case h.pH.Normals:this._paramCopy={blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_NORMALS=!0,this.blending=r.jFi,this.transparent=!1,this.depthWrite=!0;break;case h.pH.XRay:this._paramCopy={side:this.side,blending:this.blending,transparent:this.transparent,depthWrite:this.depthWrite},this.defines.MODE_XRAY=!0,this.side=r.ehD,this.blending=r.WMw,this.transparent=!0,this.depthWrite=!1;break;case h.pH.Wireframe:this._paramCopy={color:this.color,emissive:this.emissive,roughness:this.roughness,metalness:this.metalness,wireframe:this.wireframe,map:this.map,aoMap:this.aoMap,emissiveMap:this.emissiveMap,normalMap:this.normalMap},this.color=this._wireColor,this.emissive=this._wireEmissiveColor,this.roughness=.8,this.metalness=.1,this.wireframe=!0,this.map=null,this.aoMap=null,this.emissiveMap=null,this.normalMap=null,this.defines.OBJECTSPACE_NORMALMAP=!1}}enableCutPlane(e){this.defines.CUT_PLANE=e,e?(this._sideCopy=this.side,this.side=r.ehD):this.side=this._sideCopy}enableObjectSpaceNormalMap(e){e!==this._objectSpaceNormalMap&&(this._objectSpaceNormalMap=e),this.normalMap&&(this.normalMapType=r.PA7,this.needsUpdate=!0)}enableZoneMap(e){this.defines.USE_ZONEMAP=e}}},97010:(e,t,n)=>{"use strict";var i=n(51120),s=(n(98595),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});let r=class extends i.ZP{constructor(){super(...arguments),this.property=null,this.name="",this.text=null,this.language=null,this.disabled=!1,this.customLabelStyle=""}firstConnected(){this.classList.add("sv-property","sv-property-boolean")}update(e){if(!this.property)throw new Error("missing property attribute");if("boolean"!==this.property.type)throw new Error("not a boolean property");if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=t.replace(/\s/g,""),s=this.text,r=this.language,o=this.customLabelStyle;let a=e.value?Array.isArray(s)?s[1]:s||"On":Array.isArray(s)?s[0]:s||"Off";return i.dy` +
`}onButtonClick(e){this.property.setValue(!this.property.value)}};s([(0,i.Cb)({attribute:!1})],r.prototype,"property",void 0),s([(0,i.Cb)({type:String})],r.prototype,"name",void 0),s([(0,i.Cb)({attribute:!1})],r.prototype,"text",void 0),s([(0,i.Cb)({attribute:!1})],r.prototype,"language",void 0),s([(0,i.Cb)({type:Boolean})],r.prototype,"disabled",void 0),s([(0,i.Cb)({type:String})],r.prototype,"customLabelStyle",void 0),r=s([(0,i.Mo)("sv-property-boolean")],r)},46436:(e,t,n)=>{"use strict";var i=n(47855),s=n(51120),r=(n(98595),n(34834),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});let o=class extends s.ZP{constructor(){super(),this.property=null,this.name="",this.color=new i.ZP}firstConnected(){super.firstConnected(),this.classList.add("sv-property","sv-property-color")}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type||3!==this.property.elementCount)throw new Error(`not an color property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onPropertyChange,this),this.property&&(this.property.on("value",this.onPropertyChange,this),this.color.fromArray(this.property.value))}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=this.color.toString();return s.dy` + + `}onColorChange(e){this.color=new i.ZP(e.target.value),this.property.setValue(this.color.toRGBArray())}onPropertyChange(e){this.color.fromArray(e),this.requestUpdate()}};r([(0,s.Cb)({attribute:!1})],o.prototype,"property",void 0),r([(0,s.Cb)({type:String})],o.prototype,"name",void 0),o=r([(0,s.Mo)("sv-property-color")],o)},85203:(e,t,n)=>{"use strict";var i=n(51120),s=(n(98595),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});let r=class extends i.ZP{constructor(){super(...arguments),this.property=null,this.name="",this.text="",this.icon=""}firstConnected(){this.classList.add("sv-property","sv-property-event")}update(e){if(!this.property)throw new Error("missing property attribute");if(!this.property.schema.event)throw new Error(`not an event property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=this.text,s=this.icon;return i.dy` +
+ +
`}onButtonClick(e){this.property.set()}};s([(0,i.Cb)({attribute:!1})],r.prototype,"property",void 0),s([(0,i.Cb)({type:String})],r.prototype,"name",void 0),s([(0,i.Cb)({type:String})],r.prototype,"text",void 0),s([(0,i.Cb)({type:String})],r.prototype,"icon",void 0),r=s([(0,i.Mo)("sv-property-event")],r)},18257:(e,t,n)=>{"use strict";var i=n(53868);const s=(0,i.XM)((e=>t=>{let n;if(t instanceof i.K1||t instanceof i.nt)throw new Error("The `live` directive is not allowed on text or event bindings");if(t instanceof i.JG)r(t.strings),n=t.element.hasAttribute(t.name),t.value=n;else{const{element:s,name:o,strings:a}=t.committer;if(r(a),t instanceof i.sL){if(n=s[o],n===e)return}else t instanceof i._l&&(n=s.getAttribute(o));if(n===String(e))return}t.setValue(e)})),r=e=>{if(2!==e.length||""!==e[0]||""!==e[1])throw new Error("`live` bindings can only contain a single expression")};var o=n(51120),a=(n(98595),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});let l=class extends o.ZP{constructor(){super(...arguments),this.property=null,this.name="",this.options=null,this.indexMap=null,this.language=null,this.dropdown=!1}firstConnected(){this.classList.add("sv-property","sv-property-options")}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type||!this.property.schema.options)throw new Error("not an options property");if(e.has("property")){const t=e.get("property");t&&(t.off("value",this.onUpdate,this),t.off("change",this.onUpdate,this)),this.property&&(this.property.on("value",this.onUpdate,this),this.property.on("change",this.onUpdate,this))}super.update(e)}render(){return this.dropdown?this.renderDropdown():this.renderButtons()}renderDropdown(){const e=this.property,t=this.indexMap,n=this.name||e.name,i=this.options||e.schema.options,r=e.value,a=this.language;let l;return l=t?t.map((e=>o.dy``)):i.map(((e,t)=>e?o.dy``:null)),o.dy` + + + `}renderButtons(){const e=this.property,t=this.indexMap,n=this.name||e.name,i=this.options||e.schema.options,s=(e.value,this.language);let r;return r=t?t.map((e=>o.dy` + `)):i.map(((e,t)=>e?o.dy` + `:null)),o.dy` + +
this.onKeyDown(e)} title=${n} class="sv-options"> + ${r} +
`}isSelected(e){return this.property.isMulti()?this.property.value.includes(e):this.property.value==e}onButtonClick(e){const t=e.target.index;if(this.property.isMulti()){let e=this.property.value.slice();-1!==e.indexOf(t)?e=e.filter((e=>e!==t)):e.push(t),this.property.setValue(e)}else this.property.setValue(t)}onKeyDown(e){if("ArrowUp"===e.code||"ArrowLeft"===e.code){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).findIndex((t=>e.target===t));n>0&&(t[n].setAttribute("tabIndex","-1"),t[n-1].setAttribute("tabIndex","0"),t[n-1].focus())}else if("ArrowDown"===e.code||"ArrowRight"===e.code){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).findIndex((t=>e.target===t));n0===e.tabIndex)),0)].focus()}tabReset(e){const t=this.getElementsByTagName("ff-button"),n=Array.from(t),i=n.findIndex((e=>0===e.tabIndex)),s=n.findIndex((e=>"true"===e.getAttribute("aria-checked")));if(i!=s){t[i].setAttribute("tabIndex","-1");t[s>-1?s:0].setAttribute("tabIndex","0")}}};a([(0,o.Cb)({attribute:!1})],l.prototype,"property",void 0),a([(0,o.Cb)({type:String})],l.prototype,"name",void 0),a([(0,o.Cb)({attribute:!1})],l.prototype,"options",void 0),a([(0,o.Cb)({attribute:!1})],l.prototype,"indexMap",void 0),a([(0,o.Cb)({attribute:!1})],l.prototype,"language",void 0),a([(0,o.Cb)({type:Boolean,reflect:!0})],l.prototype,"dropdown",void 0),l=a([(0,o.Mo)("sv-property-options")],l)},90470:(e,t,n)=>{"use strict";var i=n(51120),s=(n(61497),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});let r=class extends i.ZP{constructor(){super(...arguments),this.property=null,this.name="",this.min=void 0,this.max=void 0}firstConnected(){super.firstConnected(),this.classList.add("sv-property","sv-property-slider")}update(e){if(!this.property)throw new Error("missing property attribute");if("number"!==this.property.type)throw new Error(`not a number property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=e.getValidatedValue(),s=isFinite(this.min)?this.min:e.schema.min,r=isFinite(this.max)?this.max:e.schema.max,o=(n-s)/(r-s);return i.dy` + `}onSliderChange(e){const t=this.property,n=isFinite(this.min)?this.min:t.schema.min,i=isFinite(this.max)?this.max:t.schema.max,s=n+e.detail.value*(i-n);t.setValue(s)}onKeyDown(e){const t=this.property;"ArrowRight"===e.code||"ArrowUp"===e.code||"PageUp"===e.code?t.setValue(this.clamp("PageUp"===e.code?t.value+.1:t.value+.01)):"ArrowLeft"!==e.code&&"ArrowDown"!==e.code&&"PageDown"!==e.code||t.setValue(this.clamp("PageDown"===e.code?t.value-.1:t.value-.01))}clamp(e){const t=this.property,n=isFinite(this.min)?this.min:t.schema.min,i=isFinite(this.max)?this.max:t.schema.max;return Math.min(Math.max(e,n),i)}};s([(0,i.Cb)({attribute:!1})],r.prototype,"property",void 0),s([(0,i.Cb)({type:String})],r.prototype,"name",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"min",void 0),s([(0,i.Cb)({type:Number})],r.prototype,"max",void 0),r=s([(0,i.Mo)("sv-property-slider")],r)},77804:(e,t,n)=>{"use strict";var i=n(51120),s=(n(98595),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});let r=class extends i.ZP{constructor(){super(...arguments),this.property=null,this.name="",this.onChange=e=>{const t=e.target.value;this.property.setValue(t)}}firstConnected(){this.classList.add("sv-property","sv-property-string")}update(e){if(!this.property)throw new Error("missing property attribute");if("string"!==this.property.type)throw new Error(`not a string property: '${this.property.path}'`);if(e.has("property")){const t=e.get("property");t&&t.off("value",this.onUpdate,this),this.property&&this.property.on("value",this.onUpdate,this)}super.update(e)}render(){const e=this.property,t=this.name||e.name,n=e.value;return i.dy`${t?i.dy``:null} + {e.target.select()}}} + @keypress=${e=>{"Enter"===e.key&&e.target.blur()}} + > + `}};s([(0,i.Cb)({attribute:!1})],r.prototype,"property",void 0),s([(0,i.Cb)({type:String})],r.prototype,"name",void 0),r=s([(0,i.Mo)("sv-property-string")],r)},47425:(e,t,n)=>{"use strict";n.d(t,{Mo:()=>i.Mo,ZP:()=>o,dy:()=>i.dy});var i=n(51120),s=n(67695),r=n(25864);class o extends s.ZP{constructor(){super(...arguments),this.activeDocument=null}get documentProvider(){return this.system.getMainComponent(r.Z)}connected(){const e=this.documentProvider;e.on("active-component",this.onActiveDocumentEvent,this);const t=e.activeComponent;t&&(this.activeDocument=t,this.onActiveDocument(null,t))}disconnected(){this.documentProvider.off("active-component",this.onActiveDocumentEvent,this);const e=this.activeDocument;e&&(this.activeDocument=null,this.onActiveDocument(e,null))}onActiveDocument(e,t){}onActiveDocumentEvent(e){this.activeDocument=e.next,this.onActiveDocument(e.previous,e.next)}}},94860:(e,t,n)=>{"use strict";n.d(t,{Z:()=>qe});var i=n(38080),s=n(30242),r=n(27643),o=n(51120),a=n(1239),l=n(10564),c=n(13772),h=n(25976),d=n(60206),u=n(11359),p=n(63872);class m{constructor(e){this.next=null,this.activePositions=[],this.activeType="",this.centerX=0,this.centerY=0,this.startX=0,this.startY=0,this.isDragging=!1,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUpOrCancel=this.onPointerUpOrCancel.bind(this),this.onDoubleClick=this.onDoubleClick.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onWheel=this.onWheel.bind(this),this.onKeyDown=this.onKeyDown.bind(this),e&&(e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUpOrCancel),e.addEventListener("pointercancel",this.onPointerUpOrCancel),e.addEventListener("contextmenu",this.onContextMenu),e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown))}onPointerDown(e){if(this.activeType&&e.pointerType!==this.activeType)return;0===this.activePositions.length&&(this.startX=e.clientX,this.startY=e.clientY,this.isDragging=!1),this.activeType=e.pointerType,this.activePositions.push({id:e.pointerId,clientX:e.clientX,clientY:e.clientY});const t=this.createManipPointerEvent(e,"pointer-down");this.sendPointerEvent(t)&&e.stopPropagation()}onPointerMove(e){const t=this.activePositions;for(let n=0,i=t.length;n0&&!this.isDragging){Math.abs(e.clientX-this.startX)+Math.abs(e.clientY-this.startY)>4&&(this.isDragging=!0)}const n=t.length?"pointer-move":"pointer-hover",i=this.createManipPointerEvent(e,n);this.sendPointerEvent(i)&&e.stopPropagation()}onPointerUpOrCancel(e){const t=this.activePositions;let n=!1;for(let i=0,s=t.length;i0){for(let e=0;e=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});!function(e){e[e.Single=0]="Single",e[e.HorizontalSplit=1]="HorizontalSplit",e[e.VerticalSplit=2]="VerticalSplit",e[e.Quad=3]="Quad"}(f||(f={}));let b=class extends o.ZP{constructor(){super(...arguments),this.layout=f.Single,this.horizontalPosition=.5,this.verticalPosition=.5}firstConnected(){this.classList.add("ff-quad-splitter")}render(){const e=this.layout;if(e===f.Single)return o.dy``;const t=[];return e!==f.HorizontalSplit&&e!==f.Quad||t.push(o.dy` +
+
+ +
+
+ `),e!==f.VerticalSplit&&e!==f.Quad||t.push(o.dy` +
+
+ +
+
+ `),o.dy`${t}`}onSplitterChange(e){"horizontal"===e.detail.direction?this.horizontalPosition=e.detail.position:this.verticalPosition=e.detail.position,this.onChange&&this.onChange({layout:this.layout,horizontalSplit:this.horizontalPosition,verticalSplit:this.verticalPosition,isDragging:e.detail.isDragging})}};y([(0,o.Cb)({attribute:!1})],b.prototype,"layout",void 0),y([(0,o.Cb)({attribute:!1})],b.prototype,"horizontalPosition",void 0),y([(0,o.Cb)({attribute:!1})],b.prototype,"verticalPosition",void 0),b=y([(0,o.Mo)("ff-quad-splitter")],b);const _=b;var x=n(25864),w=n(44661),S=n(79815),M=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let E=class extends v.ZP{constructor(e){super(e),this.view=null,this.canvas=null,this.overlay=null,this.srAnnouncement=null,this.splitter=null,this.resizeObserver=null,this.pointerEventsEnabled=!1,this.measuring=!1,this.onPointerUpOrCancel=this.onPointerUpOrCancel.bind(this),this.manipTarget=new m,this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointermove",this.manipTarget.onPointerMove),this.addEventListener("pointerup",this.onPointerUpOrCancel),this.addEventListener("pointercancel",this.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.addEventListener("pointerup",this.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointercancel",this.onPointerUpOrCancel),this.addEventListener("wheel",this.manipTarget.onWheel),this.addEventListener("contextmenu",this.manipTarget.onContextMenu),this.addEventListener("keydown",this.manipTarget.onKeyDown),this.pointerEventsEnabled=!0}getView(){return this.view}firstConnected(){this.classList.add("sv-scene-view"),this.style.touchAction="none",this.setAttribute("touch-action","none"),this.tabIndex=0,this.id="sv-scene",this.ariaLabel="Interactive 3D Model. Use mouse, touch, or arrow keys to rotate.",this.setAttribute("role","application"),this.srAnnouncement=this.appendElement("div"),this.srAnnouncement.classList.add("sr-only"),this.srAnnouncement.setAttribute("aria-live","polite"),this.canvas=this.appendElement("canvas",{display:"block",width:"100%",height:"100%"}),this.overlay=this.appendElement("div",{position:"absolute",top:"0",bottom:"0",left:"0",right:"0",overflow:"hidden"}),this.overlay.classList.add("sv-content-overlay"),this.splitter=this.appendElement(_,{position:"absolute",top:"0",bottom:"0",left:"0",right:"0",overflow:"hidden"}),this.splitter.onChange=e=>{this.view.horizontalSplit=e.horizontalSplit,this.view.verticalSplit=e.verticalSplit},this.view=new g.Z(this.system,this.canvas,this.overlay),this.view.on("layout",(e=>{this.splitter.layout=e.layout,this.dispatchEvent(new CustomEvent("layout"))})),this.view.layout=f.Single,this.splitter.layout=f.Single,this.manipTarget.next=this.view}connected(){this.view.attach(),this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>this.view.resize()))),this.resizeObserver.observe(this.view.renderer.domElement),this.system.getMainComponent(x.Z).activeComponent.setup.navigation.ins.pointerEnabled.on("value",this.enablePointerEvents,this),this.system.getComponent(w.ZP).ins.keyNavActive.on("value",this.onKeyboardNavigation,this),this.system.getComponent(S.Z).tape.ins.enabled.on("value",this.onMeasure,this)}disconnected(){this.resizeObserver.disconnect(),this.system.getComponent(S.Z).tape.ins.enabled.off("value",this.onMeasure,this),this.system.getComponent(w.ZP).ins.keyNavActive.off("value",this.onKeyboardNavigation,this),this.system.getMainComponent(x.Z).activeComponent.setup.navigation.ins.pointerEnabled.off("value",this.enablePointerEvents,this),this.view.detach()}enablePointerEvents(){const e=this.system.getMainComponent(x.Z).activeComponent.setup.navigation.ins.pointerEnabled.value;e&&!this.pointerEventsEnabled?(this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointermove",this.manipTarget.onPointerMove),this.addEventListener("pointerup",this.onPointerUpOrCancel),this.addEventListener("pointercancel",this.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.addEventListener("pointerup",this.onPointerUpOrCancel),this.ownerDocument.addEventListener("pointercancel",this.onPointerUpOrCancel),this.addEventListener("wheel",this.manipTarget.onWheel),this.addEventListener("contextmenu",this.manipTarget.onContextMenu),this.addEventListener("keydown",this.manipTarget.onKeyDown),this.style.touchAction="none",this.setAttribute("touch-action","none"),this.pointerEventsEnabled=!0):!e&&this.pointerEventsEnabled&&(this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointermove",this.manipTarget.onPointerMove),this.removeEventListener("pointerup",this.onPointerUpOrCancel),this.removeEventListener("pointercancel",this.onPointerUpOrCancel),this.ownerDocument.removeEventListener("pointermove",this.manipTarget.onPointerMove),this.ownerDocument.removeEventListener("pointerup",this.onPointerUpOrCancel),this.ownerDocument.removeEventListener("pointercancel",this.onPointerUpOrCancel),this.removeEventListener("wheel",this.manipTarget.onWheel),this.removeEventListener("contextmenu",this.manipTarget.onContextMenu),this.removeEventListener("keydown",this.manipTarget.onKeyDown),this.style.touchAction="auto",this.setAttribute("touch-action","auto"),this.pointerEventsEnabled=!1,this.style.cursor="default")}onPointerDown(e){this.pointerEventsEnabled&&(this.style.cursor="default"==this.style.cursor?"default":"grabbing",this.manipTarget.onPointerDown(e))}onPointerUpOrCancel(e){this.pointerEventsEnabled&&(this.style.cursor="default"==this.style.cursor?"default":"grab",this.manipTarget.onPointerUpOrCancel(e))}onKeyboardNavigation(){const e=this.system.getComponent(w.ZP).ins;switch(e.keyNavActive.value){case w.dT.Orbit:this.srAnnouncement.textContent="Orbit "+e.orbit.value[0].toFixed(0)+", "+e.orbit.value[1].toFixed(0)+", "+e.orbit.value[2].toFixed(0);break;case w.dT.Pan:case w.dT.Zoom:this.srAnnouncement.textContent="Offset "+e.offset.value[0].toFixed(0)+", "+e.offset.value[1].toFixed(0)+", "+e.offset.value[2].toFixed(0)}}onMeasure(){this.measuring=this.system.getComponent(S.Z).tape.ins.enabled.value,this.style.cursor=this.measuring?"default":"grab"}};E=M([(0,v.Mo)("sv-scene-view")],E);const T=E;var C,A=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let P=C=class extends o.ZP{constructor(){super(...arguments),this.visible=!1,this.assetPath=""}firstConnected(){super.firstConnected(),this.classList.add("sv-spinner")}render(){const e=o.dy`
+ ${C.template} +
`;return this.style.visibility=this.visible?"visible":"hidden",e}};P.template=o.dy`
`,A([(0,o.Cb)({type:Boolean})],P.prototype,"visible",void 0),A([(0,o.Cb)({type:String})],P.prototype,"assetPath",void 0),P=C=A([(0,o.Mo)("sv-spinner")],P);var R,L=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let N=R=class extends o.ZP{firstConnected(){super.firstConnected(),this.classList.add("sv-action-prompt")}render(){return o.dy`
${R.icon}
`}};N.icon=o.dy``,N=R=L([(0,o.Mo)("sv-action-prompt")],N);var D=n(98595),I=n(47425),O=n(53310),U=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let k=class extends I.ZP{constructor(){super(...arguments),this.reader=null,this.tours=null,this.language=null,this.firstRender=!0}firstConnected(){super.firstConnected(),this.classList.add("sv-reader-view")}renderMenuEntry(e,t){const n=e.article;return I.dy`
this.onKeyDown(e,n.id)} class="sv-entry" @click=${e=>this.onClickArticle(e,n.id)}> +
+

${n.title}

+ +
+

${n.lead}

+
`}render(){const e=this.reader,t=this.language;this.tours;if(!e)return I.dy`
Please select a document to display its articles.
`;const n=this.tours.ins.enabled.value?null:I.dy``;if(!e.activeArticle){const n=e.articles;return I.dy`
+ + ${n.map(((e,t)=>this.renderMenuEntry(e,t)))} +
`}return I.dy`
this.onKeyDown(t,e.activeArticle.id)} > + + ${n} +
+
`}onClickMenu(e){e.stopPropagation(),this.reader.ins.articleId.setValue(""),this.reader.ins.focus.setValue(!0)}onClickClose(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("close"))}onClickArticle(e,t){this.reader.ins.articleId.setValue(t)}updated(e){super.updated(e);const t=this.reader;if(t){if(t.activeArticle){const e=this.getElementsByClassName("sv-container").item(0);e.innerHTML=t.outs.content.value,this.firstRender&&(setTimeout((()=>{e.insertAdjacentHTML("beforeend","
-end of article-
")}),200),this.firstRender=!1)}t.ins.focus.value&&(this.setFocus(),t.ins.focus.setValue(!1,!0))}}onActiveDocument(e,t){e&&(e.setup.language.outs.language.off("value",this.onUpdate,this),this.reader.outs.content.off("value",this.onUpdate,this),this.reader.outs.article.off("value",this.onUpdate,this),this.tours=null,this.language=null,this.reader=null),t&&(this.reader=t.setup.reader,this.language=t.setup.language,this.tours=t.setup.tours,this.reader.outs.content.on("value",this.onUpdate,this),this.reader.outs.article.on("value",this.onUpdate,this),t.setup.language.outs.language.on("value",this.onUpdate,this))}onKeyDown(e,t){const n=this.reader;if("Space"!==e.code&&"Enter"!==e.code||!n||n.activeArticle){if("Escape"===e.code)e.preventDefault(),n.activeArticle?(n.ins.articleId.setValue(""),n.ins.focus.setValue(!0)):this.dispatchEvent(new CustomEvent("close"));else if("Tab"===e.code)(0,O.e)((0,O.G)(this),e);else if(("ArrowUp"===e.code||"ArrowDown"===e.code)&&n&&!n.activeArticle){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}}else e.preventDefault(),this.reader.ins.articleId.setValue(t),this.reader.ins.focus.setValue(!0)}setFocus(){(this.reader.activeArticle?this.getElementsByClassName("sv-nav-button").item(1):this.getElementsByClassName("sv-entry").item(0)).focus()}};k=U([(0,I.Mo)("sv-reader-view")],k);var V=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let z=class extends I.ZP{constructor(){super(...arguments),this.audioManager=null,this.documentProps=new h.Z("value",this.onUpdate,this)}firstConnected(){super.firstConnected(),this.classList.add("sv-caption-view")}render(){const e=this.audioManager,t=e.ins.activeCaption.value,n=e.ins.captionsEnabled.value;return t.length>0&&n?I.dy`
${t}
`:null}onActiveDocument(e,t){if(e&&this.documentProps.off(),t){const e=t.setup;this.audioManager=t.setup.audio,this.documentProps.on(e.audio.ins.captionsEnabled,e.audio.ins.activeCaption)}this.requestUpdate()}};z=V([(0,I.Mo)("sv-caption-view")],z);const F=z;var B=n(15271),$=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let j=class extends I.ZP{get arManager(){return this.system.getMainComponent(s.Z)}firstConnected(){super.firstConnected()}render(){const e=this.arManager,t=e.outs,n=!0===e.ins.wallMount.value?"a wall":"the floor";return!t.isPlaced.value&&t.isPresenting.value?I.dy`
+
+
+ Point your device at ${n} and move it around to place your Smithsonian object!

**BETA** +
+
`:null}onActiveDocument(e,t){e&&(this.arManager.outs.isPlaced.off("value",this.onUpdate,this),this.arManager.outs.isPresenting.off("value",this.onUpdate,this)),t&&(this.arManager.outs.isPlaced.on("value",this.onUpdate,this),this.arManager.outs.isPresenting.on("value",this.onUpdate,this)),this.requestUpdate()}};j=$([(0,I.Mo)("sv-ar-prompt-container")],j);const H=j;var G=n(51462),Z=n(26629),W=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let q=class extends I.ZP{constructor(){super(...arguments),this.documentProps=new h.Z("value",this.onUpdate,this),this.shareButtonSelected=!1}get analytics(){return this.system.getMainComponent(u.Z)}get arManager(){return this.system.getMainComponent(s.Z)}get sceneNode(){return this.system.getComponent(Z.Z)}firstConnected(){super.firstConnected(),this.classList.add("sv-ar-menu-container")}connected(){super.connected()}disconnected(){super.disconnected()}render(){const e=this.activeDocument;if(!e)return I.dy``;const t=this.arManager.outs,n=e.setup,i=this.sceneNode.getGraphComponents(G.Z).some((e=>e.hasAnnotations)),s=n.viewer.ins.annotationsVisible.value,r=n.audio.outs.narrationEnabled.value,o=n.audio.outs.narrationPlaying.value;return t.isPlaced.value&&t.isPresenting.value?I.dy`
+ ${i?I.dy``:null} + ${r?I.dy``:null} +
`:null}onToggleReader(){const e=this.activeDocument.setup.reader.ins;e.enabled.setValue(!e.enabled.value),this.analytics.sendProperty("Reader_Enabled",e.enabled.value)}onToggleNarration(){const e=this.activeDocument.setup.audio;e.setupAudio(),e.ins.playNarration.set()}onToggleAnnotations(){const e=this.activeDocument.setup.viewer.ins;e.annotationsVisible.setValue(!e.annotationsVisible.value),this.analytics.sendProperty("Annotations_Visible",e.annotationsVisible.value)}onActiveDocument(e,t){if(e&&(this.documentProps.off(),this.arManager.outs.isPlaced.off("value",this.onUpdate,this),this.arManager.outs.isPresenting.off("value",this.onUpdate,this)),t){const e=t.setup;this.documentProps.on(e.viewer.ins.annotationsVisible,e.audio.outs.narrationPlaying),this.arManager.outs.isPlaced.on("value",this.onUpdate,this),this.arManager.outs.isPresenting.on("value",this.onUpdate,this)}this.requestUpdate()}};q=W([(0,I.Mo)("sv-ar-menu")],q);const X=q;var Y=n(68327),K=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let J=class extends I.ZP{constructor(){super(...arguments),this.sceneView=null,this.captionView=null,this.documentProps=new h.Z("value",this.onUpdate,this),this.isMobile=null,this.assetPath=""}get analytics(){return this.system.getMainComponent(u.Z)}get assetManager(){return this.system.getMainComponent(p.Z)}get reader(){return this.activeDocument?this.activeDocument.setup.reader:null}get tours(){return this.activeDocument?this.activeDocument.setup.tours:null}get navigation(){return this.activeDocument?this.activeDocument.setup.navigation:null}get renderer(){return this.system.getMainComponent(B.Z)}get arManager(){return this.system.getMainComponent(s.Z)}get assetReader(){return this.system.getMainComponent(Y.Z)}firstConnected(){this.classList.add("sv-content-view"),this.sceneView=new T(this.system),this.captionView=new F(this.system),this.isMobile=this.mobileCheck()}connected(){super.connected(),this.assetManager.outs.busy.on("value",this.onUpdate,this),this.sceneView.on("layout",(()=>this.onUpdate())),this.assetPath=this.assetReader.getSystemAssetUrl("")}disconnected(){this.sceneView.off("layout",(()=>this.onUpdate())),this.assetManager.outs.busy.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.system,t=this.assetManager.outs.busy.value,n=this.assetManager.initialLoad;let i=!1,s=d.we.Overlay,r=!1,o=!1;const a=this.reader,l=this.tours,c=this.navigation,h=this.arManager.shadowRoot.querySelector("ff-viewport-overlay");if(h&&(null===this.arManager.shadowRoot.querySelector("sv-ar-prompt-container")&&h.append(new H(this.system)),null===this.arManager.shadowRoot.querySelector("sv-ar-menu")&&h.append(new X(this.system))),l&&(r=l.ins.enabled.value&&-1===l.outs.tourIndex.value),a&&(i=!r&&a.ins.enabled.value&&a.ins.visible.value,s=a.ins.position.value,!0===this.isMobile&&(s=d.we.Overlay)),c){const e=c.ins.pointerEnabled.value,s=c.ins.promptEnabled.value;if(e&&s){const e=c.ins.isInUse.value;o=!t&&n&&!e&&!i,c.ins.promptActive.setValue(o)}}const u=this.sceneView,p=this.captionView;if((i&&s===d.we.Overlay||r)&&this.sceneView.getView().layout==g.t.Single?u.classList.contains("sv-blur")||setTimeout((()=>{u.classList.add("sv-blur"),this.renderer.views[0].render()}),1):u.classList.remove("sv-blur"),!t&&n&&(this.analytics.sendProperty("Loading_Time",this.analytics.getTimerTime()/1e3),this.analytics.resetTimer(),this.assetManager.initialLoad=!1),i){if(s===d.we.Right)return I.dy`
+
+ ${u} +
+ +
+
+ +
+
+
+ + ${p}`;if(s===d.we.Overlay)return I.dy`
${u} +
+ +
+ + ${p} +
`}return I.dy`
${u}
+ + ${p} + ${o?I.dy``:null}`}onReaderClose(){this.reader.ins.enabled.setValue(!1),this.reader.ins.closed.set()}onActiveDocument(e,t){e&&this.documentProps.off(),t&&this.documentProps.on(t.setup.reader.ins.position,t.setup.reader.ins.enabled,t.setup.tours.outs.tourIndex,t.setup.navigation.ins.isInUse),this.requestUpdate()}mobileCheck(){var e,t=!1;return e=navigator.userAgent||navigator.vendor,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t}};J=K([(0,I.Mo)("sv-content-view")],J);const Q=J;var ee=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let te=class extends o.ZP{constructor(){super(),this.mode="radio",this.selectionIndex=-1,this.observer=new MutationObserver(this.onObserver),this.selectedButton=null,this.addEventListener("click",(e=>this.onClick(e)))}firstConnected(){this.classList.add("ff-button-group"),this.parseChildren()}connected(){this.observer.observe(this,{childList:!0})}disconnected(){this.observer.disconnect()}onObserver(e){e.forEach((e=>{"childList"===e.type&&this.parseChildren()}))}onClick(e){let t=e.target;for(;t&&t!==this&&!(t instanceof D.Z);)t=t.parentElement;t instanceof D.Z&&(t.selected?"exclusive"===this.mode&&(t.selected=!1,this.selectedButton=null,this.selectionIndex=-1):(this.selectedButton&&(this.selectedButton.selected=!1),this.selectedButton=t,this.selectedButton.selected=!0,this.selectionIndex=this.getButtons().indexOf(t)))}parseChildren(){const e=this.getButtons();this.selectedButton&&(this.selectionIndex=e.indexOf(this.selectedButton),this.selectionIndex<0&&(this.selectedButton.selected=!1,this.selectedButton=null)),(this.selectionIndex<0||this.selectionIndex>=e.length)&&(this.selectionIndex="radio"===this.mode?0:-1),this.selectionIndex>=0&&(this.selectedButton=e[this.selectionIndex],this.selectedButton.selected=!0)}getButtons(){return this.getChildrenArray().filter((e=>e instanceof D.Z))}};ee([(0,o.Cb)({type:String})],te.prototype,"mode",void 0),ee([(0,o.Cb)({type:Number})],te.prototype,"selectionIndex",void 0),te=ee([(0,o.Mo)("ff-button-group")],te);var ne,ie=n(22040),se=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let re=ne=class extends o.ZP{constructor(){super(...arguments),this.assetPath=""}firstConnected(){super.firstConnected(),this.classList.add("sv-logo")}render(){const e=o.dy`
+ ${ne.defaultSmall} +
`,t=o.dy`
+ ${ne.defaultFull} +
`;return o.dy`
${e}
${t}
`}};re.defaultSmall=o.dy`voyager-75grey`,re.defaultFull=o.dy`voyager-75grey`,se([(0,o.Cb)({type:String})],re.prototype,"assetPath",void 0),re=ne=se([(0,o.Mo)("sv-logo")],re);var oe,ae=n(3388),le=n(43875),ce=n(34287),he=(n(13470),function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o});let de=oe=class extends ce.ZP{constructor(e){super(),this.language=null,this.needsFocus=!1,this.language=e,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t){const n=new oe(t);return e.appendChild(n),new Promise(((e,t)=>{n.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-share-menu"),this.needsFocus=!0}render(){const e=encodeURIComponent(this.url),t=encodeURI("Check out this interactive 3D model with Smithsonian Voyager:"),n=this.language,i=`http://twitter.com/share?text=${t}&url=${e}`,s=`https://www.facebook.com/sharer/sharer.php?u=${e}`,r=`https://www.linkedin.com/shareArticle?url=${e}&mini=true&title=${t}`,o=``,a=`mailto:?subject=${t}&body=${e}`,l=n.getLocalizedString("Share Experience");return ce.dy` +
this.onKeyDown(e)}> +
+
${l}
+ +
+
+ + + + +
+
${n.getLocalizedString("Embed Link")}
+ +
+ `}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-share-button-twitter").item(0).focus(),this.needsFocus=!1}}onClickCopy(){this.getElementsByTagName("ff-text-edit").item(0).select(),document.execCommand("copy")}onKeyDown(e){"Escape"===e.code?(e.preventDefault(),this.close()):"Tab"===e.code&&(0,O.e)((0,O.G)(this),e)}};de=oe=he([(0,ce.Mo)("sv-share-menu")],de);const ue=de;var pe,me=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let fe=pe=class extends ce.ZP{constructor(e,t){super(),this.language=null,this.imageUri=null,this.needsFocus=!1,this.language=e,this.imageUri=t,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t,n){const i=new pe(t,n);return e.appendChild(i),new Promise(((e,t)=>{i.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-ar-code"),this.needsFocus=!0}render(){const e=this.language,t=e.getLocalizedString("AR Experience");return ce.dy` +
this.onKeyDown(e)}> +
+
${t}
+ +
+
${e.getLocalizedString("1. Scan the code with your mobile device to return here.")}
+
+ +
+
${e.getLocalizedString("2. Tap ")}${e.getLocalizedString(" to launch an AR experience! ")}
+
+ `}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("ff-close-button").item(0).focus(),this.needsFocus=!1}}onKeyDown(e){"Escape"===e.code?(e.preventDefault(),this.close()):"Tab"===e.code&&(0,O.e)((0,O.G)(this),e)}};fe=pe=me([(0,ce.Mo)("sv-ar-code")],fe);const ge=fe;var ve=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let ye=class extends I.ZP{constructor(){super(...arguments),this.documentProps=new h.Z("value",this.onUpdate,this),this.shareButtonSelected=!1,this.resizeObserver=null,this.isClipped=!1}get fullscreen(){return this.system.getMainComponent(i.Z)}get toolProvider(){return this.system.getMainComponent(ie.Z)}get analytics(){return this.system.getMainComponent(u.Z)}get arManager(){return this.system.getMainComponent(s.Z)}get sceneNode(){return this.system.getComponent(Z.Z)}firstConnected(){super.firstConnected(),this.classList.add("sv-main-menu")}connected(){super.connected(),this.fullscreen.outs.fullscreenActive.on("value",this.onUpdate,this),this.toolProvider.ins.visible.on("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.on("value",this.onUpdate,this),this.activeDocument.setup.audio.outs.narrationEnabled.on("value",this.onUpdate,this),this.activeDocument.setup.tours.ins.closed.on("value",this.setTourFocus,this),this.activeDocument.setup.reader.ins.closed.on("value",this.setReaderFocus,this),this.toolProvider.ins.closed.on("value",this.setToolsFocus,this),this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>this.onResize()))),this.resizeObserver.observe(this)}disconnected(){this.resizeObserver.disconnect(),this.toolProvider.ins.closed.off("value",this.setToolsFocus,this),this.activeDocument.setup.reader.ins.closed.off("value",this.setReaderFocus,this),this.activeDocument.setup.tours.ins.closed.off("value",this.setTourFocus,this),this.activeDocument.setup.audio.outs.narrationEnabled.off("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.ins.visible.off("value",this.onUpdate,this),this.fullscreen.outs.fullscreenActive.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.activeDocument;if(!e)return I.dy``;const t=!!this.system.getComponent("CVStoryApplication",!0),n=e.setup,i=this.sceneNode,s=n.tours.outs.count.value>0,r=n.tours.ins.enabled.value,o=r&&!t,a=n.reader.articles.length>0,l=n.reader.ins.enabled.value,c=i.getGraphComponents(G.Z).some((e=>e.hasAnnotations)),h=n.viewer.ins.annotationsVisible.value,d=this.fullscreen,u=d.outs.fullscreenAvailable.value,p=d.outs.fullscreenActive.value,m=n.interface.ins.tools.value,f=this.toolProvider.ins.visible.value,g=n.audio.outs.narrationEnabled.value,v=n.audio.outs.narrationPlaying.value,y=n.language,b=i.getGraphComponents(ae.Z);let _=!1;b.forEach((e=>{_=e.derivatives.getByQuality(le.$l.AR).length>0||_}));const x=(this.arManager.outs.available.value||this.arManager.arCodeImage)&&_&&b.length>=1;return I.dy` + ${x?I.dy``:null} + ${g?I.dy``:null} + ${s?I.dy``:null} + ${a?I.dy``:null} + ${c?I.dy``:null} + + ${u?I.dy``:null} + ${m?I.dy``:null}`}onToggleReader(){const e=this.activeDocument.setup.reader,t=e.ins;t.enabled.setValue(!t.enabled.value),t.focus.setValue(t.enabled.value),t.enabled.value&&t.articleId.setValue(1===e.articles.length?e.articles[0].article.id:""),this.analytics.sendProperty("Reader_Enabled",t.enabled.value)}onToggleTours(){const e=this.activeDocument.setup.tours.ins,t=this.activeDocument.setup.reader.ins;e.enabled.value?e.enabled.setValue(!1):(t.enabled.value&&t.enabled.setValue(!1),e.enabled.setValue(!0),e.tourIndex.setValue(-1)),this.analytics.sendProperty("Tours_Enabled",e.enabled.value)}onToggleAnnotations(){const e=this.toolProvider.ins,t=this.activeDocument.setup.viewer.ins;e.visible.value&&e.visible.setValue(!1),t.annotationsVisible.setValue(!t.annotationsVisible.value),this.analytics.sendProperty("Annotations_Visible",t.annotationsVisible.value)}onToggleShare(){this.shareButtonSelected||(this.shareButtonSelected=!0,this.requestUpdate(),ue.show(this,this.activeDocument.setup.language).then((()=>{this.shareButtonSelected=!1,this.requestUpdate(),this.setElementFocus("share-btn")})),this.analytics.sendProperty("Menu_Share"))}onToggleFullscreen(){this.fullscreen.toggle(),this.analytics.sendProperty("Menu_Fullscreen")}onToggleTools(){const e=this.toolProvider.ins,t=this.activeDocument.setup.viewer.ins;t.annotationsVisible.value&&t.annotationsVisible.setValue(!1),e.visible.setValue(!e.visible.value),this.analytics.sendProperty("Tools_Visible",e.visible.value)}onEnterAR(){const e=this.arManager,t=e.ins;e.outs.available.value?t.enabled.setValue(!0):ge.show(this.parentElement.parentElement.parentElement,this.activeDocument.setup.language,e.arCodeImage).then((()=>{this.setElementFocus("ar-btn")}))}onToggleNarration(){const e=this.activeDocument.setup.audio;e.setupAudio(),e.ins.playNarration.set()}setTourFocus(){this.setElementFocus("tour-btn")}setReaderFocus(){this.setElementFocus("reader-btn")}setToolsFocus(){this.setElementFocus("tools-btn")}setElementFocus(e){const t=this.getElementsByTagName("ff-button"),n=Array.from(t).find((t=>t.id===e));void 0!==n?n.focus():console.warn("Can't focus. Element ["+e+"] not found.")}onActiveDocument(e,t){if(e&&this.documentProps.off(),t){const e=t.setup;this.documentProps.on(e.interface.ins.tools,e.reader.ins.enabled,e.reader.outs.count,e.tours.ins.enabled,e.tours.outs.count,e.viewer.ins.annotationsVisible,e.audio.outs.narrationPlaying,this.toolProvider.ins.visible)}this.requestUpdate()}onResize(){const e=this.scrollHeight>this.clientHeight;this.isClipped!==e&&(e&&this.scrollTo({top:this.scrollTop+this.scrollHeight,behavior:"smooth"}),this.isClipped=e)}};ye=ve([(0,I.Mo)("sv-main-menu")],ye);var be=n(93072),_e=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let xe=class extends v.ZP{constructor(){super(...arguments),this.needsFocus=!1}get toolProvider(){return this.system.getMainComponent(ie.Z)}get language(){return this.system.getComponent(be.Z)}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tool-bar"),this.needsFocus=!0}connected(){super.connected(),this.toolProvider.on("active-component",this.onUpdate,this),this.language.outs.language.on("value",this.onUpdate,this)}disconnected(){this.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.off("active-component",this.onUpdate,this),super.disconnected()}render(){const e=this.toolProvider.scopedComponents,t=this.toolProvider.activeComponent,n=this.language,i=(t&&v.dy`
`,e.map((e=>v.dy`this.onSelectTool(e)}>`)));return v.dy`
this.onKeyDownTool(e)}>${t?t.createView():null}
+
`}onSelectTool(e){this.toolProvider.activeComponent=e}onClose(e){this.dispatchEvent(new CustomEvent("close")),e.stopPropagation()}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-tool-button").item(0).focus(),this.needsFocus=!1}}onKeyDownMain(e){if("Escape"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("close"));else if("Tab"===e.code){const t=Array.from(this.getElementsByTagName("div")).find((e=>"mainmenu"===e.id));(0,O.e)((0,O.G)(t),e)}}onKeyDownTool(e){if("Escape"===e.code)e.preventDefault(),this.closeTool();else if("Tab"===e.code){const t=Array.from(this.getElementsByTagName("div")).find((e=>"toolmenu"===e.id));(0,O.e)((0,O.G)(t),e)}}closeTool(){const e=this.getElementsByTagName("ff-button");Array.from(e).find((e=>e.getAttribute("text")===this.language.getLocalizedString(this.toolProvider.activeComponent.text))).focus(),this.toolProvider.activeComponent=null}};xe=_e([(0,v.Mo)("sv-tool-bar")],xe);var we=n(40490),Se=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Me=class extends I.ZP{constructor(){super(...arguments),this.needsFocus=!1,this.firstRender=!0,this.stepTitle=""}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tour-navigator"),this.needsFocus=!0}render(){const e=this.tours,t=this.language,n=this.interface,i=e.activeTour;let s,r;if(e&&i){const n=e.outs.stepIndex.value+1,i=e.outs.stepCount.value;s=i>0?e.stepTitle:e.title,r=i>0?`${t.getLocalizedString("Step")} ${n} ${t.getLocalizedString("of")} ${i}`:t.getLocalizedString("No tour steps defined")}else s=t.getLocalizedString("No tour selected"),r="---";this.stepTitle=s,this.firstRender&&(s="");const o=n.isShowing(we.p.tour_exit)?I.dy``:null;return I.dy`
this.onKeyDown(e)}>
+ ${o} +
+
${s}
+
${r}
+
+ + + +
`}updated(e){if(super.updated(e),this.needsFocus){this.getElementsByClassName("sv-section-trail").item(2).focus(),this.needsFocus=!1}const t=this.getElementsByClassName("sv-title").item(0);t&&(this.firstRender?(setTimeout((()=>{t.innerText=this.stepTitle}),100),this.firstRender=!1):t.innerText=this.stepTitle)}onClickExit(){this.tours.ins.enabled.setValue(!1),this.tours.ins.closed.set()}onClickMenu(){this.tours.ins.tourIndex.setValue(-1)}onClickPrevious(){this.tours.ins.previous.set();this.querySelector("#title-inner").classList.remove("sv-text-scroll")}onClickNext(){this.tours.ins.next.set();this.querySelector("#title-inner").classList.remove("sv-text-scroll")}onClickTitle(){this.textHelper()}onActiveDocument(e,t){e&&(this.tours.outs.tourIndex.off("value",this.onUpdate,this),this.tours.outs.stepIndex.off("value",this.onUpdate,this),this.language.outs.language.off("value",this.onUpdate,this)),t&&(this.tours=t.setup.tours,this.language=t.setup.language,this.interface=t.setup.interface,this.tours.outs.tourIndex.on("value",this.onUpdate,this),this.tours.outs.stepIndex.on("value",this.onUpdate,this),this.language.outs.language.on("value",this.onUpdate,this)),this.requestUpdate()}onKeyDown(e){"Escape"===e.code?(e.preventDefault(),this.tours.ins.tourIndex.setValue(-1)):"Tab"===e.code&&(0,O.e)((0,O.G)(this),e)}textHelper(){const e=this.querySelector("#title-inner"),t=e.scrollWidth-e.offsetWidth+12;if(t>12){const n=this.querySelector("#title-area"),i=t/30;e.classList.remove("ff-ellipsis"),e.style.setProperty("animation-duration",i.toString()+"s"),e.style.setProperty("--x-offset","-"+t+"px"),n.style.setProperty("pointer-events","none"),e.classList.add("sv-text-scroll"),e.addEventListener("animationend",(()=>{e.classList.remove("sv-text-scroll"),e.classList.add("ff-ellipsis"),n.style.setProperty("pointer-events","auto")})),e.addEventListener("animationcancel",(()=>{e.classList.remove("sv-text-scroll"),e.classList.add("ff-ellipsis"),n.style.setProperty("pointer-events","auto")}))}}};Me=Se([(0,I.Mo)("sv-tour-navigator")],Me);var Ee=n(1594),Te=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Ce=class extends o.ZP{constructor(){super(...arguments),this.needsFocus=!1,this.focusableElements=[]}firstConnected(){super.firstConnected(),this.classList.add("sv-document-overlay","sv-article","sv-tour-menu"),this.needsFocus=!0}renderEntry(e,t){return o.dy`
this.onKeyDown(e,t)} class="sv-entry" @click=${e=>this.onClickTour(e,t)}> +
+

${Object.keys(e.titles).length>0?e.titles[Ee.PD[this.activeLanguage]]||"undefined":e.title}

+ +
+

${Object.keys(e.leads).length>0?e.leads[Ee.PD[this.activeLanguage]]:e.lead}

+
`}render(){const e=this.tours;return 0===e.length?o.dy`
+

No tours available.

+
`:o.dy`
+ ${e.map(((e,t)=>this.renderEntry(e,t)))} +
`}update(e){if(super.update(e),this.needsFocus){this.getElementsByClassName("sv-entry").item(0).focus(),this.needsFocus=!1}}onClickTour(e,t){e.stopPropagation(),this.dispatchEvent(new CustomEvent("select",{detail:{index:t}}))}onKeyDown(e,t){if("Space"===e.code||"Enter"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("select",{detail:{index:t}}));else if("Escape"===e.code)e.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{index:t}}));else if("Tab"===e.code)0===this.focusableElements.length&&(this.focusableElements=(0,O.G)(this)),(0,O.e)(this.focusableElements,e);else if("ArrowUp"===e.code||"ArrowDown"===e.code){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}}};Te([(0,o.Cb)({attribute:!1})],Ce.prototype,"tours",void 0),Te([(0,o.Cb)({attribute:!1})],Ce.prototype,"activeLanguage",void 0),Ce=Te([(0,o.Mo)("sv-tour-menu")],Ce);var Ae,Pe=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Re=Ae=class extends ce.ZP{constructor(e){super(),this.language=null,this.language=e,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t){const n=new Ae(t);return e.appendChild(n),new Promise(((e,t)=>{n.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-language-menu","sv-option-menu")}renderEntry(e,t){const n=e.name===this.language.nameString();return ce.dy`
this.onClickLanguage(e,t)} @keydown=${e=>this.onKeyDownEntry(e,t)} ?selected=${n}> + ${e.name} +
`}render(){const e=this.language;return ce.dy` +
this.onKeyDownMain(e)}> +
+
${e.getLocalizedString("Set Language")}
+ +
+
+
+ ${e.activeLanguages.map(((e,t)=>this.renderEntry(e,t)))} +
+
+
+ `}firstUpdated(e){super.firstUpdated(e),Array.from(this.getElementsByClassName("sv-entry")).find((e=>"0"===e.getAttribute("tabIndex"))).focus()}onClickLanguage(e,t){const n=this.language;e.stopPropagation(),n.ins.language.setValue(n.activeLanguages[t].id),this.close()}onKeyDownEntry(e,t){const n=this.language;if("Space"===e.code||"Enter"===e.code)e.preventDefault(),e.stopPropagation(),n.ins.language.setValue(n.activeLanguages[t].id),this.close();else if("ArrowUp"===e.code||"ArrowDown"===e.code){const t=e.target instanceof Element?e.target:null;if(t){const n="ArrowUp"===e.code?t.previousElementSibling:t.nextElementSibling;n&&(t.setAttribute("tabIndex","-1"),n.setAttribute("tabIndex","0"),n.focus())}}else"Tab"===e.code&&this.addEventListener("blur",this.tabReset,{once:!0,capture:!0})}onKeyDownMain(e){"Escape"===e.code?this.close():"Tab"===e.code&&(0,O.e)((0,O.G)(this),e)}tabReset(e){const t=e.target instanceof Element?e.target:null;if(t){const e=Array.from(t.parentElement.children).find((e=>e.hasAttribute("selected")));e!==t&&(t.setAttribute("tabIndex","-1"),e.setAttribute("tabIndex","0"))}}};Re=Ae=Pe([(0,ce.Mo)("sv-language-menu")],Re);const Le=Re;var Ne=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let De=class extends I.ZP{get activeTags(){return this.viewer?this.viewer.ins.activeTags.value.split(",").map((e=>e.trim())).filter((e=>!!e)):[]}get tagCloud(){return this.viewer?this.viewer.outs.tagCloud.value.split(",").map((e=>e.trim())).filter((e=>!!e)):[]}firstConnected(){super.firstConnected(),this.classList.add("sv-bottom-bar-container","sv-tag-cloud","sv-transition"),setTimeout((()=>this.classList.remove("sv-transition")),1)}render(){const e=this.activeTags,t=this.tagCloud.map((t=>I.dy`=0} + @click=${e=>this.onSelectTag(t)}>`));return I.dy`
+ +
${t}
+
`}onClickClose(){this.viewer.ins.annotationsVisible.setValue(!1)}onSelectTag(e){let t=this.activeTags;const n=this.viewer.ins.radioTags.value,i=t.indexOf(e);i>=0&&!n?t.splice(i,1):i<0&&(n?t=[e]:t.push(e)),this.viewer.ins.activeTags.setValue(t.join(", "))}onActiveDocument(e,t){e&&(this.viewer.ins.activeTags.off("value",this.onUpdate,this),this.viewer.outs.tagCloud.off("value",this.onUpdate,this)),t&&(this.viewer=t.setup.viewer,this.viewer.ins.activeTags.on("value",this.onUpdate,this),this.viewer.outs.tagCloud.on("value",this.onUpdate,this))}};De=Ne([(0,I.Mo)("sv-tag-cloud")],De);var Ie,Oe,Ue=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};!function(e){e[e.Nav=0]="Nav",e[e.Menu=1]="Menu"}(Oe||(Oe={}));let ke=Ie=class extends ce.ZP{constructor(e){super(),this.language=null,this.helpView=Oe.Nav,this.language=e,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t){const n=new Ie(t);return e.appendChild(n),new Promise(((e,t)=>{n.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.classList.add("sv-main-help")}render(){const e=this.language,t=this.helpView,n=!!this.parentElement.querySelector("#ar-btn"),i=!!this.parentElement.querySelector("#audio-btn"),s=!!this.parentElement.querySelector("#tour-btn"),r=!!this.parentElement.querySelector("#reader-btn"),o=!!this.parentElement.querySelector("#anno-btn"),a=!!this.parentElement.querySelector("#fullscreen-btn"),l=!!this.parentElement.querySelector("#tools-btn"),c=ce.dy`
+
+ +
Orbit
+
${Ie.leftClick}Left-click and drag
+
${Ie.oneFinger}One-finger drag
+
+
+ +
Pan
+
${Ie.rightClick}Right-click and drag
+
${Ie.twoFinger}Two-finger drag
+
+
+ +
Zoom
+
${Ie.mouseWheel}Mouse wheel
+
${Ie.pinch}Two-finger pinch
+
+
`,h=ce.dy`
The tools below can be accessed by clicking the corresponding icons on the menu bar to the left of the screen.
+
+ ${n?ce.dy`
+ +
Launch an augmented
reality experience
+
`:""} + ${i?ce.dy`
+ +
Hear an audio
narration of the scene
+
`:""} + ${s?ce.dy`
+ +
Take a curated guided
tour of the scene
+
`:""} + ${r?ce.dy`
+ +
Read articles about
the scene content
+
`:""} + ${o?ce.dy`
+ +
Show annotations
highlighting key points
+
`:""} +
+ +
Share the experience
with a friend!
+
+ ${a?ce.dy`
+ +
View the experience
in fullscreen mode
+
`:""} + ${l?ce.dy`
+ +
Open the advanced
tool menu
+
`:""} +
`;return ce.dy` +
this.onKeyDownMain(e)}> +
+
${e.getLocalizedString("Introduction to Voyager")}
+ +
+
+ + +
+ ${t===Oe.Nav?c:h} +
+ `}firstUpdated(e){super.firstUpdated(e)}onClickSection(e){this.helpView=e.target.index,this.requestUpdate()}onKeyDownMain(e){"Escape"===e.code?this.close():"Tab"===e.code&&(0,O.e)((0,O.G)(this),e)}tabReset(e){const t=e.target instanceof Element?e.target:null;if(t){const e=Array.from(t.parentElement.children).find((e=>e.hasAttribute("selected")));e!==t&&(t.setAttribute("tabIndex","-1"),e.setAttribute("tabIndex","0"))}}};ke.leftClick=ce.dy``,ke.rightClick=ce.dy``,ke.mouseWheel=ce.dy``,ke.pinch=ce.dy` + + + `,ke.oneFinger=ce.dy` + + + `,ke.twoFinger=ce.dy` + + + `,ke=Ie=Ue([(0,ce.Mo)("sv-main-help")],ke);const Ve=ke;var ze,Fe=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let Be=ze=class extends ce.ZP{constructor(e,t){super(),this.language=null,this.content="",this.language=e,this.content=t,this.position="center",this.modal=!0,this.url=window.location.href}static show(e,t,n){const i=new ze(t,n);return e.appendChild(i),new Promise(((e,t)=>{i.on("close",(()=>e()))}))}close(){this.dispatchEvent(new CustomEvent("close")),this.remove()}firstConnected(){super.firstConnected(),this.contentElement=this.createElement("div",null),this.classList.add("sv-splash")}render(){const e=this.language,t=this.contentElement;return t.innerHTML=this.content,ce.dy` +
this.onKeyDownMain(e)}> +
+
${e.getLocalizedString("Welcome to Voyager")}
+ +
+
+ ${t} +
+
+ `}firstUpdated(e){super.firstUpdated(e),this.querySelector("#main").focus()}onKeyDownMain(e){"Escape"===e.code?this.close():"Tab"===e.code&&(0,O.e)((0,O.G)(this),e)}};Be=ze=Fe([(0,ce.Mo)("sv-splash")],Be);const $e=Be;var je=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let He=class extends I.ZP{constructor(){super(...arguments),this.documentProps=new h.Z("value",this.onUpdate,this),this.assetPath="",this.needsSplash=!0}get toolProvider(){return this.system.getMainComponent(ie.Z)}get assetReader(){return this.system.getMainComponent(Y.Z)}firstConnected(){this.style.pointerEvents="none",this.setAttribute("pointer-events","none"),this.classList.add("sv-chrome-view")}connected(){super.connected(),this.toolProvider.ins.visible.on("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.on("value",this.onUpdate,this),this.activeDocument.setup.audio.outs.isPlaying.on("value",this.onUpdate,this),this.activeDocument.setup.audio.outs.narrationPlaying.on("value",this.onUpdate,this),this.activeDocument.setup.audio.ins.captionsEnabled.on("value",this.onUpdate,this),this.titleElement=this.createElement("div",null),this.titleElement.classList.add("ff-ellipsis"),this.assetPath=this.assetReader.getSystemAssetUrl("")}disconnected(){this.activeDocument.setup.audio.ins.captionsEnabled.off("value",this.onUpdate,this),this.activeDocument.setup.audio.outs.narrationPlaying.off("value",this.onUpdate,this),this.activeDocument.setup.audio.outs.isPlaying.off("value",this.onUpdate,this),this.activeDocument.setup.language.outs.language.off("value",this.onUpdate,this),this.toolProvider.ins.visible.off("value",this.onUpdate,this),super.disconnected()}render(){const e=this.activeDocument,t=this.titleElement;if(!e)return I.dy``;const n=e.setup,i=n.interface.ins.visible.value,s=n.interface.ins.logo.value&&n.interface.isShowing(we.p.logo),r=n.interface.ins.menu.value&&n.interface.isShowing(we.p.menu),o=n.interface.ins.visibleElements.value&&n.interface.isShowing(we.p.title),a=n.interface.ins.visibleElements.value&&n.interface.isShowing(we.p.help),l=n.reader.ins.enabled.value,c=n.tours.tours,h=n.tours.ins.enabled.value,d=n.tours.outs.tourIndex.value>=0,u=n.language,p=u.activeLanguages,m=u.outs.language.value,f=p.length>1&&n.interface.isShowing(we.p.language),g=n.audio.outs.isPlaying.value,v=n.audio.ins.captionsEnabled.value,y=n.audio.outs.narrationPlaying.value,b=!!this.system.getComponent("CVStoryApplication",!0)||!h,_=n.viewer.ins.annotationsVisible.value&&n.viewer.outs.tagCloud.value,x=!l&&this.toolProvider.ins.visible.value,w=this.activeDocument.setup.tours.outs.ending.value;this.activeDocument.setup.tours.outs.ending.setValue(!1);const S=this.activeDocument.outs.intro.value;if(S&&(this.needsSplash&&S.length>0&&$e.show(this,this.activeDocument.setup.language,S).then((()=>{this.getRootNode().getElementById("sv-scene").focus()})),this.needsSplash=!1),!i)return I.dy``;let M;return M=h?d?u.getLocalizedString("Tour")+": "+n.tours.outs.tourTitle.value:u.getLocalizedString("Interactive Tours"):e.outs.title.value||"Missing Title",t.innerHTML=M,I.dy`${w?I.dy``:null} + ${y?I.dy`
${n.audio.getPlayerById(n.audio.narrationId)}
`:null} +
+
+ ${r?I.dy``:null} +
+
+ ${o?I.dy`
${t}
`:null} + ${s?I.dy``:null} +
+
+
+ ${h&&d?I.dy``:null} + ${h&&!d?I.dy``:null} + ${_&&b?I.dy``:null} + ${x&&b?I.dy`
`:null} + `}onSelectTour(e){this.activeDocument.setup.tours.ins.tourIndex.setValue(e.detail.index)}closeTours(){const e=this.activeDocument.setup.tours;e.ins.enabled.setValue(!1),e.ins.closed.set()}updateCaptions(){const e=this.activeDocument.setup.audio.ins;e.captionsEnabled.setValue(!e.captionsEnabled.value)}openLanguageMenu(){const e=this.activeDocument.setup.language;e.ins.enabled.value||(e.ins.enabled.setValue(!0),Le.show(this,this.activeDocument.setup.language).then((()=>{e.ins.enabled.setValue(!1),this.querySelector("#language").focus()})))}openHelp(){this.activeDocument.setup.language;Ve.show(this,this.activeDocument.setup.language).then((()=>{this.querySelector("#main-help").focus()}))}closeTools(){const e=this.toolProvider.ins;e.visible.setValue(!1),e.closed.set()}onActiveDocument(e,t){if(e&&this.documentProps.off(),t){const e=t.setup;this.documentProps.on(t.outs.title,t.outs.assetPath,e.interface.ins.visible,e.interface.ins.logo,e.interface.ins.menu,e.viewer.ins.annotationsVisible,e.reader.ins.enabled,e.tours.ins.enabled,e.tours.outs.tourIndex)}this.requestUpdate()}};He=je([(0,I.Mo)("sv-chrome-view")],He);const Ge=He;var Ze=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};a.Z.add("globe",o.dy``),a.Z.add("cog",o.dy``),a.Z.add("eye",o.dy``),a.Z.add("palette",o.dy``),a.Z.add("comment",o.dy``),a.Z.add("article",o.dy``),a.Z.add("document",o.dy``),a.Z.add("share",o.dy``),a.Z.add("expand",o.dy``),a.Z.add("zoom",o.dy``),a.Z.add("tools",o.dy``),a.Z.add("environment",o.dy``),a.Z.add("bulb",o.dy``),a.Z.add("spot",o.dy``),a.Z.add("area",o.dy``),a.Z.add("sun",o.dy``),a.Z.add("half-sun",o.dy``),a.Z.add("tape",o.dy``),a.Z.add("knife",o.dy``),a.Z.add("bars",o.dy``),a.Z.add("triangle-left",o.dy``),a.Z.add("triangle-right",o.dy``),a.Z.add("twitter",o.dy``),a.Z.add("facebook",o.dy``),a.Z.add("instagram",o.dy``),a.Z.add("linkedin",o.dy``),a.Z.add("email",o.dy``),a.Z.add("copy",o.dy``),a.Z.add("ar",o.dy``),a.Z.add("device-move",o.dy``),a.Z.add("audio",o.dy``),a.Z.add("help",o.dy`?`),a.Z.add("move",o.dy``),a.Z.add("rotate",o.dy``),a.Z.add("pause",o.dy``),a.Z.add("caption",o.dy``);let We=class extends o.ZP{constructor(e){super(),this.application=null,e&&(this.application=e),this.addEventListener("focus",this.onFocus)}static get observedAttributes(){return["root","document"]}get fullscreen(){return this.application.system.getMainComponent(i.Z)}get arManager(){return this.application.system.getMainComponent(s.Z)}get viewer(){return this.application.system.getComponent(r.Z)}firstConnected(){if(super.firstConnected(),!this.application){const e={root:this.getAttribute("root"),dracoRoot:this.getAttribute("dracoRoot"),resourceRoot:this.getAttribute("resourceRoot"),document:this.getAttribute("document"),model:this.getAttribute("model"),geometry:this.getAttribute("geometry"),texture:this.getAttribute("texture"),quality:this.getAttribute("quality"),uiMode:this.getAttribute("uiMode"),bgColor:this.getAttribute("bgColor"),bgStyle:this.getAttribute("bgStyle"),controls:this.getAttribute("controls"),prompt:this.getAttribute("prompt"),reader:this.getAttribute("reader"),lang:this.getAttribute("lang")};this.application=new c.Z(null,e)}this.attachShadow({mode:"open"});const e=this.shadowRoot;var t=document.createElement("style");t.innerText='/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:normal;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.ff-fullsize{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.ff-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden}.ff-fullsize{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box}.ff-caret-down{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(180deg);transition:transform 0.05s}.ff-caret-up{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(0deg);transition:transform 0.05s}.ff-caret-right{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(90deg);transition:transform 0.05s}.ff-caret-left{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #a0a0a0;transform:rotate(270deg);transition:transform 0.05s}html{color:#c8c8c8}button,input{display:block;padding:0;margin:0;border:none;background-color:inherit;color:inherit;font-size:inherit;cursor:inherit}*:focus{outline:1px solid #0089bf;outline-offset:0}*:focus:not(:focus-visible){outline:0}*:focus-visible{outline:1px solid #0089bf;outline-offset:0}.ff-fullscreen{position:fixed;left:0;right:0;top:0;bottom:0}.ff-noselect{user-select:none;-moz-user-select:none;-webkit-user-select:none}.ff-off{user-select:none;-moz-user-select:none;-webkit-user-select:none;pointer-events:none}.ff-on{user-select:auto;-webkit-user-select:none;pointer-events:auto}.ff-focusable{tab-index:0}.ff-flex-row{display:flex}.ff-flex-column{display:flex;flex-direction:column}.ff-flex-wrap{flex-wrap:wrap}.ff-flex-centered{align-items:center}.ff-flex-item-fixed{flex:0 0 auto;position:relative}.ff-flex-item-stretch,.ff-flex-spacer{flex:1 1 auto;position:relative}.ff-scroll-y{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow-y:auto}.ff-position-above{position:absolute;bottom:0}.ff-position-below{position:absolute;top:100%}.ff-position-left{position:absolute;right:0}.ff-position-right{position:absolute;left:100%}.ff-position-above.ff-align-left,.ff-position-below.ff-align-left{left:0}.ff-position-above.ff-align-right,.ff-position-below.ff-align-right{right:0}.ff-position-left.ff-align-top,.ff-position-right.ff-align-top{top:0}.ff-position-left.ff-align-bottom,.ff-position-right.ff-align-bottom{bottom:0}.ff-ellipsis{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ff-placeholder{flex:1 1 auto;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.ff-splitter-section{flex:1 1 auto;position:relative;box-sizing:border-box;overflow:hidden}.ff-splitter[direction="vertical"]+.ff-splitter-section{border-top:2px solid #1b1b1b}.ff-splitter:not([direction="vertical"])+.ff-splitter-section{border-left:2px solid #1b1b1b}.ff-frame{padding:4px}.ff-frame .ff-control{margin:4px}.ff-icon{display:inline-block;position:relative;height:1rem;fill:#a0a0a0}.ff-icon svg{width:inherit;height:inherit}.ff-button{cursor:pointer}.ff-button[vertical]{flex-direction:column}.ff-button.ff-inline .ff-icon+.ff-text{padding-left:0.5em}.ff-button.ff-inline .ff-icon{display:inline}.ff-button.ff-inline .ff-text{display:inline}.ff-button.ff-transparent{position:relative;display:flex;justify-content:center;align-items:center;flex:0 1 auto;flex-wrap:wrap;padding:5px;background:transparent;fill:#a0a0a0;transition:fill 0.2s}.ff-button.ff-transparent:hover,.ff-button.ff-transparent:focus{fill:#c8c8c8}.ff-button.ff-transparent[selected]{fill:#c8c8c8}.ff-button.ff-transparent>.ff-text{margin:3px;white-space:nowrap}.ff-button.ff-transparent>.ff-icon{margin:3px;height:1.3em}.ff-button.ff-transparent>.ff-caret-down{margin:3px}.ff-button.ff-transparent.ff-disabled{color:gray;fill:#606060;user-select:none;pointer-events:none}.ff-button.ff-control{position:relative;display:flex;justify-content:center;align-items:center;flex:1 1 auto;flex-wrap:wrap;padding:5px;background:#4e4e4e;transition:background-color 0.2s}.ff-button.ff-control:hover,.ff-button.ff-control:focus{background-color:#676767}.ff-button.ff-control[selected]{background-color:#0089bf}.ff-button.ff-control[selected]:hover,.ff-button.ff-control[selected]:focus{background-color:#00a6e8}.ff-button.ff-control>.ff-text{margin:3px;white-space:nowrap}.ff-button.ff-control>.ff-icon{margin:3px;height:1.3em}.ff-button.ff-control>.ff-caret-down{margin:3px}.ff-button.ff-control.ff-disabled{color:gray;fill:#606060;user-select:none;pointer-events:none}.ff-button.ff-control.ff-disabled>.ff-icon{fill:#606060}.ff-menu{background-color:#4e4e4e;z-index:100;display:flex;flex-direction:column}.ff-menu .ff-divider{height:1px;padding:0;background:#a0a0a0}.ff-menu .ff-button{justify-content:flex-start;margin:0;padding:4px 4px}.ff-menu .ff-button .ff-icon{height:1.2em;width:2.2em;margin-right:4px}.ff-dropdown .ff-menu{min-width:100%;margin-top:3px}.ff-modal-plane{position:fixed;left:0;right:0;top:0;bottom:0;background-color:rgba(0,0,0,0.6);opacity:0;transition:opacity .3s;z-index:990;pointer-events:auto}.ff-modal-plane.ff-transition{opacity:1}ff-dialog{box-sizing:border-box;background:#343434;border:1px solid #4e4e4e;box-shadow:3px 3px 24px rgba(0,0,0,0.4)}ff-title-bar{background:#1b1b1b;padding:2px}ff-title-bar .ff-text{flex:1 1 auto;padding-right:8px}ff-title-bar .ff-icon{padding:2px}ff-popup-button .ff-content{transition:opacity .15s}.ff-line-edit{display:block;overflow:hidden;background-color:#1b1b1b;min-height:1.2em}.ff-line-edit input{padding:2px}.ff-text-edit{box-sizing:border-box;flex:1 1 auto;display:flex;background-color:#1b1b1b}.ff-text-edit textarea{display:block;box-sizing:border-box;width:100%;padding:2px;resize:none;background:transparent;color:inherit;border:none}.ff-color-edit{font-size:0.8rem}.ff-color-edit .ff-control{margin:0}.ff-color-edit .ff-slider-controls{align-items:stretch;flex:1 1 auto}.ff-color-edit .ff-numeric-controls{flex:0 0 auto;align-items:center;margin-top:6px}.ff-color-edit .ff-text{color:#a0a0a0;margin:0 3px}.ff-color-edit .ff-line-edit{flex:4 5 auto}.ff-color-edit .ff-line-edit.ff-wide{flex:5 4 auto}.ff-color-edit .ff-knob{margin:-2px 0 0 -2px;border:2px solid white;box-shadow:0 0 5px rgba(0,0,0,0.5)}.ff-color-edit .ff-vector-slider{flex:1 0 auto;padding:0 10px 10px 0;background-image:linear-gradient(to bottom, transparent, black),linear-gradient(to right, white, red)}.ff-color-edit .ff-vector-slider .ff-knob{width:10px;height:10px}.ff-color-edit .ff-linear-slider{flex:0 0 24px;margin-left:6px;padding-bottom:10px}.ff-color-edit .ff-linear-slider .ff-knob{width:100%;height:10px}.ff-color-edit .ff-hue-slider{background:linear-gradient(to bottom, red, #ff0, lime, cyan, blue, #f0f, red)}.ff-color-edit .ff-alpha-slider{color:#4e4e4e}.ff-quad-splitter .ff-left{box-sizing:border-box;border-right:1px solid #343434}.ff-quad-splitter .ff-top{box-sizing:border-box;border-bottom:1px solid #343434}#ff-notification-stack{position:fixed;z-index:100;bottom:0;right:0;width:30%;min-width:250px;max-width:500px}.ff-notification{position:relative;left:0;display:flex;margin:8px;padding:4px;background:#4e4e4e;box-shadow:0 0 20px rgba(0,0,0,0.35)}.ff-notification.ff-info>.ff-icon{fill:#73adff}.ff-notification.ff-success>.ff-icon{fill:#8ae65c}.ff-notification.ff-warning>.ff-icon{fill:#e6a345}.ff-notification.ff-error>.ff-icon{fill:#e64545}.ff-notification>.ff-icon{height:2em;padding:8px}.ff-notification.ff-out{transition:left 0.5s ease-in;left:100%}.ff-notification .ff-text{flex:1;padding:8px;text-overflow:ellipsis;overflow:hidden}.ff-notification .ff-button{flex:0;padding:8px}.ff-message-box{position:relative;min-width:350px;max-width:450px;width:90%;padding:16px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);opacity:0;transition:opacity .15s}.ff-message-box.ff-transition{opacity:1}.ff-message-box .ff-title{align-items:flex-start}.ff-message-box .ff-title .ff-type-icon{margin:0 16px 0 0;height:2.5em}.ff-message-box .ff-title .ff-type-icon[name="prompt"]{fill:#e6cf5c}.ff-message-box .ff-title .ff-type-icon[name="info"]{fill:#73adff}.ff-message-box .ff-title .ff-type-icon[name="warning"]{fill:#e6a345}.ff-message-box .ff-title .ff-type-icon[name="error"]{fill:#e64545}.ff-message-box .ff-title .ff-content{flex:1 1 auto;margin:0 0 2em 0}.ff-message-box .ff-title .ff-caption{font-size:1.5em}.ff-message-box .ff-title .ff-text{margin:2em 0 1em 0}.ff-message-box .ff-title .ff-line-edit{margin:0 0 1em 0}.ff-message-box .ff-title .ff-line-edit input{padding:4px}.ff-message-box .ff-title .ff-close-button{margin:0 0 0 16px;padding:0}.ff-message-box .ff-button+.ff-button{margin-left:8px}.ff-popup-options{box-sizing:border-box;background:#343434;border:1px solid #4e4e4e;box-shadow:3px 3px 24px rgba(0,0,0,0.4);min-width:6rem}.ff-popup-options button{padding:4px 8px;text-align:start;user-select:none}.ff-popup-options button+button{margin-top:1px}.ff-popup-options button:hover{background-color:#4e4e4e}.ff-popup-options button:focus{outline:none;background-color:#0089bf}.ff-list{flex:1 1 auto;background-color:#272727}.ff-list .ff-list-item{cursor:pointer;user-select:none;padding:2px}.ff-list .ff-list-item:hover{background-color:#343434}.ff-list .ff-list-item[selected]{background-color:#0089bf}.ff-list .ff-list-item+.ff-list-item{border-top:1px solid #343434}.ff-table{position:relative;box-sizing:border-box;width:100%}.ff-table table{box-sizing:border-box;width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0}.ff-table tr[selected]{background-color:#0089bf}.ff-table th,.ff-table td{padding:4px}.ff-table th{background-color:#1b1b1b;color:#a0a0a0;text-align:start}.ff-table .ff-table-sort-icon{height:0.8em;margin-left:4px;color:#a0a0a0}.ff-tree{position:relative;overflow-y:auto}.ff-tree .ff-tree-node-container{margin-left:-501px;border-top:1px solid #3e3e3e;border-bottom:1px solid #3e3e3e;margin-bottom:-1px}.ff-tree .ff-tree-node{margin-left:500px}.ff-tree .ff-tree-node.ff-inner{background-color:#2f2f2f}.ff-tree .ff-tree-node.ff-leaf{background-color:#3c3c3c}.ff-tree .ff-tree-node.ff-root{background-color:#272727}.ff-tree .ff-tree-node[selected]{background-color:#0089bf}.ff-tree .ff-tree-node .ff-header{position:relative;cursor:pointer;padding-left:14px}.ff-tree .ff-tree-node .ff-header .ff-text{user-select:none}.ff-tree .ff-tree-node.ff-drop-target>.ff-header{outline:1px dashed #0089bf}.ff-tree .ff-tree-node.ff-inner[expanded]>.ff-header:before{content:\'\';position:absolute;top:0.6em;left:3px;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #a0a0a0;transform:rotate(180deg);transition:transform 0.05s}.ff-tree .ff-tree-node.ff-inner:not([expanded])>.ff-header:before{content:\'\';position:absolute;top:0.6em;left:3px;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #a0a0a0;transform:rotate(90deg);transition:transform 0.05s}.ff-tree .ff-tree-node.ff-leaf .ff-header{cursor:default}.ff-tree .ff-tree-node .ff-content{margin-left:10px}.ff-tree .ff-tree-node:not([expanded])>.ff-content{display:none}ff-tab-container{background:#343434}ff-tab-container,ff-dock-stack{background:#272727;border:1px solid #1b1b1b}ff-tab-container header,ff-dock-stack header{background:#1b1b1b}ff-tab-header,ff-dock-panel-header{background:#1b1b1b;color:#c8c8c8;padding:1px 3px 2px 2px}ff-tab-header[active],ff-dock-panel-header[active]{background:linear-gradient(#626262, #343434);color:#c8c8c8}ff-tab-header label,ff-dock-panel-header label{pointer-events:none}ff-tab-header .ff-text,ff-dock-panel-header .ff-text{padding:0 1px}ff-tab-header .ff-icon,ff-dock-panel-header .ff-icon{top:1px;height:0.8rem;padding:0 1px}.ff-dock-drop-marker{box-sizing:border-box;background:rgba(0,137,191,0.3);border:1px solid #0089bf}.ff-viewport-overlay{padding:6px;font-size:0.75rem}.ff-viewport-overlay .ff-row{display:flex;justify-content:space-between}.ff-viewport-overlay .ff-labels{display:flex;flex-direction:column}.ff-viewport-overlay .ff-top-left,.ff-viewport-overlay .ff-bottom-left{align-items:flex-start}.ff-viewport-overlay .ff-top-center,.ff-viewport-overlay .ff-bottom-center{align-items:center}.ff-viewport-overlay .ff-top-right,.ff-viewport-overlay .ff-bottom-right{align-items:flex-end}.ff-viewport-overlay .ff-label-box{box-sizing:border-box;padding:1px 8px 2px 8px;background:rgba(0,0,0,0.5);border-radius:2em}.sv-article h1{margin:0.3em 0;font-family:"Amiri", serif;font-size:2.3em;font-weight:normal;color:#e8e8e8}.sv-article h1:before{content:"";position:absolute;top:0;left:0;width:75px;height:5px;background-color:#0089bf}.sv-article p,.sv-article h2,.sv-article h3,.sv-article h4,.sv-article h5,.sv-article h6,.sv-article ul,.sv-article ol,.sv-article li{font-family:"Hind Siliguri", sans-serif;color:#c8c8c8}.sv-article h2,.sv-article h3,.sv-article h4,.sv-article h5,.sv-article h6{font-size:1.3em;margin:1.2em 0 0.8em 0}.sv-article p,.sv-article ul,.sv-article ol{font-size:1.15em;margin:0.8em 0}.sv-article p{line-height:1.55em}.sv-article ul{padding-inline-start:2.5em;list-style:disc outside}.sv-article ol{padding-inline-start:2.5em;list-style:decimal outside}.sv-article a:link,.sv-article a:visited,.sv-article a:hover,.sv-article a:active{color:#0089bf}.sv-article img{max-width:100%;height:auto}.sv-article figure{display:table;margin:1rem auto}.sv-article figure.align-left{float:left}.sv-article figure.align-right{float:right}.sv-article figure.image figcaption{color:#999;display:block;margin-top:0.25rem;text-align:center;-webkit-user-modify:read-only}.sv-content-view{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.85em;line-height:1.35;color:#c8c8c8;background-color:#343434;position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-logo{flex:0 50 180px;min-width:40px;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;overflow:hidden;height:40px;user-select:none}.sv-logo .sv-short{flex-grow:1;width:0;max-width:40px}.sv-logo .sv-full{flex:1 0 180px;display:flex;height:100%}.sv-logo .sv-full .sv-logo-full{flex:auto;height:100%}.ff-flex-spacer{user-select:none;-moz-user-select:none;-webkit-user-select:none}.sr-only{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}@keyframes spin{100%{transform:rotate(360deg)}}.sv-prompt,.sv-spinner{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;display:flex;justify-content:center;align-items:center;pointer-events:none}.sv-spinner-wheel{height:120px;width:120px;animation:spin 5s linear infinite}*{scrollbar-color:#676767 #1b1b1b;scrollbar-width:thin}* ::-webkit-scrollbar{width:8px;height:8px}* ::-webkit-scrollbar-track{background-color:#1b1b1b}* ::-webkit-scrollbar-thumb{background-color:#676767;border-radius:8px}voyager-explorer{font-size:16px}.sv-content-only .sv-scene-view,.sv-content-stack .sv-scene-view{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;cursor:grab}.sv-content-only .sv-scene-view:focus,.sv-content-stack .sv-scene-view:focus{border:2px solid #bfedff}.sv-content-only .sv-scene-view:focus:not(:focus-visible),.sv-content-stack .sv-scene-view:focus:not(:focus-visible){border:none;outline:0}.sv-content-only .sv-scene-view:focus-visible,.sv-content-stack .sv-scene-view:focus-visible{border:2px solid #bfedff}.sv-reader-container{overflow-y:auto}.sv-content-stack .sv-reader-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;margin-top:52px}.sv-content-stack .sv-reader-view{pointer-events:auto;display:flex;justify-content:center}.sv-content-stack .sv-reader-view .sv-left{flex:0 0 52px}.sv-content-stack .sv-reader-view .sv-article{flex:0 2 720px;background-color:rgba(27,34,38,0.5);padding-bottom:35px}.sv-content-stack .sv-reader-view .sv-right{flex:0 3 16px;background-color:rgba(27,34,38,0.5)}.sv-content-split{display:flex}.sv-content-split .sv-reader-container{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;margin-top:52px}.sv-content-split .sv-scene-view{flex:1 1 60%}.sv-content-split .sv-reader-view{pointer-events:auto;flex:1 1 40%;padding:0 20px}.sv-content-split .sv-reader-view .sv-left{flex:0 0 52px}.sv-content-split .sv-reader-view .sv-article{flex:0 2 720px;background-color:rgba(27,34,38,0.5);padding-bottom:35px;padding-right:16px}.sv-content-split .sv-reader-view .sv-right{flex:0 3 16px;background-color:rgba(27,34,38,0.5)}.sv-article{position:relative;padding:5px 8px 0 16px;user-select:text;-moz-user-select:text;-webkit-user-select:text}.ff-viewport-overlay{font-size:1.0em}.sv-scene-view{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden}.sv-scene-view.sv-blur{filter:brightness(60%) blur(5px);transition:filter 0.5s}.sv-annotation{box-sizing:border-box;position:absolute;z-index:1;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-annotation a:link,.sv-annotation a:visited,.sv-annotation a:hover,.sv-annotation a:active{color:#0089bf}.sv-annotation img{max-height:120px;max-width:100%}.sv-annotation .sv-img-credit{font-size:x-small}.sv-annotation-img{max-width:100%}.sv-circle-annotation{display:flex}.sv-circle-annotation.sv-expanded{z-index:2;width:16%;min-width:180px;max-width:280px}.sv-circle-annotation .sv-marker{background-color:rgba(0,0,0,0.65);border-radius:50%;text-align:center;height:18px;aspect-ratio:1/1;border-style:solid;border-width:1px;cursor:pointer;font-size:0.9em;color:#fff;-webkit-tap-highlight-color:transparent}.sv-circle-annotation .sv-annotation-body{padding:4px 8px;background-color:rgba(0,0,0,0.7);border-radius:4px;margin:0px 1px;width:100%}.sv-circle-annotation .sv-annotation-body .sv-title{padding:0 0 2px 0;font-weight:bold}.sv-circle-annotation .sv-annotation-body p{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.88em;line-height:1.35;color:#c8c8c8;margin:0.5em 0}.sv-circle-annotation .sv-annotation-body .ff-button{background:rgba(0,0,0,0.01)}.sv-circle-annotation .sv-annotation-body .ff-button:hover{text-decoration:underline}.sv-circle-annotation .sv-annotation-body .sv-content{overflow:hidden;overflow-wrap:break-word}.sv-pin-annotation{padding:0 4px;background-color:rgba(0,0,0,0.5);color:#c8c8c8;transform:translate(-50%, -100%)}.sv-scale-annotation{opacity:0;transition:opacity 0.3s ease-in;position:absolute;color:black;background-color:white;font-weight:bold;border-radius:20px;padding-left:4px;padding-right:4px}.sv-scale-annotation.sv-show{opacity:1}.sv-standard-annotation,.sv-extended-annotation{max-width:20%;min-width:min-content;padding:0 4px;background-color:rgba(0,0,0,0.5);color:#c8c8c8;pointer-events:auto;overflow-wrap:normal}.sv-standard-annotation.sv-expanded,.sv-extended-annotation.sv-expanded{width:20%;min-width:180px;background-color:rgba(0,0,0,0.8);z-index:2}.sv-standard-annotation.sv-short,.sv-extended-annotation.sv-short{width:unset;min-width:min-content}.sv-standard-annotation.sv-q0,.sv-extended-annotation.sv-q0{transform:translate(0, -100%);border-bottom-style:solid;border-bottom-width:1px;text-align:left}.sv-standard-annotation.sv-q1,.sv-extended-annotation.sv-q1{transform:translate(-100%, -100%);border-bottom-style:solid;border-bottom-width:1px;text-align:right}.sv-standard-annotation.sv-q2,.sv-extended-annotation.sv-q2{transform:translate(-100%, 0);border-top-style:solid;border-top-width:1px;text-align:right}.sv-standard-annotation.sv-q3,.sv-extended-annotation.sv-q3{transform:translate(0, 0);border-top-style:solid;border-top-width:1px;text-align:left}.sv-standard-annotation.sv-static-width,.sv-extended-annotation.sv-static-width{width:fit-content}.sv-standard-annotation .sv-title,.sv-extended-annotation .sv-title{padding:1px 0 2px 0;font-weight:bold;-webkit-tap-highlight-color:transparent}.sv-standard-annotation .sv-content,.sv-extended-annotation .sv-content{padding:2px 0;height:0;overflow:hidden;overflow-wrap:break-word;transition:height 0.2s}.sv-standard-annotation p,.sv-extended-annotation p{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.88em;line-height:1.35;color:#c8c8c8;margin:0.5em 0}.sv-standard-annotation .ff-button,.sv-extended-annotation .ff-button{background:rgba(0,0,0,0.01)}.sv-standard-annotation .ff-button .ff-icon,.sv-extended-annotation .ff-button .ff-icon{fill:#a0a0a0}.sv-standard-annotation .ff-button:hover,.sv-extended-annotation .ff-button:hover{text-decoration:underline}.sv-extended-annotation .sv-title{cursor:pointer}.sv-standard-annotation{pointer-events:none}.sv-standard-annotation.sv-enable-events{pointer-events:auto;cursor:pointer}.sv-annotation-overlay{padding:7px;pointer-events:auto;background-color:rgba(54,61,64,0.6);max-width:min(80%, 800px);min-width:50%;max-height:90%;overflow-y:auto;cursor:auto}.sv-annotation-overlay .sv-annotation-body .ff-button{background:rgba(0,0,0,0.01)}.sv-annotation-overlay .sv-annotation-body .ff-button:hover{text-decoration:underline}.sv-ar-prompt{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;text-align:center;border-radius:20px;margin:30% 0 0 0;overflow:hidden;background-color:rgba(54,61,64,0.6)}.sv-ar-prompt .sv-content{flex:1;width:100%;margin:10px 10px;text-align:center;-webkit-user-select:none;-ms-user-select:none;user-select:none}.sv-ar-prompt .sv-content .sv-ar-icon{height:10em}.sv-ar-menu{display:flex;position:absolute;bottom:0px;flex-direction:row;margin:0 0 6px 6px}.sv-ar-menu>.ff-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;width:38px;height:38px;margin:0 6px 2px 0;background-color:rgba(74,82,87,0.5);border-radius:20px;font-size:17px;transition:all .15s;pointer-events:auto}.sv-ar-menu>.ff-button:hover,.sv-ar-menu>.ff-button:focus{outline:none;background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-ar-menu>.ff-button[selected]{background-color:#0089bf;color:#f0f0f0}.sv-ar-menu>.ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-ar-menu>.ff-button[selected]:hover,.sv-ar-menu>.ff-button[selected]:focus{background-color:#00a6e8}.sv-ar-code{position:relative;width:420px;max-width:85%;max-height:90%;padding:8px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);pointer-events:auto}.sv-ar-code .ff-title{margin:0.5em 0 1em 0}.sv-ar-code .ff-title .ff-icon{height:2em;width:2em;padding:2px;border-radius:20px;background-color:rgba(74,82,87,0.5)}.sv-ar-code img{height:250px;margin:auto}.sv-chrome-view{font-family:"Segoe UI","HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400;font-size:0.85em;line-height:1.35;color:#c8c8c8;position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;background:linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.15) 10%, transparent 25%);z-index:3}.sv-chrome-view .ff-button{flex:0 1 auto;box-sizing:border-box}.sv-chrome-view .ff-button:focus{outline:none;box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-view .ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-chrome-view .ff-button:focus-visible{outline:none;box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-view .ff-button:hover{outline:none}.sv-chrome-view .ff-button:hover>.ff-icon{fill:#c8c8c8}.sv-chrome-view .ff-button[selected]{background-color:#0089bf}.sv-chrome-view .ff-button[selected][disabled]{background-color:#4e4e4e}.sv-chrome-view .ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-chrome-header{display:flex;align-items:flex-start;height:100%;position:relative}.sv-chrome-header .sv-top-bar{flex:1 1 auto;display:flex;align-items:flex-start;height:40px;margin:9px 9px 0 0;overflow:hidden}.sv-chrome-header .sv-main-title{flex:1 1 auto;margin:6px 8px;font-family:"Hind Siliguri", sans-serif;font-weight:normal;font-size:1.412em;white-space:pre;color:#e8e8e8;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-chrome-header .sv-main-title span{color:transparent}.sv-chrome-footer{display:block;position:absolute;bottom:0;right:0}.sv-chrome-footer .sv-bottom-bar{flex:1 1 auto;display:flex;align-items:flex-end;text-align:right;overflow:hidden}.sv-chrome-footer .sv-bottom-bar>.ff-button{margin:6px 6px 6px 5px;box-sizing:border-box;-webkit-tap-highlight-color:transparent;width:38px;height:38px;background-color:rgba(31,36,38,0.8);border-radius:20px;font-size:17px;transition:all .15s;pointer-events:auto}.sv-chrome-footer .sv-bottom-bar>.ff-button .ff-text{color:#a0a0a0}.sv-chrome-footer .sv-bottom-bar>.ff-button:focus{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-footer .sv-bottom-bar>.ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-chrome-footer .sv-bottom-bar>.ff-button:focus-visible{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-chrome-footer .sv-bottom-bar>.ff-button:hover{background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-chrome-footer .sv-bottom-bar>.ff-button:hover>.ff-text{color:#c8c8c8}.sv-chrome-footer .sv-bottom-bar>.ff-button[selected]{background-color:#0089bf;color:#f0f0f0}.sv-chrome-footer .sv-bottom-bar>.ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-chrome-footer .sv-bottom-bar>.ff-button[selected]:hover,.sv-chrome-footer .sv-bottom-bar>.ff-button[selected]:focus{background-color:#00a6e8}.sv-chrome-footer .sv-text-icon{font-family:"Hind Siliguri", sans-serif;font-weight:bold;line-height:25px}.sv-main-menu-wrapper{position:relative;height:100%;min-width:50px}.sv-main-menu{display:flex;flex-direction:column;padding:6px 9px 6px 6px;height:100%;overflow-y:auto;overflow-x:hidden;pointer-events:auto;position:absolute;box-sizing:border-box;overscroll-behavior-y:contain}.sv-main-menu>.ff-button{margin:2px 0;box-sizing:border-box;-webkit-tap-highlight-color:transparent;width:38px;height:38px;background-color:rgba(31,36,38,0.8);border-radius:20px;font-size:17px;transition:all .15s;pointer-events:auto}.sv-main-menu>.ff-button .ff-text{color:#a0a0a0}.sv-main-menu>.ff-button:focus{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-main-menu>.ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-main-menu>.ff-button:focus-visible{outline:none;background-color:rgba(31,36,38,0.8);box-shadow:0 0 3pt 2pt #bfedff}.sv-main-menu>.ff-button:hover{background-color:rgba(74,82,87,0.5);fill:#c8c8c8}.sv-main-menu>.ff-button:hover>.ff-text{color:#c8c8c8}.sv-main-menu>.ff-button[selected]{background-color:#0089bf;color:#f0f0f0}.sv-main-menu>.ff-button[selected]>.ff-icon{filter:drop-shadow(1px 1px 6px #00648c);fill:#c8c8c8}.sv-main-menu>.ff-button[selected]:hover,.sv-main-menu>.ff-button[selected]:focus{background-color:#00a6e8}.sv-main-menu .sv-scroll-btn{border-radius:2px;font-size:10px;height:19px;background-color:#343434;z-index:2;padding:0px;position:sticky}.sv-main-menu .sv-scroll-btn.up{top:0px;margin-top:0px}.sv-main-menu .sv-scroll-btn.down{bottom:12px;margin-top:12px}.sv-main-menu .sv-scroll-btn:hover{background-color:#676767;fill:#c8c8c8}.sv-main-menu .sv-scroll-btn:focus,.sv-main-menu .sv-scroll-btn:focus-visible{background-color:#343434}.sv-share-menu{position:relative;width:450px;max-width:85%;padding:8px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);pointer-events:auto}.sv-share-menu .ff-title{margin:0.5em 0 1em 0}.sv-share-menu .ff-button{flex:0 0 auto}.sv-share-menu .ff-text-edit{height:6.5em}.sv-share-menu .sv-share-buttons .ff-button{width:48px;height:48px;border-radius:48px;margin:0 1em 1em 0;padding:0}.sv-share-menu .sv-share-buttons .ff-button .ff-icon{height:30px;fill:#f0f0f0}.sv-share-menu .sv-share-button-twitter{background-color:#00aced}.sv-share-menu .sv-share-button-twitter:focus{outline:none;background-color:#00aced;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-twitter:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-twitter:focus-visible{outline:none;background:#00aced;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-twitter:hover{background-color:#21c2ff}.sv-share-menu .sv-share-button-facebook{background-color:#3c5a99}.sv-share-menu .sv-share-button-facebook:focus{outline:none;background-color:#3c5a99;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-facebook:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-facebook:focus-visible{outline:none;background:#3c5a99;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-facebook:hover{background-color:#4e71ba}.sv-share-menu .sv-share-button-linkedin{background-color:#0077B5}.sv-share-menu .sv-share-button-linkedin:focus{outline:none;background-color:#0077B5;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-linkedin:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-linkedin:focus-visible{outline:none;background:#0077B5;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-linkedin:hover{background-color:#0099e8}.sv-share-menu .sv-share-button-email{background-color:#d28842}.sv-share-menu .sv-share-button-email:focus{outline:none;background-color:#d28842;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-email:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-share-menu .sv-share-button-email:focus-visible{outline:none;background:#d28842;box-shadow:0 0 3pt 2pt #bfedff}.sv-share-menu .sv-share-button-email:hover{background-color:#dca26b}.sv-document-overlay{position:absolute;left:52px;top:52px;right:6px;bottom:0;pointer-events:auto}.sv-tour-menu .sv-article,.sv-reader-view .sv-article{position:relative}.sv-tour-menu .sv-article .sv-nav-button,.sv-reader-view .sv-article .sv-nav-button{float:right;margin:1em 0.5em;padding:2px}.sv-tour-menu .sv-article .sv-nav-button .ff-icon,.sv-reader-view .sv-article .sv-nav-button .ff-icon{height:1.5em}.sv-tour-menu .sv-entry,.sv-reader-view .sv-entry{position:relative;cursor:pointer;padding:5px 0 5px 15px;margin:2px 2px 16px 2px;max-width:960px;background-color:rgba(27,34,38,0.5)}.sv-tour-menu .sv-entry:hover,.sv-reader-view .sv-entry:hover{background-color:rgba(51,59,64,0.5)}.sv-tour-menu .sv-entry .sv-titlebar,.sv-reader-view .sv-entry .sv-titlebar{display:flex}.sv-tour-menu .sv-entry .ff-icon,.sv-reader-view .sv-entry .ff-icon{margin:auto 10px auto auto;height:1.5em;border-radius:60px;border-style:solid;box-shadow:0 0 2px #a0a0a0;padding:0.6em 0.6em}.sv-option-menu{position:relative;width:225px;max-width:85%;height:200px;max-height:85%;padding:8px;background:#343434;box-shadow:0 0 20px rgba(0,0,0,0.35);pointer-events:auto}.sv-option-menu .ff-title{margin:0.3em 0 0.3em 0.3em}.sv-option-menu .ff-header{padding:0.3em 0 0.3em 0.3em;background:rgba(31,36,38,0.8)}.sv-option-menu .ff-button{flex:0 0 auto}.sv-option-menu .sv-scroll-offset{top:50px}.sv-option-menu .sv-centered{justify-content:center;padding:0.3em 0 0.3em 0.3em}.sv-option-menu .sv-entry{position:relative;cursor:pointer;padding:5px 0 5px 15px;margin-bottom:2px;max-width:960px;background-color:rgba(27,34,38,0.5);user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-option-menu .sv-entry:focus{outline:2px solid #bfedff;outline-offset:-2px;background-color:rgba(27,34,38,0.5)}.sv-option-menu .sv-entry:focus:not(:focus-visible){outline:0}.sv-option-menu .sv-entry:focus-visible{outline:2px solid #bfedff;outline-offset:-2px;background-color:rgba(27,34,38,0.5)}.sv-option-menu .sv-entry:hover{background-color:rgba(51,59,64,0.5);fill:#c8c8c8}.sv-option-menu .sv-entry[selected]{background-color:#0089bf;color:#f0f0f0}.sv-option-menu .sv-entry[selected]:hover,.sv-option-menu .sv-entry[selected]:focus{background-color:#00a6e8}.sv-main-help{position:relative;width:90%;height:90%;padding:8px;background:#343434;pointer-events:auto}.sv-main-help .sv-help-section{display:flex;text-align:center;width:33%;min-width:180px;max-height:90%;flex-direction:column;justify-content:center;margin-top:20px;margin-bottom:20px}.sv-main-help .sv-help-short{min-width:100px}.sv-main-help .sv-help-row{display:flex;flex-wrap:wrap;height:90%;justify-content:center;overflow:auto}.sv-main-help .sv-help-text{padding:5px 5px 0px 5px;display:flex;align-items:center;justify-content:center}.sv-main-help .sv-help-region{height:100%;display:flex;flex-direction:column}.sv-main-help .ff-icon{height:2rem}.sv-main-help .sv-commands{flex:0 0 auto;display:flex;flex-wrap:wrap;padding:2px}.sv-main-help .sv-commands .ff-button{width:50%;min-width:100px}.sv-bottom-bar-container{position:relative;display:flex;justify-content:center;transition:transform .3s ease-out,opacity .15s ease-out;z-index:1}.sv-bottom-bar-container.sv-transition{transform:translateY(40px);opacity:0}.sv-bottom-bar-container .ff-button{transition:all .15s}.sv-blue-bar{flex:0 1 960px;display:flex;flex-direction:column;background-color:rgba(5,7,8,0.85);border-left:1px solid rgba(0,137,191,0.5);border-right:1px solid rgba(0,137,191,0.5);margin:0 -1px 0 -1px;min-width:0px;pointer-events:auto;user-select:none;-moz-user-select:none;-webkit-user-select:none}.sv-blue-bar .sv-group{display:flex;flex-direction:column}.sv-blue-bar .sv-section{position:relative;display:flex;flex-direction:row;border-top:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-section-lead,.sv-blue-bar .sv-section-trail{flex:0 0 auto;padding:6px;width:38px}.sv-blue-bar .sv-section-lead:hover,.sv-blue-bar .sv-section-trail:hover{background-color:rgba(74,82,87,0.5)}.sv-blue-bar .sv-section-lead{border-right:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-section-trail{border-left:1px solid rgba(0,137,191,0.5)}.sv-blue-bar .sv-transparent-button{flex:0 1 auto;padding:6px;border-radius:2px}.sv-blue-bar .sv-transparent-button .ff-text{margin:1px 2px}.sv-blue-bar .sv-transparent-button .ff-icon{height:22px;margin:1px 2px}.sv-tour-navigator{color:#c8c8c8}.sv-tour-navigator .sv-content{flex:1;margin:2px 8px;text-align:center}.sv-tour-navigator .sv-title{font-size:1.1em}@keyframes ticker{100%{transform:translateX(var(--x-offset))}}.sv-tour-navigator .sv-text{font-size:0.9em}.sv-text-scroll{animation:ticker 1s linear 1;text-overflow:clip}.sv-target-navigator .sv-content{flex:1;margin:2px 8px;text-align:center}.sv-target-navigator .sv-title{font-size:1.1em}.sv-tag-cloud .sv-tag-buttons{flex:1 1 auto;display:flex;flex-wrap:wrap;justify-content:center;margin:4px}.sv-tag-cloud .sv-tag-button{flex:0 1 auto;margin:3px 3px;padding:2px 4px;background-color:rgba(31,36,38,0.8);border-radius:3px;font-size:0.88em}.sv-tag-cloud .sv-tag-button:hover{background-color:rgba(74,82,87,0.5)}.sv-tag-cloud .sv-tag-button[selected]{background-color:#0089bf}.sv-tag-cloud .sv-tag-button .ff-text{margin:1px 2px}.sv-tag-cloud .sv-tag-button .ff-icon{height:22px;margin:1px 2px}.sv-property .ff-input{min-width:auto;width:0;margin:0;padding:2px}.sv-property .ff-input,.sv-property select{text-align:right;background-image:none;appearance:auto}.sv-property .ff-input:focus,.sv-property select:focus{text-align:left}.sv-property.sv-property-color input[type="color"]{cursor:pointer;border:none;margin:2px;height:26px;inline-size:26px;padding:1px;background:#343434;border-radius:2px}.sv-property.sv-property-color input[type="color"]::-webkit-color-swatch-wrapper{padding:0}.sv-property.sv-property-color input[type="color"]::-webkit-color-swatch,.sv-property.sv-property-color input[type="color"]::-moz-color-swatch{border:none;border-radius:2px}.sv-property.sv-property-number .sv-property-field{position:relative;touch-action:none;display:inline-flex}.sv-property.sv-property-number .sv-property-field .ff-bar{background:#272727;position:absolute;inset:0;margin:0;width:0;box-sizing:border-box;border:2px solid #1b1b1b}.sv-property.sv-property-number .sv-property-field .ff-input,.sv-property.sv-property-number .sv-property-field .ff-unit{position:relative;touch-action:none}.sv-property.sv-property-number .sv-property-field .ff-bar,.sv-property.sv-property-number .sv-property-field .ff-unit{pointer-events:none;user-select:none}.sv-property.sv-property-slider{flex:0 2 180px}.sv-property.sv-property-slider .ff-linear-slider{height:6px;margin:12px 2px;padding-right:16px;border-radius:2px;background-color:#4e4e4e}.sv-property.sv-property-slider .ff-linear-slider .ff-knob{width:16px;height:26px;margin:-10px 0 0 0;border-radius:2px;background-color:#0089bf;box-shadow:0 0 6px black}.sv-property.sv-property-options .sv-options-buttons{display:flex;flex-wrap:wrap;justify-content:center;padding:2px 0;gap:2px}.sv-property.sv-property-options .sv-options-buttons .ff-button.ff-control{flex:0 1 auto}.sv-tool-bar{color:#c8c8c8;pointer-events:auto}.sv-tool-bar .sv-tool-buttons{flex:1 1 auto;display:flex;margin:4px;overflow-x:auto}.sv-tool-bar .sv-tool-buttons .sv-tool-button:first-child{margin-left:auto}.sv-tool-bar .sv-tool-buttons .sv-tool-button:last-child{margin-right:auto}.sv-tool-bar .sv-tool-button{flex:0 1 auto;margin:2px;padding:1px 2px;border-radius:3px;font-size:0.882em}.sv-tool-bar .sv-tool-button .ff-text{margin:1px 2px}.sv-tool-bar .sv-tool-button .ff-icon{height:22px;margin:1px 2px}.sv-tool-bar-container{position:relative;bottom:0px;width:100%}.sv-tool-controls{flex:1 1 auto;display:flex;justify-content:center;align-items:center;font-size:0.882em}.sv-tool-controls .sv-property{flex:0 1 auto;align-self:start;display:flex;flex-direction:column;margin:4px}.sv-tool-controls .sv-property label{height:1.25em}.sv-tool-controls .sv-property.sv-nogap{margin:4px 0 !important}.sv-tool-controls .sv-property.sv-property-slider{flex:0 2 180px}.sv-tool-controls .sv-options{display:flex}.sv-tool-controls .ff-label{margin:2px}.sv-tool-controls .ff-string{flex:0 1 auto;height:26px;margin:2px;font-size:1.34em}.sv-tool-controls .ff-button{height:26px;margin:2px;padding:0 4px;background:#343434;border-radius:2px}.sv-tool-controls .ff-button:focus{outline:none;background:#343434;box-shadow:0 0 3pt 2pt #bfedff}.sv-tool-controls .ff-button:focus:not(:focus-visible){outline:0;box-shadow:0 0}.sv-tool-controls .ff-button:focus-visible{outline:none;background:#343434;box-shadow:0 0 3pt 2pt #bfedff}.sv-tool-controls .ff-button:hover{background-color:#676767;fill:#c8c8c8}.sv-view-tool-view .sv-options,.sv-render-tool-view .sv-options,.sv-light-tool-view .sv-options{flex-wrap:wrap}.sv-tape-tool-view .sv-tool-controls,.sv-slice-tool-view .sv-tool-controls,.sv-environment-tool-view .sv-tool-controls{flex-wrap:wrap}.sv-action-prompt{height:30px;width:30px;fill:#fff}.sv-caption-view{position:absolute;bottom:10%;z-index:2;font-size:1.5rem;justify-content:center;display:flex;width:100%}.sv-caption-box{position:relative;text-align:center;background-color:rgba(0,0,0,0.85);max-width:85%}.sv-splash{padding:7px;pointer-events:auto;background-color:rgba(54,61,64,0.6);max-width:min(80%, 800px);min-width:50%;max-height:90%;overflow-y:auto}.sv-splash>:focus-visible{outline:none;box-shadow:0 0}.sv-audio-view{display:flex;align-items:center;flex:1 1 auto;max-width:100%;min-width:110px;height:30px;background-color:#f0f0f0;border-radius:15px;color:black;cursor:auto}.sv-audio-view>.ff-button{width:30px;height:30px;border-radius:15px;flex:0 1 auto;padding:0px;margin-right:3px;background-color:#f0f0f0;-webkit-tap-highlight-color:transparent}.sv-audio-view>.ff-button .ff-icon{height:1.5em;margin:5px;fill:black}.sv-audio-view>.ff-button:focus{background-color:#f0f0f0}.sv-audio-view>.ff-button:hover{background-color:#a4a4a4}.sv-audio-view>.ff-button:hover>.ff-icon{fill:black}.sv-audio-view .sv-timer{font-size:small;display:flex}.sv-audio-view input{width:100%;margin-left:3px;margin-right:3px}.sv-narrate-player{position:absolute;pointer-events:auto;width:200px;max-width:75%;margin:auto auto;left:0;right:0;z-index:4;padding-top:6px}\n',e.appendChild(t);const n=this.application.system;e.appendChild(new Q(n)),e.appendChild(new Ge(n));const i=document.createElement("div");i.setAttribute("id",l.ZP.stackId),e.appendChild(i),l.ZP.shadowRootNode=e;const s=document.createElement("div");s.classList.add("sr-only"),s.setAttribute("id","sr-intro"),s.setAttribute("aria-live","polite"),e.appendChild(s)}connected(){this.fullscreen.fullscreenElement=this,this.viewer.rootElement=this,this.arManager.shadowRoot=this.shadowRoot}disconnected(){super.disconnected(),this.fullscreen.fullscreenElement=null,this.viewer.rootElement=null,window.VoyagerStory||(this.application.dispose(),this.application=null)}attributeChangedCallback(e,t,n){const i=this.application;if(super.attributeChangedCallback(e,t,n),i&&"root"===e){const e=this.getAttribute("root");e.length>0&&(i.props.root=e,i.reloadDocument(),this.connected())}else i&&"document"===e?(i.props.document=this.getAttribute("document"),i.reloadDocument(),this.connected()):i&&"controls"===e&&i.enableNavigation(n)}onFocus(){this.shadowRoot.getElementById("sr-intro").innerText="The Voyager web application allows you to view and interact with a 3D model from the Smithsonian collection. Use the tab key to move through interactive elements, enter or spacebar keys to activate, and the escape key to exit menus."}toggleAnnotations(){this.application&&this.application.toggleAnnotations()}toggleReader(){this.application&&this.application.toggleReader()}toggleTours(){this.application&&this.application.toggleTours()}toggleTools(){this.application&&this.application.toggleTools()}toggleMeasurement(){this.application&&this.application.toggleMeasurement()}enableAR(){this.application&&this.application.enableAR()}getArticles(){if(this.application){return this.application.getArticles()}}getAnnotations(){if(this.application){return this.application.getAnnotations()}}getCameraOrbit(e){if(this.application){return this.application.getCameraOrbit(e||null)}}setCameraOrbit(e,t){this.application&&this.application.setCameraOrbit(e,t)}getCameraOffset(e){if(this.application){return this.application.getCameraOffset(e||null)}}setCameraOffset(e,t,n){this.application&&this.application.setCameraOffset(e,t,n)}setBackgroundColor(e,t){this.application&&this.application.setBackgroundColor(e,t||null)}setBackgroundStyle(e){this.application&&this.application.setBackgroundStyle(e)}setActiveAnnotation(e){this.application&&this.viewer.ins.activeAnnotation.setValue(e)}setActiveArticle(e){this.application&&this.application.setActiveArticle(e)}setTourStep(e,t,n){this.application&&this.application.setTourStep(e,t,void 0===n||n)}setLanguage(e){this.application&&this.application.setLanguage(e)}};We=Ze([(0,o.Mo)("voyager-explorer")],We);const qe=We},11598:(e,t,n)=>{"use strict";n.d(t,{Cb:()=>i.Cb,Mo:()=>i.Mo,ZP:()=>o,dy:()=>i.dy});var i=n(51120),s=n(31491),r=n(47425);class o extends r.ZP{constructor(){super(...arguments),this.activeNode=null}get nodeProvider(){return this.system.getMainComponent(s.Z)}connected(){super.connected();const e=this.nodeProvider;e.on("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=e.activeNode,this.onActiveNode(null,e.activeNode))}disconnected(){const e=this.nodeProvider;e.off("active-node",this.onActiveNodeEvent,this),e.activeNode&&(this.activeNode=null,this.onActiveNode(e.activeNode,null)),super.disconnected()}onActiveNode(e,t){this.requestUpdate()}onActiveNodeEvent(e){this.activeNode=e.next,this.onActiveNode(e.previous,e.next)}}},88300:(e,t,n)=>{"use strict";n.d(t,{k:()=>r,u:()=>s});var i=n(82587);function s(e,t,n){return Math.min(Math.max(e,t),n)}function r(e,t){var n=new i.y,s=new i.y;n.identity();do{s.compose(t.position,t.quaternion,t.scale),n.multiply(s.invert()),t=t.parent}while(e!==t);return n}},53310:(e,t,n)=>{"use strict";n.d(t,{G:()=>i,e:()=>s});function i(e){return[...e.querySelectorAll('a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden")&&"-1"!==e.getAttribute("tabindex")))}function s(e,t){const n=e[0],i=e[e.length-1];t.shiftKey?t.target===n&&(t.preventDefault(),i.focus()):t.target===i&&(t.preventDefault(),n.focus())}},15577:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(1594);const s={mm:{mm:1,cm:.1,m:.001,km:1,in:.0393701,ft:.00328084,yd:.00109361,mi:1},cm:{mm:10,cm:1,m:.01,km:1,in:.393701,ft:.0328084,yd:.0109361,mi:1},m:{mm:1e3,cm:100,m:1,km:1,in:39.3701,ft:3.28084,yd:1.09361,mi:1},km:{mm:1e6,cm:1e5,m:1e3,km:1,in:39370.1,ft:3280.84,yd:1093.61,mi:1},in:{mm:25.4,cm:2.54,m:.0254,km:1,in:1,ft:.0833333,yd:.0277778,mi:1},ft:{mm:304.8,cm:30.48,m:.3048,km:1,in:12,ft:1,yd:.333334,mi:1},yd:{mm:914.4,cm:91.44,m:.9144,km:1,in:36,ft:3,yd:1,mi:1},mi:{mm:1609e3,cm:160900,m:1609,km:1,in:63346456.693,ft:5278871.391,yd:1759623.797,mi:1}};function r(e,t){const n=i.f_[e],r=i.f_[t];return s[n][r]||1}},19853:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var i=n(10613),s=n(53868);const r=new WeakMap,o=(0,s.XM)((e=>t=>{if(!(t instanceof s.nt))throw new Error("unsafeHTML can only be used in text bindings");const n=r.get(t);if(void 0!==n&&(0,i.pt)(e)&&e===n.value&&t.value===n.fragment)return;const o=document.createElement("template");o.innerHTML=e;const a=document.importNode(o.content,!0);t.setValue(a),r.set(t,{value:e,fragment:a})}))},25352:(e,t,n)=>{"use strict";n.d(t,{X:()=>s,w:()=>r});const i=new WeakMap,s=e=>(...t)=>{const n=e(...t);return i.set(n,!0),n},r=e=>"function"==typeof e&&i.has(e)},93909:(e,t,n)=>{"use strict";n.d(t,{V:()=>s,eC:()=>i,r4:()=>r});const i="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,s=(e,t,n=null,i=null)=>{for(;t!==n;){const n=t.nextSibling;e.insertBefore(t,i),t=n}},r=(e,t,n=null)=>{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}}},66390:(e,t,n)=>{"use strict";n.d(t,{J:()=>i,L:()=>s});const i={},s={}},10613:(e,t,n)=>{"use strict";n.d(t,{JG:()=>m,K1:()=>y,QG:()=>d,_l:()=>u,m:()=>f,nt:()=>p,pt:()=>c,sL:()=>g});var i=n(25352),s=n(93909),r=n(66390),o=n(66825),a=n(47275),l=n(14056);const c=e=>null===e||!("object"==typeof e||"function"==typeof e),h=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class d{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e{try{const e={get capture(){return v=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class y{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;(0,i.w)(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=r.J,e(this)}if(this.__pendingValue===r.J)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),s=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=b(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=r.J}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const b=e=>e&&(v?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)},44574:(e,t,n)=>{"use strict";n.d(t,{L:()=>o,s:()=>a});var i=n(93909),s=n(10613),r=n(41998);const o=new WeakMap,a=(e,t,n)=>{let a=o.get(t);void 0===a&&((0,i.r4)(t,t.firstChild),o.set(t,a=new s.nt(Object.assign({templateFactory:r.t},n))),a.appendInto(t)),a.setValue(e),a.commit()}},41998:(e,t,n)=>{"use strict";n.d(t,{r:()=>r,t:()=>s});var i=n(14056);function s(e){let t=r.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},r.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const s=e.strings.join(i.Jw);return n=t.keyString.get(s),void 0===n&&(n=new i.YS(e,e.getTemplateElement()),t.keyString.set(s,n)),t.stringsArray.set(e.strings,n),n}const r=new Map},66825:(e,t,n)=>{"use strict";n.d(t,{R:()=>r});var i=n(93909),s=n(14056);class r{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=i.eC?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let o,a=0,l=0,c=r.nextNode();for(;a{"use strict";n.d(t,{j:()=>o});n(93909);var i=n(14056);const s=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),r=` ${i.Jw} `;class o{constructor(e,t,n,i){this.strings=e,this.values=t,this.type=n,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let s=0;s-1||n)&&-1===e.indexOf("--\x3e",o+1);const a=i.W5.exec(e);t+=null===a?e+(n?r:i.N):e.substr(0,a.index)+a[1]+a[2]+i.$E+a[3]+i.Jw}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==s&&(t=s.createHTML(t)),e.innerHTML=t,e}}},14056:(e,t,n)=>{"use strict";n.d(t,{$E:()=>o,IW:()=>h,Jw:()=>i,N:()=>s,W5:()=>d,YS:()=>a,pC:()=>c});const i=`{{lit-${String(Math.random()).slice(2)}}}`,s=`\x3c!--${i}--\x3e`,r=new RegExp(`${i}|${s}`),o="$lit$";class a{constructor(e,t){this.parts=[],this.element=t;const n=[],s=[],a=document.createTreeWalker(t.content,133,null,!1);let c=0,u=-1,p=0;const{strings:m,values:{length:f}}=e;for(;p0;){const t=m[p],n=d.exec(t)[2],i=n.toLowerCase()+o,s=e.getAttribute(i);e.removeAttribute(i);const a=s.split(r);this.parts.push({type:"attribute",index:u,name:n,strings:a}),p+=a.length-1}}"TEMPLATE"===e.tagName&&(s.push(e),a.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(i)>=0){const i=e.parentNode,s=t.split(r),a=s.length-1;for(let t=0;t{const n=e.length-t.length;return n>=0&&e.slice(n)===t},c=e=>-1!==e.index,h=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/},53868:(e,t,n)=>{"use strict";n.d(t,{_l:()=>i._l,JG:()=>i.JG,K1:()=>i.K1,nt:()=>i.nt,sL:()=>i.sL,IW:()=>c.IW,XM:()=>o.X,dy:()=>h,r4:()=>a.r4,sY:()=>l.s,V:()=>a.V});var i=n(10613);const s=new class{handleAttributeExpressions(e,t,n,s){const r=t[0];if("."===r){return new i.m(e,t.slice(1),n).parts}if("@"===r)return[new i.K1(e,t.slice(1),s.eventContext)];if("?"===r)return[new i.JG(e,t.slice(1),n)];return new i.QG(e,t,n).parts}handleTextExpression(e){return new i.nt(e)}};var r=n(47275),o=n(25352),a=n(93909),l=(n(66390),n(44574)),c=(n(41998),n(66825),n(14056));"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const h=(e,...t)=>new r.j(e,t,"html",s)},60531:(e,t,n)=>{"use strict";n.d(t,{H:()=>s});var i=n(67440);class s extends i.c{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}},68347:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var i=n(75544),s=n(82587),r=n(25499);class o extends r.T{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new s.y,this.projectionMatrix=new s.y,this.projectionMatrixInverse=new s.y,this.coordinateSystem=i._RZ}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}},53203:(e,t,n)=>{"use strict";n.d(t,{_:()=>a});var i=n(75544),s=n(25499),r=n(67440);const o=-90;class a extends s.T{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new r.c(o,1,e,t);i.layers=this.layers,this.add(i);const s=new r.c(o,1,e,t);s.layers=this.layers,this.add(s);const a=new r.c(o,1,e,t);a.layers=this.layers,this.add(a);const l=new r.c(o,1,e,t);l.layers=this.layers,this.add(l);const c=new r.c(o,1,e,t);c.layers=this.layers,this.add(c);const h=new r.c(o,1,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,s,r,o,a,l]=t;for(const e of t)this.remove(e);if(e===i._RZ)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else{if(e!==i.JCZ)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,r,o,a,l,c]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,r),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,a),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,d,u),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}},62257:(e,t,n)=>{"use strict";n.d(t,{i:()=>s});var i=n(68347);class s extends i.V{constructor(e=-1,t=1,n=1,i=-1,s=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,r){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,r=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=e*this.view.offsetX,r=s+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(s,r,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}},67440:(e,t,n)=>{"use strict";n.d(t,{c:()=>r});var i=n(68347),s=n(71050);class r extends i.V{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*s.I3*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*s.qW*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*s.I3*Math.atan(Math.tan(.5*s.qW*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,r){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*s.qW*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const e=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/e,t-=o.offsetY*n/s,i*=o.width/e,n*=o.height/s}const a=this.filmOffset;0!==a&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}},75544:(e,t,n)=>{"use strict";n.d(t,{$wi:()=>ie,AmZ:()=>Bt,BFQ:()=>je,BG$:()=>st,BVF:()=>F,Bf4:()=>ce,CaW:()=>Xe,CdI:()=>Q,CtA:()=>Fe,Cy:()=>k,D1R:()=>be,D67:()=>Xt,D9w:()=>Ve,Djp:()=>it,E2K:()=>Be,EoG:()=>J,F1y:()=>Yt,FUD:()=>ht,FVh:()=>Gt,GG6:()=>lt,GUF:()=>zt,Gih:()=>ct,HdW:()=>gt,Hy8:()=>N,IFH:()=>Tt,ILR:()=>Ge,IOt:()=>Ot,JCZ:()=>an,JQ4:()=>Ee,Jjb:()=>en,KI_:()=>Vt,KhW:()=>C,Kz5:()=>Me,LSk:()=>sn,LY2:()=>te,L_r:()=>rn,LgZ:()=>R,LsT:()=>Se,M$G:()=>Kt,M5h:()=>y,M6v:()=>W,N4l:()=>v,NDo:()=>Y,NKc:()=>z,NMF:()=>xt,NYV:()=>rt,Ns1:()=>q,O78:()=>Qt,OTo:()=>Le,OoA:()=>pe,PA7:()=>Ut,PeU:()=>s,Pnf:()=>St,QO2:()=>ft,RlZ:()=>O,S2y:()=>o,Se2:()=>B,Sm8:()=>M,SvJ:()=>ut,Syv:()=>_t,T6w:()=>tn,T95:()=>xe,TyD:()=>me,UZH:()=>i,UlW:()=>Pt,Vdb:()=>D,Vtg:()=>Ht,VzW:()=>Te,W2J:()=>nn,WMw:()=>g,Wbm:()=>x,Wl3:()=>d,Wpd:()=>I,WwZ:()=>At,Xaj:()=>b,Y8D:()=>De,YGz:()=>ee,YLQ:()=>fe,ZTh:()=>yt,Zen:()=>Jt,Zr5:()=>$,_AM:()=>Ze,_Li:()=>u,_MY:()=>a,_RZ:()=>on,_iA:()=>l,_lf:()=>Mt,_sL:()=>Et,_wr:()=>U,aCh:()=>kt,aH4:()=>ge,av9:()=>ze,bGH:()=>_,bdR:()=>f,brP:()=>Ue,bsb:()=>pt,c8b:()=>E,cLu:()=>Ce,cRx:()=>Ie,cum:()=>Wt,dSO:()=>le,dZ3:()=>ne,dwk:()=>h,eD:()=>H,eaV:()=>qe,ehD:()=>p,ekQ:()=>Je,f2y:()=>mt,fSK:()=>L,fY$:()=>oe,fto:()=>Ye,g8_:()=>he,gSk:()=>Ct,ghN:()=>T,gi4:()=>nt,hEm:()=>ke,iAb:()=>we,iWC:()=>A,iiP:()=>dt,irR:()=>Pe,j17:()=>jt,jFi:()=>m,jZA:()=>et,jes:()=>V,k0A:()=>Ae,k74:()=>P,knz:()=>Nt,ksN:()=>G,l0P:()=>Ke,l6D:()=>$t,lGU:()=>bt,mSO:()=>It,msZ:()=>se,ntZ:()=>c,ntt:()=>Ft,pIN:()=>wt,pKu:()=>at,ptH:()=>Qe,qhX:()=>X,qkB:()=>Oe,qyh:()=>ye,rOj:()=>w,r_:()=>S,rnI:()=>Lt,rpg:()=>de,tm_:()=>r,uL9:()=>K,uWy:()=>ue,v3W:()=>He,vCF:()=>j,vCx:()=>We,vuL:()=>vt,vxC:()=>ae,w$m:()=>Z,wJv:()=>Re,wem:()=>ve,wk1:()=>Ne,wuA:()=>$e,x5V:()=>Zt,xJs:()=>ot,xfE:()=>re,xoQ:()=>qt,y2t:()=>tt,ywz:()=>_e,z$h:()=>Rt,z81:()=>Dt});const i="158",s=0,r=1,o=2,a=0,l=1,c=2,h=3,d=0,u=1,p=2,m=0,f=1,g=2,v=3,y=4,b=5,_=100,x=101,w=102,S=103,M=104,E=200,T=201,C=202,A=203,P=204,R=205,L=206,N=207,D=208,I=209,O=210,U=211,k=212,V=213,z=214,F=0,B=1,$=2,j=3,H=4,G=5,Z=6,W=7,q=0,X=1,Y=2,K=0,J=1,Q=2,ee=3,te=4,ne=5,ie="attached",se="detached",re=300,oe=301,ae=302,le=303,ce=304,he=306,de=1e3,ue=1001,pe=1002,me=1003,fe=1004,ge=1005,ve=1006,ye=1007,be=1008,_e=1009,xe=1010,we=1011,Se=1012,Me=1013,Ee=1014,Te=1015,Ce=1016,Ae=1017,Pe=1018,Re=1020,Le=1021,Ne=1023,De=1024,Ie=1025,Oe=1026,Ue=1027,ke=1028,Ve=1029,ze=1030,Fe=1031,Be=1033,$e=33776,je=33777,He=33778,Ge=33779,Ze=35840,We=35841,qe=35842,Xe=35843,Ye=36196,Ke=37492,Je=37496,Qe=37808,et=37809,tt=37810,nt=37811,it=37812,st=37813,rt=37814,ot=37815,at=37816,lt=37817,ct=37818,ht=37819,dt=37820,ut=37821,pt=36492,mt=36494,ft=36495,gt=36283,vt=36284,yt=36285,bt=36286,_t=2300,xt=2301,wt=2302,St=2400,Mt=2401,Et=2402,Tt=2500,Ct=2501,At=0,Pt=1,Rt=2,Lt=3e3,Nt=3001,Dt=3200,It=3201,Ot=0,Ut=1,kt="",Vt="srgb",zt="srgb-linear",Ft="display-p3",Bt="display-p3-linear",$t="linear",jt="srgb",Ht="rec709",Gt="p3",Zt=7680,Wt=519,qt=512,Xt=513,Yt=514,Kt=515,Jt=516,Qt=517,en=518,tn=519,nn=35044,sn="300 es",rn=1035,on=2e3,an=2001},35322:(e,t,n)=>{"use strict";n.d(t,{Tl:()=>c,a$:()=>u,lC:()=>d,ql:()=>h});var i=n(19588),s=n(40693),r=n(71050),o=n(75544);const a=new i.P,l=new s.F;class c{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=o.W2J,this.updateRange={offset:0,count:-1},this.gpuType=o.VzW,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i{"use strict";n.d(t,{u:()=>x});var i=n(19588),s=n(40693),r=n(37840),o=n(19251),a=n(35322),l=n(57471),c=n(25499),h=n(82587),d=n(23130),u=n(71050),p=n(19564);let m=0;const f=new h.y,g=new c.T,v=new i.P,y=new r.Z,b=new r.Z,_=new i.P;class x extends o.p{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:m++}),this.uuid=u.DO(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new((0,p.H7)(e)?a.lC:a.ql)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new d.V).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return f.makeRotationFromQuaternion(e),this.applyMatrix4(f),this}rotateX(e){return f.makeRotationX(e),this.applyMatrix4(f),this}rotateY(e){return f.makeRotationY(e),this.applyMatrix4(f),this}rotateZ(e){return f.makeRotationZ(e),this.applyMatrix4(f),this}translate(e,t,n){return f.makeTranslation(e,t,n),this.applyMatrix4(f),this}scale(e,t,n){return f.makeScale(e,t,n),this.applyMatrix4(f),this}lookAt(e){return g.lookAt(e),g.updateMatrix(),this.applyMatrix4(g.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(v).negate(),this.translate(v.x,v.y,v.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let s=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],r=[];for(let t=0,i=n.length;t0&&(i[t]=r,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const s=e.morphAttributes;for(const e in s){const n=[],i=s[e];for(let e=0,s=i.length;e{"use strict";n.d(t,{p:()=>i});class i{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t{"use strict";n.d(t,{v:()=>r});var i=n(71050),s=n(75544);class r{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=s.W2J,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=i.DO()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i{"use strict";n.d(t,{k:()=>a});var i=n(19588),s=n(35322),r=n(71050);const o=new i.P;class a{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t{"use strict";n.d(t,{S:()=>i});class i{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<{"use strict";n.d(t,{T:()=>M});var i=n(78943),s=n(19588),r=n(82587),o=n(19251),a=n(82954),l=n(45787),c=n(23130),h=n(71050);let d=0;const u=new s.P,p=new i._,m=new r.y,f=new s.P,g=new s.P,v=new s.P,y=new i._,b=new s.P(1,0,0),_=new s.P(0,1,0),x=new s.P(0,0,1),w={type:"added"},S={type:"removed"};class M extends o.p{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:d++}),this.uuid=h.DO(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=M.DEFAULT_UP.clone();const e=new s.P,t=new a.U,n=new i._,o=new s.P(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:o},modelViewMatrix:{value:new r.y},normalMatrix:{value:new c.V}}),this.matrix=new r.y,this.matrixWorld=new r.y,this.matrixAutoUpdate=M.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=M.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new l.S,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return p.setFromAxisAngle(e,t),this.quaternion.multiply(p),this}rotateOnWorldAxis(e,t){return p.setFromAxisAngle(e,t),this.quaternion.premultiply(p),this}rotateX(e){return this.rotateOnAxis(b,e)}rotateY(e){return this.rotateOnAxis(_,e)}rotateZ(e){return this.rotateOnAxis(x,e)}translateOnAxis(e,t){return u.copy(e).applyQuaternion(this.quaternion),this.position.add(u.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(b,e)}translateY(e){return this.translateOnAxis(_,e)}translateZ(e){return this.translateOnAxis(x,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(m.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?f.copy(e):f.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),g.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?m.lookAt(g,f,this.up):m.lookAt(f,g,this.up),this.quaternion.setFromRotationMatrix(m),i&&(m.extractRotation(i.matrixWorld),p.setFromRotationMatrix(m),this.quaternion.premultiply(p.invert()))}add(e){if(arguments.length>1){for(let e=0;e1){for(let e=0;e0&&(n=n.concat(s))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(g,e,v),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(g,y,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function r(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t{"use strict";n.d(t,{P:()=>o});var i=n(19564),s=n(19748);let r;class o{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===r&&(r=(0,i.c)("canvas")),r.width=e.width,r.height=e.height;const n=r.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=r}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=(0,i.c)("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),o=r.data;for(let e=0;e{"use strict";n.d(t,{a:()=>E});var i=n(75544),s=n(35322),r=n(75809),o=n(8035),a=n(62257),l=n(67440),c=n(44428),h=n(19588),d=n(93113),u=n(46953),p=n(24479),m=n(40071);const f=[.125,.215,.35,.446,.526,.582],g=20,v=new a.i,y=new d.I;let b=null,_=0,x=0;const w=(1+Math.sqrt(5))/2,S=1/w,M=[new h.P(1,1,1),new h.P(-1,1,1),new h.P(1,1,-1),new h.P(-1,1,-1),new h.P(0,w,S),new h.P(0,w,-S),new h.P(S,0,w),new h.P(-S,0,w),new h.P(w,S,0),new h.P(-w,S,0)];class E{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){b=this._renderer.getRenderTarget(),_=this._renderer.getActiveCubeFace(),x=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=P(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=A(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?c=f[l-e+4-1]:0===l&&(c=0),i.push(c);const h=1/(a-2),d=-h,u=1+h,p=[d,d,u,d,u,u,d,d,u,u,d,u],m=6,g=6,v=3,y=2,b=1,_=new Float32Array(v*g*m),x=new Float32Array(y*g*m),w=new Float32Array(b*g*m);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];_.set(i,v*g*e),x.set(p,y*g*e);const s=[e,e,e,e,e,e];w.set(s,b*g*e)}const S=new r.u;S.setAttribute("position",new s.Tl(_,v)),S.setAttribute("uv",new s.Tl(x,y)),S.setAttribute("faceIndex",new s.Tl(w,b)),t.push(S),o>4&&o--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(o)),this._blurMaterial=function(e,t,n){const s=new Float32Array(g),r=new h.P(0,1,0);return new c.j({name:"SphericalGaussianBlur",defines:{n:g,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:s},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:R(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:i.jFi,depthTest:!1,depthWrite:!1})}(o,e,t)}return o}_compileMaterial(e){const t=new o.K(this._lodPlanes[0],e);this._renderer.compile(t,v)}_sceneToCubeUV(e,t,n,s){const r=new l.c(90,1,t,n),a=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,u=h.toneMapping;h.getClearColor(y),h.toneMapping=i.uL9,h.autoClear=!1;const f=new p.v({name:"PMREM.Background",side:i._Li,depthWrite:!1,depthTest:!1}),g=new o.K(new m.D,f);let v=!1;const b=e.background;b?b.isColor&&(f.color.copy(b),e.background=null,v=!0):(f.color.copy(y),v=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(c[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,c[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,c[t]));const i=this._cubeSize;C(s,n*i,t>2?i:0,i,i),h.setRenderTarget(s),v&&h.render(g,r),h.render(e,r)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=u,h.autoClear=d,e.background=b}_textureToCubeUV(e,t){const n=this._renderer,s=e.mapping===i.fY$||e.mapping===i.vxC;s?(null===this._cubemapMaterial&&(this._cubemapMaterial=P()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=A());const r=s?this._cubemapMaterial:this._equirectMaterial,a=new o.K(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const l=this._cubeSize;C(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,v)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;tg&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const y=[];let b=0;for(let e=0;e_-4?i-_+4:0),4*(this._cubeSize-x),3*x,2*x),l.setRenderTarget(t),l.render(h,v)}}function T(e,t,n){const s=new u.d(e,t,n);return s.texture.mapping=i.g8_,s.texture.name="PMREM.cubeUv",s.scissorTest=!0,s}function C(e,t,n,i,s){e.viewport.set(t,n,i,s),e.scissor.set(t,n,i,s)}function A(){return new c.j({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:R(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:i.jFi,depthTest:!1,depthWrite:!1})}function P(){return new c.j({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:R(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:i.jFi,depthTest:!1,depthWrite:!1})}function R(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}},40071:(e,t,n)=>{"use strict";n.d(t,{D:()=>o});var i=n(75809),s=n(35322),r=n(19588);class o extends i.u{constructor(e=1,t=1,n=1,i=1,o=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:a};const l=this;i=Math.floor(i),o=Math.floor(o),a=Math.floor(a);const c=[],h=[],d=[],u=[];let p=0,m=0;function f(e,t,n,i,s,o,a,f,g,v,y){const b=o/g,_=a/v,x=o/2,w=a/2,S=f/2,M=g+1,E=v+1;let T=0,C=0;const A=new r.P;for(let r=0;r0?1:-1,d.push(A.x,A.y,A.z),u.push(a/g),u.push(1-r/v),T+=1}}for(let e=0;e{"use strict";n.d(t,{_:()=>r});var i=n(75809),s=n(35322);class r extends i.u{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,o=t/2,a=Math.floor(n),l=Math.floor(i),c=a+1,h=l+1,d=e/a,u=t/l,p=[],m=[],f=[],g=[];for(let e=0;e{"use strict";n.d(t,{O:()=>l});var i=n(19816),s=n(95687),r=n(62257);class o extends s.h{constructor(){super(new r.i(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}var a=n(25499);class l extends i._{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(a.T.DEFAULT_UP),this.updateMatrix(),this.target=new a.T,this.shadow=new o}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}},57090:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var i=n(19816),s=n(93113),r=n(25499);class o extends i._{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(r.T.DEFAULT_UP),this.updateMatrix(),this.groundColor=new s.I(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}},19816:(e,t,n)=>{"use strict";n.d(t,{_:()=>r});var i=n(25499),s=n(93113);class r extends i.T{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new s.I(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}},95687:(e,t,n)=>{"use strict";n.d(t,{h:()=>d});var i=n(82587),s=n(40693),r=n(19588),o=n(84538),a=n(53763);const l=new i.y,c=new r.P,h=new r.P;class d{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new s.F(512,512),this.map=null,this.mapPass=null,this.matrix=new i.y,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new a.i,this._frameExtents=new s.F(1,1),this._viewportCount=1,this._viewports=[new o.L(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;c.setFromMatrixPosition(e.matrixWorld),t.position.copy(c),h.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(h),t.updateMatrixWorld(),l.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(l),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(l)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}},54992:(e,t,n)=>{"use strict";n.d(t,{c:()=>m});var i=n(19816),s=n(95687),r=n(67440),o=n(82587),a=n(40693),l=n(19588),c=n(84538);const h=new o.y,d=new l.P,u=new l.P;class p extends s.h{constructor(){super(new r.c(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new a.F(4,2),this._viewportCount=6,this._viewports=[new c.L(2,1,1,1),new c.L(0,1,1,1),new c.L(3,1,1,1),new c.L(1,1,1,1),new c.L(3,0,1,1),new c.L(1,0,1,1)],this._cubeDirections=[new l.P(1,0,0),new l.P(-1,0,0),new l.P(0,0,1),new l.P(0,0,-1),new l.P(0,1,0),new l.P(0,-1,0)],this._cubeUps=[new l.P(0,1,0),new l.P(0,1,0),new l.P(0,1,0),new l.P(0,1,0),new l.P(0,0,1),new l.P(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),d.setFromMatrixPosition(e.matrixWorld),n.position.copy(d),u.copy(n.position),u.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(u),n.updateMatrixWorld(),i.makeTranslation(-d.x,-d.y,-d.z),h.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(h)}}class m extends i._{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new p}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}},50910:(e,t,n)=>{"use strict";n.d(t,{T:()=>s});var i=n(19816);class s extends i._{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}},16426:(e,t,n)=>{"use strict";n.d(t,{P:()=>c});var i=n(19816),s=n(95687),r=n(71050),o=n(67440);class a extends s.h{constructor(){super(new o.c(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*r.I3*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;n===t.fov&&i===t.aspect&&s===t.far||(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}var l=n(25499);class c extends i._{constructor(e,t,n=0,i=Math.PI/3,s=0,r=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(l.T.DEFAULT_UP),this.updateMatrix(),this.target=new l.T,this.distance=n,this.angle=i,this.penumbra=s,this.decay=r,this.map=null,this.shadow=new a}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}},58754:(e,t,n)=>{"use strict";n.d(t,{l:()=>i,t:()=>s});class i{constructor(e,t,n){const i=this;let s,r=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===r&&void 0!==i.onStart&&i.onStart(e,o,a),r=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t{"use strict";n.d(t,{n:()=>r});var i=n(63960),s=n(93113);class r extends i.F{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new s.I(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}},63960:(e,t,n)=>{"use strict";n.d(t,{F:()=>l});var i=n(93113),s=n(19251),r=n(75544),o=n(71050);let a=0;class l extends s.p{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:a++}),this.uuid=o.DO(),this.name="",this.type="Material",this.blending=r.bdR,this.side=r.Wl3,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=r.k74,this.blendDst=r.LgZ,this.blendEquation=r.bGH,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new i.I(0,0,0),this.blendAlpha=0,this.depthFunc=r.vCF,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=r.cum,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=r.x5V,this.stencilZFail=r.x5V,this.stencilZPass=r.x5V,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==r.bdR&&(n.blending=this.blending),this.side!==r.Wl3&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==r.k74&&(n.blendSrc=this.blendSrc),this.blendDst!==r.LgZ&&(n.blendDst=this.blendDst),this.blendEquation!==r.bGH&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==r.vCF&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==r.cum&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==r.x5V&&(n.stencilFail=this.stencilFail),this.stencilZFail!==r.x5V&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==r.x5V&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),s=i(e.images);t.length>0&&(n.textures=t),s.length>0&&(n.images=s)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}},24479:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var i=n(63960),s=n(75544),r=n(93113);class o extends i.F{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new r.I(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=s.Ns1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}},90652:(e,t,n)=>{"use strict";n.d(t,{l:()=>r});var i=n(63960),s=n(75544);class r extends i.F{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=s.z81,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}},35536:(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var i=n(63960);class s extends i.F{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}},41654:(e,t,n)=>{"use strict";n.d(t,{x:()=>a});var i=n(75544),s=n(63960),r=n(40693),o=n(93113);class a extends s.F{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new o.I(16777215),this.specular=new o.I(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new o.I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=i.IOt,this.normalScale=new r.F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=i.Ns1,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}},6965:(e,t,n)=>{"use strict";n.d(t,{W:()=>a});var i=n(75544),s=n(63960),r=n(40693),o=n(93113);class a extends s.F{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new o.I(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new o.I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=i.IOt,this.normalScale=new r.F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}},44428:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var i=n(63960),s=n(8173);class r extends i.F{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="\nvoid main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n",this.fragmentShader="\nvoid main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}\n",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=(0,s.dw)(e.uniforms),this.uniformsGroups=(0,s.fd)(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}},37840:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(19588);class s{constructor(e=new i.P(1/0,1/0,1/0),t=new i.P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,o),o.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(m),f.subVectors(this.max,m),l.subVectors(e.a,m),c.subVectors(e.b,m),h.subVectors(e.c,m),d.subVectors(c,l),u.subVectors(h,c),p.subVectors(l,h);let t=[0,-d.z,d.y,0,-u.z,u.y,0,-p.z,p.y,d.z,0,-d.x,u.z,0,-u.x,p.z,0,-p.x,-d.y,d.x,0,-u.y,u.x,0,-p.y,p.x,0];return!!y(t,l,c,h,f)&&(t=[1,0,0,0,1,0,0,0,1],!!y(t,l,c,h,f)&&(g.crossVectors(d,u),t=[g.x,g.y,g.z],y(t,l,c,h,f)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,o).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(o).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(r)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const r=[new i.P,new i.P,new i.P,new i.P,new i.P,new i.P,new i.P,new i.P],o=new i.P,a=new s,l=new i.P,c=new i.P,h=new i.P,d=new i.P,u=new i.P,p=new i.P,m=new i.P,f=new i.P,g=new i.P,v=new i.P;function y(e,t,n,i,s){for(let r=0,o=e.length-3;r<=o;r+=3){v.fromArray(e,r);const o=s.x*Math.abs(v.x)+s.y*Math.abs(v.y)+s.z*Math.abs(v.z),a=t.dot(v),l=n.dot(v),c=i.dot(v);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}},93113:(e,t,n)=>{"use strict";n.d(t,{I:()=>h});var i=n(71050),s=n(19748),r=n(75544);const o={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},a={h:0,s:0,l:0},l={h:0,s:0,l:0};function c(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class h{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=r.KI_){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,s.ep.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=s.ep.workingColorSpace){return this.r=e,this.g=t,this.b=n,s.ep.toWorkingColorSpace(this,i),this}setHSL(e,t,n,r=s.ep.workingColorSpace){if(e=(0,i.kz)(e,1),t=(0,i.uZ)(t,0,1),n=(0,i.uZ)(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,s=2*n-i;this.r=c(s,i,e+1/3),this.g=c(s,i,e),this.b=c(s,i,e-1/3)}return s.ep.toWorkingColorSpace(this,r),this}setStyle(e,t=r.KI_){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const r=i[1],o=i[2];switch(r){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,t);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,t);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,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],s=n.length;if(3===s)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===s)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=r.KI_){const n=o[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=(0,s.PB)(e.r),this.g=(0,s.PB)(e.g),this.b=(0,s.PB)(e.b),this}copyLinearToSRGB(e){return this.r=(0,s.QP)(e.r),this.g=(0,s.QP)(e.g),this.b=(0,s.QP)(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=r.KI_){return s.ep.fromWorkingColorSpace(d.copy(this),e),65536*Math.round((0,i.uZ)(255*d.r,0,255))+256*Math.round((0,i.uZ)(255*d.g,0,255))+Math.round((0,i.uZ)(255*d.b,0,255))}getHexString(e=r.KI_){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=s.ep.workingColorSpace){s.ep.fromWorkingColorSpace(d.copy(this),t);const n=d.r,i=d.g,r=d.b,o=Math.max(n,i,r),a=Math.min(n,i,r);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const e=o-a;switch(c=h<=.5?e/(o+a):e/(2-o-a),o){case n:l=(i-r)/e+(i{"use strict";n.d(t,{PB:()=>h,QP:()=>d,ep:()=>c});var i=n(75544),s=n(23130);const r=(new s.V).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),o=(new s.V).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),a={[i.GUF]:{transfer:i.l6D,primaries:i.Vtg,toReference:e=>e,fromReference:e=>e},[i.KI_]:{transfer:i.j17,primaries:i.Vtg,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[i.AmZ]:{transfer:i.l6D,primaries:i.FVh,toReference:e=>e.applyMatrix3(o),fromReference:e=>e.applyMatrix3(r)},[i.ntt]:{transfer:i.j17,primaries:i.FVh,toReference:e=>e.convertSRGBToLinear().applyMatrix3(o),fromReference:e=>e.applyMatrix3(r).convertLinearToSRGB()}},l=new Set([i.GUF,i.AmZ]),c={enabled:!0,_workingColorSpace:i.GUF,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(e){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!e},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!l.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=a[t].toReference;return(0,a[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return a[e].primaries},getTransfer:function(e){return e===i.aCh?i.l6D:a[e].transfer}};function h(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function d(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}},82954:(e,t,n)=>{"use strict";n.d(t,{U:()=>l});var i=n(78943),s=n(82587),r=n(71050);const o=new s.y,a=new i._;class l{constructor(e=0,t=0,n=0,i=l.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],d=i[2],u=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin((0,r.uZ)(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-(0,r.uZ)(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin((0,r.uZ)(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-(0,r.uZ)(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin((0,r.uZ)(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-(0,r.uZ)(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return o.makeRotationFromQuaternion(e),this.setFromRotationMatrix(o,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return a.setFromEuler(this),this.setFromQuaternion(a,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}l.DEFAULT_ORDER="XYZ"},53763:(e,t,n)=>{"use strict";n.d(t,{i:()=>c});var i=n(75544),s=n(19588),r=n(57471),o=n(82094);const a=new r.a,l=new s.P;class c{constructor(e=new o.J,t=new o.J,n=new o.J,i=new o.J,s=new o.J,r=new o.J){this.planes=[e,t,n,i,s,r]}set(e,t,n,i,s,r){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(r),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=i._RZ){const n=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],c=s[4],h=s[5],d=s[6],u=s[7],p=s[8],m=s[9],f=s[10],g=s[11],v=s[12],y=s[13],b=s[14],_=s[15];if(n[0].setComponents(l-r,u-c,g-p,_-v).normalize(),n[1].setComponents(l+r,u+c,g+p,_+v).normalize(),n[2].setComponents(l+o,u+h,g+m,_+y).normalize(),n[3].setComponents(l-o,u-h,g-m,_-y).normalize(),n[4].setComponents(l-a,u-d,g-f,_-b).normalize(),t===i._RZ)n[5].setComponents(l+a,u+d,g+f,_+b).normalize();else{if(t!==i.JCZ)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(a,d,f,b).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),a.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),a.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(a)}intersectsSprite(e){return a.center.set(0,0,0),a.radius=.7071067811865476,a.applyMatrix4(e.matrixWorld),this.intersectsSphere(a)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,l.y=i.normal.y>0?e.max.y:e.min.y,l.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(l)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}},71050:(e,t,n)=>{"use strict";n.d(t,{DO:()=>a,Fv:()=>f,I3:()=>o,M8:()=>g,cY:()=>m,gy:()=>p,h3:()=>u,kz:()=>c,qW:()=>r,t7:()=>h,uZ:()=>l,wt:()=>d});const i=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let s=1234567;const r=Math.PI/180,o=180/Math.PI;function a(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,s=4294967295*Math.random()|0;return(i[255&e]+i[e>>8&255]+i[e>>16&255]+i[e>>24&255]+"-"+i[255&t]+i[t>>8&255]+"-"+i[t>>16&15|64]+i[t>>24&255]+"-"+i[63&n|128]+i[n>>8&255]+"-"+i[n>>16&255]+i[n>>24&255]+i[255&s]+i[s>>8&255]+i[s>>16&255]+i[s>>24&255]).toLowerCase()}function l(e,t,n){return Math.max(t,Math.min(n,e))}function c(e,t){return(e%t+t)%t}function h(e,t,n){return(1-n)*e+n*t}function d(e){return 0==(e&e-1)&&0!==e}function u(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function p(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function m(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function f(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const g={DEG2RAD:r,RAD2DEG:o,generateUUID:a,clamp:l,euclideanModulo:c,mapLinear:function(e,t,n,i,s){return i+(e-t)*(s-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:h,damp:function(e,t,n,i){return h(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(c(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(s=e);let t=s+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*r},radToDeg:function(e){return e*o},isPowerOfTwo:d,ceilPowerOfTwo:u,floorPowerOfTwo:p,setQuaternionFromProperEuler:function(e,t,n,i,s){const r=Math.cos,o=Math.sin,a=r(n/2),l=o(n/2),c=r((t+i)/2),h=o((t+i)/2),d=r((t-i)/2),u=o((t-i)/2),p=r((i-t)/2),m=o((i-t)/2);switch(s){case"XYX":e.set(a*h,l*d,l*u,a*c);break;case"YZY":e.set(l*u,a*h,l*d,a*c);break;case"ZXZ":e.set(l*d,l*u,a*h,a*c);break;case"XZX":e.set(a*h,l*m,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*m,a*c);break;case"ZYZ":e.set(l*m,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}},normalize:f,denormalize:m}},23130:(e,t,n)=>{"use strict";n.d(t,{V:()=>i});class i{constructor(e,t,n,s,r,o,a,l,c){i.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,s,r,o,a,l,c)}set(e,t,n,i,s,r,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=s,c[5]=a,c[6]=n,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,r=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],d=n[2],u=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],b=i[7],_=i[2],x=i[5],w=i[8];return s[0]=r*m+o*v+a*_,s[3]=r*f+o*y+a*x,s[6]=r*g+o*b+a*w,s[1]=l*m+c*v+h*_,s[4]=l*f+c*y+h*x,s[7]=l*g+c*b+h*w,s[2]=d*m+u*v+p*_,s[5]=d*f+u*y+p*x,s[8]=d*g+u*b+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*r*c-t*o*l-n*s*c+n*o*a+i*s*l-i*r*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*r-o*l,d=o*a-c*s,u=l*s-r*a,p=t*h+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=h*m,e[1]=(i*l-c*n)*m,e[2]=(o*n-i*r)*m,e[3]=d*m,e[4]=(c*t-i*a)*m,e[5]=(i*s-o*t)*m,e[6]=u*m,e[7]=(n*a-l*t)*m,e[8]=(r*t-n*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,o){const a=Math.cos(s),l=Math.sin(s);return this.set(n*a,n*l,-n*(a*r+l*o)+r+e,-i*l,i*a,-i*(-l*r+a*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(s.makeScale(e,t)),this}rotate(e){return this.premultiply(s.makeRotation(-e)),this}translate(e,t){return this.premultiply(s.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const s=new i},82587:(e,t,n)=>{"use strict";n.d(t,{y:()=>r});var i=n(75544),s=n(19588);class r{constructor(e,t,n,i,s,o,a,l,c,h,d,u,p,m,f,g){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,s,o,a,l,c,h,d,u,p,m,f,g)}set(e,t,n,i,s,r,o,a,l,c,h,d,u,p,m,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=d,g[3]=u,g[7]=p,g[11]=m,g[15]=f,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 r).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/o.setFromMatrixColumn(e,0).length(),s=1/o.setFromMatrixColumn(e,1).length(),r=1/o.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,r=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(s),h=Math.sin(s);if("XYZ"===e.order){const e=r*c,n=r*h,i=o*c,s=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-s*l,t[9]=-o*a,t[2]=s-e*l,t[6]=i+n*l,t[10]=r*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,s=l*h;t[0]=e+s*o,t[4]=i*o-n,t[8]=r*l,t[1]=r*h,t[5]=r*c,t[9]=-o,t[2]=n*o-i,t[6]=s+e*o,t[10]=r*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,s=l*h;t[0]=e-s*o,t[4]=-r*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=r*c,t[9]=s-e*o,t[2]=-r*l,t[6]=o,t[10]=r*a}else if("ZYX"===e.order){const e=r*c,n=r*h,i=o*c,s=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+s,t[1]=a*h,t[5]=s*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=r*a}else if("YZX"===e.order){const e=r*a,n=r*l,i=o*a,s=o*l;t[0]=a*c,t[4]=s-e*h,t[8]=i*h+n,t[1]=h,t[5]=r*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-s*h}else if("XZY"===e.order){const e=r*a,n=r*l,i=o*a,s=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+s,t[5]=r*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=s*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(l,e,c)}lookAt(e,t,n){const i=this.elements;return u.subVectors(e,t),0===u.lengthSq()&&(u.z=1),u.normalize(),h.crossVectors(n,u),0===h.lengthSq()&&(1===Math.abs(n.z)?u.x+=1e-4:u.z+=1e-4,u.normalize(),h.crossVectors(n,u)),h.normalize(),d.crossVectors(u,h),i[0]=h.x,i[4]=d.x,i[8]=u.x,i[1]=h.y,i[5]=d.y,i[9]=u.y,i[2]=h.z,i[6]=d.z,i[10]=u.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,r=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],d=n[9],u=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],b=n[11],_=n[15],x=i[0],w=i[4],S=i[8],M=i[12],E=i[1],T=i[5],C=i[9],A=i[13],P=i[2],R=i[6],L=i[10],N=i[14],D=i[3],I=i[7],O=i[11],U=i[15];return s[0]=r*x+o*E+a*P+l*D,s[4]=r*w+o*T+a*R+l*I,s[8]=r*S+o*C+a*L+l*O,s[12]=r*M+o*A+a*N+l*U,s[1]=c*x+h*E+d*P+u*D,s[5]=c*w+h*T+d*R+u*I,s[9]=c*S+h*C+d*L+u*O,s[13]=c*M+h*A+d*N+u*U,s[2]=p*x+m*E+f*P+g*D,s[6]=p*w+m*T+f*R+g*I,s[10]=p*S+m*C+f*L+g*O,s[14]=p*M+m*A+f*N+g*U,s[3]=v*x+y*E+b*P+_*D,s[7]=v*w+y*T+b*R+_*I,s[11]=v*S+y*C+b*L+_*O,s[15]=v*M+y*A+b*N+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],d=e[10],u=e[14];return e[3]*(+s*a*h-i*l*h-s*o*d+n*l*d+i*o*u-n*a*u)+e[7]*(+t*a*u-t*l*d+s*r*d-i*r*u+i*l*c-s*a*c)+e[11]*(+t*l*h-t*o*u-s*r*h+n*r*u+s*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*d+i*r*h-n*r*d+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],d=e[10],u=e[11],p=e[12],m=e[13],f=e[14],g=e[15],v=h*f*l-m*d*l+m*a*u-o*f*u-h*a*g+o*d*g,y=p*d*l-c*f*l-p*a*u+r*f*u+c*a*g-r*d*g,b=c*m*l-p*h*l+p*o*u-r*m*u-c*o*g+r*h*g,_=p*h*a-c*m*a-p*o*d+r*m*d+c*o*f-r*h*f,x=t*v+n*y+i*b+s*_;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/x;return e[0]=v*w,e[1]=(m*d*s-h*f*s-m*i*u+n*f*u+h*i*g-n*d*g)*w,e[2]=(o*f*s-m*a*s+m*i*l-n*f*l-o*i*g+n*a*g)*w,e[3]=(h*a*s-o*d*s-h*i*l+n*d*l+o*i*u-n*a*u)*w,e[4]=y*w,e[5]=(c*f*s-p*d*s+p*i*u-t*f*u-c*i*g+t*d*g)*w,e[6]=(p*a*s-r*f*s-p*i*l+t*f*l+r*i*g-t*a*g)*w,e[7]=(r*d*s-c*a*s+c*i*l-t*d*l-r*i*u+t*a*u)*w,e[8]=b*w,e[9]=(p*h*s-c*m*s-p*n*u+t*m*u+c*n*g-t*h*g)*w,e[10]=(r*m*s-p*o*s+p*n*l-t*m*l-r*n*g+t*o*g)*w,e[11]=(c*o*s-r*h*s-c*n*l+t*h*l+r*n*u-t*o*u)*w,e[12]=_*w,e[13]=(c*m*i-p*h*i+p*n*d-t*m*d-c*n*f+t*h*f)*w,e[14]=(p*o*i-r*m*i-p*n*a+t*m*a+r*n*f-t*o*f)*w,e[15]=(r*h*i-c*o*i+c*n*a-t*h*a-r*n*d+t*o*d)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,r=e.x,o=e.y,a=e.z,l=s*r,c=s*o;return this.set(l*r+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*r,0,l*a-i*o,c*a+i*r,s*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,r=t._y,o=t._z,a=t._w,l=s+s,c=r+r,h=o+o,d=s*l,u=s*c,p=s*h,m=r*c,f=r*h,g=o*h,v=a*l,y=a*c,b=a*h,_=n.x,x=n.y,w=n.z;return i[0]=(1-(m+g))*_,i[1]=(u+b)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(u-b)*x,i[5]=(1-(d+g))*x,i[6]=(f+v)*x,i[7]=0,i[8]=(p+y)*w,i[9]=(f-v)*w,i[10]=(1-(d+m))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=o.set(i[0],i[1],i[2]).length();const r=o.set(i[4],i[5],i[6]).length(),l=o.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],a.copy(this);const c=1/s,h=1/r,d=1/l;return a.elements[0]*=c,a.elements[1]*=c,a.elements[2]*=c,a.elements[4]*=h,a.elements[5]*=h,a.elements[6]*=h,a.elements[8]*=d,a.elements[9]*=d,a.elements[10]*=d,t.setFromRotationMatrix(a),n.x=s,n.y=r,n.z=l,this}makePerspective(e,t,n,s,r,o,a=i._RZ){const l=this.elements,c=2*r/(t-e),h=2*r/(n-s),d=(t+e)/(t-e),u=(n+s)/(n-s);let p,m;if(a===i._RZ)p=-(o+r)/(o-r),m=-2*o*r/(o-r);else{if(a!==i.JCZ)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);p=-o/(o-r),m=-o*r/(o-r)}return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=u,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,s,r,o,a=i._RZ){const l=this.elements,c=1/(t-e),h=1/(n-s),d=1/(o-r),u=(t+e)*c,p=(n+s)*h;let m,f;if(a===i._RZ)m=(o+r)*d,f=-2*d;else{if(a!==i.JCZ)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);m=r*d,f=-1*d}return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-u,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=f,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const o=new s.P,a=new r,l=new s.P(0,0,0),c=new s.P(1,1,1),h=new s.P,d=new s.P,u=new s.P},82094:(e,t,n)=>{"use strict";n.d(t,{J:()=>l});var i=n(23130),s=n(19588);const r=new s.P,o=new s.P,a=new i.V;class l{constructor(e=new s.P(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=r.subVectors(n,t).cross(o.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(r),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||a.getNormalMatrix(e),i=this.coplanarPoint(r).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}},78943:(e,t,n)=>{"use strict";n.d(t,{_:()=>s});var i=n(71050);class s{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,r,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const d=s[r+0],u=s[r+1],p=s[r+2],m=s[r+3];if(0===o)return e[t+0]=a,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=d,e[t+1]=u,e[t+2]=p,void(e[t+3]=m);if(h!==m||a!==d||l!==u||c!==p){let e=1-o;const t=a*d+l*u+c*p+h*m,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const s=Math.sqrt(i),r=Math.atan2(s,t*n);e=Math.sin(e*r)/s,o=Math.sin(o*r)/s}const s=o*n;if(a=a*e+d*s,l=l*e+u*s,c=c*e+p*s,h=h*e+m*s,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,r){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=s[r],d=s[r+1],u=s[r+2],p=s[r+3];return e[t]=o*p+c*h+a*u-l*d,e[t+1]=a*p+c*d+l*h-o*u,e[t+2]=l*p+c*u+o*d-a*h,e[t+3]=c*p-o*h-a*d-l*u,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const n=e._x,i=e._y,s=e._z,r=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(s/2),d=a(n/2),u=a(i/2),p=a(s/2);switch(r){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],d=n+o+h;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-a)*e,this._y=(s-l)*e,this._z=(r-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+r)/e,this._z=(s+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(s-l)/e,this._x=(i+r)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(r-i)/e,this._x=(s+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(i.uZ(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,r=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+r*o+i*l-s*a,this._y=i*c+r*a+s*o-n*l,this._z=s*c+r*l+n*a-i*o,this._w=r*c-n*o-i*a-s*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,s=this._z,r=this._w;let o=r*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=r,this._x=n,this._y=i,this._z=s,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*r+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=r*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}},96643:(e,t,n)=>{"use strict";n.d(t,{z:()=>d});var i=n(19588);const s=new i.P,r=new i.P,o=new i.P,a=new i.P,l=new i.P,c=new i.P,h=new i.P;class d{constructor(e=new i.P,t=new i.P(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,s)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=s.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(s.copy(this.origin).addScaledVector(this.direction,t),s.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){r.copy(e).add(t).multiplyScalar(.5),o.copy(t).sub(e).normalize(),a.copy(this.origin).sub(r);const s=.5*e.distanceTo(t),l=-this.direction.dot(o),c=a.dot(this.direction),h=-a.dot(o),d=a.lengthSq(),u=Math.abs(1-l*l);let p,m,f,g;if(u>0)if(p=l*h-c,m=l*c-h,g=s*u,p>=0)if(m>=-g)if(m<=g){const e=1/u;p*=e,m*=e,f=p*(p+l*m+2*c)+m*(l*p+m+2*h)+d}else m=s,p=Math.max(0,-(l*m+c)),f=-p*p+m*(m+2*h)+d;else m=-s,p=Math.max(0,-(l*m+c)),f=-p*p+m*(m+2*h)+d;else m<=-g?(p=Math.max(0,-(-l*s+c)),m=p>0?-s:Math.min(Math.max(-s,-h),s),f=-p*p+m*(m+2*h)+d):m<=g?(p=0,m=Math.min(Math.max(-s,-h),s),f=m*(m+2*h)+d):(p=Math.max(0,-(l*s+c)),m=p>0?s:Math.min(Math.max(-s,-h),s),f=-p*p+m*(m+2*h)+d);else m=l>0?-s:s,p=Math.max(0,-(l*m+c)),f=-p*p+m*(m+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,p),i&&i.copy(r).addScaledVector(o,m),f}intersectSphere(e,t){s.subVectors(e.center,this.origin);const n=s.dot(this.direction),i=s.dot(s)-n*n,r=e.radius*e.radius;if(i>r)return null;const o=Math.sqrt(r-i),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,r,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),c>=0?(s=(e.min.y-d.y)*c,r=(e.max.y-d.y)*c):(s=(e.max.y-d.y)*c,r=(e.min.y-d.y)*c),n>r||s>i?null:((s>n||isNaN(n))&&(n=s),(r=0?(o=(e.min.z-d.z)*h,a=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,a=(e.min.z-d.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,s)}intersectTriangle(e,t,n,i,s){l.subVectors(t,e),c.subVectors(n,e),h.crossVectors(l,c);let r,o=this.direction.dot(h);if(o>0){if(i)return null;r=1}else{if(!(o<0))return null;r=-1,o=-o}a.subVectors(this.origin,e);const d=r*this.direction.dot(c.crossVectors(a,c));if(d<0)return null;const u=r*this.direction.dot(l.cross(a));if(u<0)return null;if(d+u>o)return null;const p=-r*a.dot(h);return p<0?null:this.at(p/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}},57471:(e,t,n)=>{"use strict";n.d(t,{a:()=>l});var i=n(37840),s=n(19588);const r=new i.Z,o=new s.P,a=new s.P;class l{constructor(e=new s.P,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):r.setFromPoints(e).getCenter(n);let i=0;for(let t=0,s=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;o.subVectors(e,this.center);const t=o.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(o,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(a.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(o.copy(e.center).add(a)),this.expandByPoint(o.copy(e.center).sub(a))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}},40693:(e,t,n)=>{"use strict";n.d(t,{F:()=>s});var i=n(71050);class s{constructor(e=0,t=0){s.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(i.uZ(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,r=this.y-e.y;return this.x=s*n-r*i+e.x,this.y=s*i+r*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}},19588:(e,t,n)=>{"use strict";n.d(t,{P:()=>r});var i=n(71050),s=n(78943);class r{constructor(e=0,t=0,n=0){r.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(a.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(a.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,r=e.y,o=e.z,a=e.w,l=2*(r*i-o*n),c=2*(o*t-s*i),h=2*(s*n-r*t);return this.x=t+a*l+r*h-o*c,this.y=n+a*c+o*l-s*h,this.z=i+a*h+s*c-r*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,r=t.x,o=t.y,a=t.z;return this.x=i*a-s*o,this.y=s*r-n*a,this.z=n*o-i*r,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return o.copy(this).projectOnVector(e),this.sub(o)}reflect(e){return this.sub(o.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(i.uZ(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const o=new r,a=new s._},84538:(e,t,n)=>{"use strict";n.d(t,{L:()=>i});class i{constructor(e=0,t=0,n=0,s=1){i.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*t+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*t+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*t+r[7]*n+r[11]*i+r[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const r=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],d=a[1],u=a[5],p=a[9],m=a[2],f=a[6],g=a[10];if(Math.abs(c-d)a&&e>v?ev?a{"use strict";n.d(t,{Z:()=>s});var i=n(25499);class s extends i.T{constructor(){super(),this.isGroup=!0,this.type="Group"}}},93122:(e,t,n)=>{"use strict";n.d(t,{x:()=>g});var i=n(57471),s=n(96643),r=n(82587),o=n(25499),a=n(19588),l=n(64026),c=n(75809),h=n(35322);const d=new a.P,u=new a.P,p=new r.y,m=new s.z,f=new i.a;class g extends o.T{constructor(e=new c.u,t=new l.n){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;el)continue;u.applyMatrix4(this.matrixWorld);const r=e.ray.origin.distanceTo(u);re.far||t.push({distance:r,point:d.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,r.start),i=Math.min(y.count,r.start+r.count)-1;nl)continue;u.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:d.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e{"use strict";n.d(t,{e:()=>l});var i=n(93122),s=n(19588),r=n(35322);const o=new s.P,a=new s.P;class l extends i.x{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e{"use strict";n.d(t,{K:()=>B});var i=n(19588),s=n(40693),r=n(57471),o=n(96643),a=n(82587),l=n(25499);const c=new i.P,h=new i.P,d=new i.P,u=new i.P,p=new i.P,m=new i.P,f=new i.P,g=new i.P,v=new i.P,y=new i.P;let b=!1;class _{constructor(e=new i.P,t=new i.P,n=new i.P){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),c.subVectors(e,t),i.cross(c);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){c.subVectors(i,t),h.subVectors(n,t),d.subVectors(e,t);const r=c.dot(c),o=c.dot(h),a=c.dot(d),l=h.dot(h),u=h.dot(d),p=r*l-o*o;if(0===p)return s.set(-2,-1,-1);const m=1/p,f=(l*a-o*u)*m,g=(r*u-o*a)*m;return s.set(1-f-g,g,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,u),u.x>=0&&u.y>=0&&u.x+u.y<=1}static getUV(e,t,n,i,s,r,o,a){return!1===b&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),b=!0),this.getInterpolation(e,t,n,i,s,r,o,a)}static getInterpolation(e,t,n,i,s,r,o,a){return this.getBarycoord(e,t,n,i,u),a.setScalar(0),a.addScaledVector(s,u.x),a.addScaledVector(r,u.y),a.addScaledVector(o,u.z),a}static isFrontFacing(e,t,n,i){return c.subVectors(n,t),h.subVectors(e,t),c.cross(h).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return c.subVectors(this.c,this.b),h.subVectors(this.a,this.b),.5*c.cross(h).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return _.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return _.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return!1===b&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),b=!0),_.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return _.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return _.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return _.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let r,o;p.subVectors(i,n),m.subVectors(s,n),g.subVectors(e,n);const a=p.dot(g),l=m.dot(g);if(a<=0&&l<=0)return t.copy(n);v.subVectors(e,i);const c=p.dot(v),h=m.dot(v);if(c>=0&&h<=c)return t.copy(i);const d=a*h-c*l;if(d<=0&&a>=0&&c<=0)return r=a/(a-c),t.copy(n).addScaledVector(p,r);y.subVectors(e,s);const u=p.dot(y),b=m.dot(y);if(b>=0&&u<=b)return t.copy(s);const _=u*l-a*b;if(_<=0&&l>=0&&b<=0)return o=l/(l-b),t.copy(n).addScaledVector(m,o);const x=c*b-u*h;if(x<=0&&h-c>=0&&u-b>=0)return f.subVectors(s,i),o=(h-c)/(h-c+(u-b)),t.copy(i).addScaledVector(f,o);const w=1/(x+_+d);return r=_*w,o=d*w,t.copy(n).addScaledVector(p,r).addScaledVector(m,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}var x=n(75544),w=n(24479),S=n(75809);const M=new a.y,E=new o.z,T=new r.a,C=new i.P,A=new i.P,P=new i.P,R=new i.P,L=new i.P,N=new i.P,D=new s.F,I=new s.F,O=new s.F,U=new i.P,k=new i.P,V=new i.P,z=new i.P,F=new i.P;class B extends l.T{constructor(e=new S.u,t=new w.v){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)return}M.copy(s).invert(),E.copy(e.ray).applyMatrix4(M),null!==n.boundingBox&&!1===E.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,E)}}_computeIntersections(e,t,n){let i;const s=this.geometry,r=this.material,o=s.index,a=s.attributes.position,l=s.attributes.uv,c=s.attributes.uv1,h=s.attributes.normal,d=s.groups,u=s.drawRange;if(null!==o)if(Array.isArray(r))for(let s=0,a=d.length;sn.far?null:{distance:c,point:F.clone(),object:e}}(e,t,n,r,A,P,R,z);if(u){o&&(D.fromBufferAttribute(o,c),I.fromBufferAttribute(o,h),O.fromBufferAttribute(o,d),u.uv=_.getInterpolation(z,A,P,R,D,I,O,new s.F)),a&&(D.fromBufferAttribute(a,c),I.fromBufferAttribute(a,h),O.fromBufferAttribute(a,d),u.uv1=_.getInterpolation(z,A,P,R,D,I,O,new s.F),u.uv2=u.uv1),l&&(U.fromBufferAttribute(l,c),k.fromBufferAttribute(l,h),V.fromBufferAttribute(l,d),u.normal=_.getInterpolation(z,A,P,R,U,k,V,new i.P),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const e={a:c,b:h,c:d,normal:new i.P,materialIndex:0};_.getNormal(A,P,R,e.normal),u.face=e}return u}},65996:(e,t,n)=>{"use strict";n.d(t,{o:()=>u});var i=n(75544),s=n(8035),r=n(40071),o=n(44428),a=n(8173),l=n(46953),c=n(53203),h=n(48651),d=n(19564);class u extends l.d{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];void 0!==t.encoding&&((0,d.O4)("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===i.knz?i.KI_:i.aCh),this.texture=new h.B(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:i.wem}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},l=new r.D(5,5,5),h=new o.j({name:"CubemapFromEquirect",uniforms:(0,a.dw)(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:i._Li,blending:i.jFi});h.uniforms.tEquirect.value=t;const d=new s.K(l,h),u=t.minFilter;t.minFilter===i.D1R&&(t.minFilter=i.wem);return new c._(1,10,this).update(e,d),t.minFilter=u,d.geometry.dispose(),d.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(s)}}},46953:(e,t,n)=>{"use strict";n.d(t,{d:()=>h});var i=n(19251),s=n(21364),r=n(75544),o=n(84538),a=n(37136),l=n(19564);class c extends i.p{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new o.L(0,0,e,t),this.scissorTest=!1,this.viewport=new o.L(0,0,e,t);const i={width:e,height:t,depth:1};void 0!==n.encoding&&((0,l.O4)("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===r.knz?r.KI_:r.aCh),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:r.wem,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new s.x(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps,this.texture.internalFormat=n.internalFormat,this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}setSize(e,t,n=1){this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new a.H(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class h extends c{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}},7177:(e,t,n)=>{"use strict";n.d(t,{C:()=>B});var i=n(75544),s=n(93113),r=n(53763),o=n(82587),a=n(40693),l=n(19588),c=n(84538),h=n(71050),d=n(54871),u=n(34455),p=n(26067),m=n(83596),f=n(595),g=n(49917),v=n(89479),y=n(5058),b=n(39412),_=n(24297),x=n(88753),w=n(72754),S=n(31132),M=n(27153),E=n(89321),T=n(96369),C=n(15003),A=n(84153),P=n(73981),R=n(46953),L=n(74859),N=n(14933),D=n(69963),I=n(64061),O=n(9840),U=n(53288),k=n(10267),V=n(37874),z=n(19564),F=n(19748);class B{constructor(e={}){const{canvas:t=(0,z.O5)(),context:n=null,depth:F=!0,stencil:B=!0,alpha:$=!1,antialias:j=!1,premultipliedAlpha:H=!0,preserveDrawingBuffer:G=!1,powerPreference:Z="default",failIfMajorPerformanceCaveat:W=!1}=e;let q;this.isWebGLRenderer=!0,q=null!==n?n.getContextAttributes().alpha:$;const X=new Uint32Array(4),Y=new Int32Array(4);let K=null,J=null;const Q=[],ee=[];this.domElement=t,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=i.KI_,this._useLegacyLights=!1,this.toneMapping=i.uL9,this.toneMappingExposure=1;const te=this;let ne=!1,ie=0,se=0,re=null,oe=-1,ae=null;const le=new c.L,ce=new c.L;let he=null;const de=new s.I(0);let ue=0,pe=t.width,me=t.height,fe=1,ge=null,ve=null;const ye=new c.L(0,0,pe,me),be=new c.L(0,0,pe,me);let _e=!1;const xe=new r.i;let we=!1,Se=!1,Me=null;const Ee=new o.y,Te=new a.F,Ce=new l.P,Ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Pe(){return null===re?fe:1}let Re,Le,Ne,De,Ie,Oe,Ue,ke,Ve,ze,Fe,Be,$e,je,He,Ge,Ze,We,qe,Xe,Ye,Ke,Je,Qe,et=n;function tt(e,n){for(let i=0;i0),u=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color;let f=i.uL9;s.toneMapped&&(null!==re&&!0!==re.isXRRenderTarget||(f=te.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==g?g.length:0,y=Ie.get(s),b=J.state.lights;if(!0===we&&(!0===Se||e!==ae)){const t=e===ae&&s.id===oe;Ge.setState(s,e,t)}let _=!1;s.version===y.__version?y.needsLights&&y.lightsStateVersion!==b.state.version||y.outputColorSpace!==l||r.isInstancedMesh&&!1===y.instancing?_=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?_=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||y.envMap!==c||!0===s.fog&&y.fog!==o?_=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===Ge.numPlanes&&y.numIntersection===Ge.numIntersection?(y.vertexAlphas!==h||y.vertexTangents!==d||y.morphTargets!==u||y.morphNormals!==p||y.morphColors!==m||y.toneMapping!==f||!0===Le.isWebGL2&&y.morphTargetsCount!==v)&&(_=!0):_=!0:_=!0:_=!0:(_=!0,y.__version=s.version);let x=y.currentProgram;!0===_&&(x=vt(s,t,r));let w=!1,S=!1,M=!1;const E=x.getUniforms(),T=y.uniforms;Ne.useProgram(x.program)&&(w=!0,S=!0,M=!0);s.id!==oe&&(oe=s.id,S=!0);if(w||ae!==e){E.setValue(et,"projectionMatrix",e.projectionMatrix),E.setValue(et,"viewMatrix",e.matrixWorldInverse);const t=E.map.cameraPosition;void 0!==t&&t.setValue(et,Ce.setFromMatrixPosition(e.matrixWorld)),Le.logarithmicDepthBuffer&&E.setValue(et,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(s.isMeshPhongMaterial||s.isMeshToonMaterial||s.isMeshLambertMaterial||s.isMeshBasicMaterial||s.isMeshStandardMaterial||s.isShaderMaterial)&&E.setValue(et,"isOrthographic",!0===e.isOrthographicCamera),ae!==e&&(ae=e,S=!0,M=!0)}if(r.isSkinnedMesh){E.setOptional(et,r,"bindMatrix"),E.setOptional(et,r,"bindMatrixInverse");const e=r.skeleton;e&&(Le.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),E.setValue(et,"boneTexture",e.boneTexture,Oe),E.setValue(et,"boneTextureSize",e.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const C=n.morphAttributes;(void 0!==C.position||void 0!==C.normal||void 0!==C.color&&!0===Le.isWebGL2)&&qe.update(r,n,x);(S||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,E.setValue(et,"receiveShadow",r.receiveShadow));s.isMeshGouraudMaterial&&null!==s.envMap&&(T.envMap.value=c,T.flipEnvMap.value=c.isCubeTexture&&!1===c.isRenderTargetTexture?-1:1);S&&(E.setValue(et,"toneMappingExposure",te.toneMappingExposure),y.needsLights&&(P=M,(A=T).ambientLightColor.needsUpdate=P,A.lightProbe.needsUpdate=P,A.directionalLights.needsUpdate=P,A.directionalLightShadows.needsUpdate=P,A.pointLights.needsUpdate=P,A.pointLightShadows.needsUpdate=P,A.spotLights.needsUpdate=P,A.spotLightShadows.needsUpdate=P,A.rectAreaLights.needsUpdate=P,A.hemisphereLights.needsUpdate=P),o&&!0===s.fog&&$e.refreshFogUniforms(T,o),$e.refreshMaterialUniforms(T,s,fe,me,Me),I.y.upload(et,yt(y),T,Oe));var A,P;s.isShaderMaterial&&!0===s.uniformsNeedUpdate&&(I.y.upload(et,yt(y),T,Oe),s.uniformsNeedUpdate=!1);s.isSpriteMaterial&&E.setValue(et,"center",r.center);if(E.setValue(et,"modelViewMatrix",r.modelViewMatrix),E.setValue(et,"normalMatrix",r.normalMatrix),E.setValue(et,"modelMatrix",r.matrixWorld),s.isShaderMaterial||s.isRawShaderMaterial){const e=s.uniformsGroups;for(let t=0,n=e.length;t{function n(){i.forEach((function(e){Ie.get(e).currentProgram.isReady()&&i.delete(e)})),0!==i.size?setTimeout(n,10):t(e)}null!==Re.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let ct=null;function ht(){ut.stop()}function dt(){ut.start()}const ut=new d.C;function pt(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)J.pushLight(e),e.castShadow&&J.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||xe.intersectsSprite(e)){i&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ee);const t=Fe.update(e),s=e.material;s.visible&&K.push(e,t,s,n,Ce.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||xe.intersectsObject(e))){const t=Fe.update(e),s=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),Ce.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),Ce.copy(t.boundingSphere.center)),Ce.applyMatrix4(e.matrixWorld).applyMatrix4(Ee)),Array.isArray(s)){const i=t.groups;for(let r=0,o=i.length;r0&&function(e,t,n,s){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;const r=Le.isWebGL2;null===Me&&(Me=new R.d(1,1,{generateMipmaps:!0,type:Re.has("EXT_color_buffer_half_float")?i.cLu:i.ywz,minFilter:i.D1R,samples:r?4:0}));te.getDrawingBufferSize(Te),r?Me.setSize(Te.x,Te.y):Me.setSize((0,h.gy)(Te.x),(0,h.gy)(Te.y));const o=te.getRenderTarget();te.setRenderTarget(Me),te.getClearColor(de),ue=te.getClearAlpha(),ue<1&&te.setClearColor(16777215,.5);te.clear();const a=te.toneMapping;te.toneMapping=i.uL9,ft(e,n,s),Oe.updateMultisampleRenderTarget(Me),Oe.updateRenderTargetMipmap(Me);let l=!1;for(let e=0,r=t.length;e0&&ft(r,t,n),o.length>0&&ft(o,t,n),a.length>0&&ft(a,t,n),Ne.buffers.depth.setTest(!0),Ne.buffers.depth.setMask(!0),Ne.buffers.color.setMask(!0),Ne.setPolygonOffset(!1)}function ft(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let s=0,r=e.length;s0?ee[ee.length-1]:null,Q.pop(),K=Q.length>0?Q[Q.length-1]:null},this.getActiveCubeFace=function(){return ie},this.getActiveMipmapLevel=function(){return se},this.getRenderTarget=function(){return re},this.setRenderTargetTextures=function(e,t,n){Ie.get(e.texture).__webglTexture=t,Ie.get(e.depthTexture).__webglTexture=n;const i=Ie.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===Re.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){const n=Ie.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){re=e,ie=t,se=n;let i=!0,s=null,r=!1,o=!1;if(e){const a=Ie.get(e);void 0!==a.__useDefaultFramebuffer?(Ne.bindFramebuffer(et.FRAMEBUFFER,null),i=!1):void 0===a.__webglFramebuffer?Oe.setupRenderTarget(e):a.__hasExternalTextures&&Oe.rebindTextures(e,Ie.get(e.texture).__webglTexture,Ie.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=Ie.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(s=Array.isArray(c[t])?c[t][n]:c[t],r=!0):s=Le.isWebGL2&&e.samples>0&&!1===Oe.useMultisampledRTT(e)?Ie.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,le.copy(e.viewport),ce.copy(e.scissor),he=e.scissorTest}else le.copy(ye).multiplyScalar(fe).floor(),ce.copy(be).multiplyScalar(fe).floor(),he=_e;if(Ne.bindFramebuffer(et.FRAMEBUFFER,s)&&Le.drawBuffers&&i&&Ne.drawBuffers(e,s),Ne.viewport(le),Ne.scissor(ce),Ne.setScissorTest(he),r){const i=Ie.get(e.texture);et.framebufferTexture2D(et.FRAMEBUFFER,et.COLOR_ATTACHMENT0,et.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=Ie.get(e.texture),s=t||0;et.framebufferTextureLayer(et.FRAMEBUFFER,et.COLOR_ATTACHMENT0,i.__webglTexture,n||0,s)}oe=-1},this.readRenderTargetPixels=function(e,t,n,s,r,o,a){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=Ie.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){Ne.bindFramebuffer(et.FRAMEBUFFER,l);try{const a=e.texture,l=a.format,c=a.type;if(l!==i.wk1&&Ke.convert(l)!==et.getParameter(et.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===i.cLu&&(Re.has("EXT_color_buffer_half_float")||Le.isWebGL2&&Re.has("EXT_color_buffer_float"));if(!(c===i.ywz||Ke.convert(c)===et.getParameter(et.IMPLEMENTATION_COLOR_READ_TYPE)||c===i.VzW&&(Le.isWebGL2||Re.has("OES_texture_float")||Re.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-s&&n>=0&&n<=e.height-r&&et.readPixels(t,n,s,r,Ke.convert(l),Ke.convert(c),o)}finally{const e=null!==re?Ie.get(re).__webglFramebuffer:null;Ne.bindFramebuffer(et.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){const i=Math.pow(2,-n),s=Math.floor(t.image.width*i),r=Math.floor(t.image.height*i);Oe.setTexture2D(t,0),et.copyTexSubImage2D(et.TEXTURE_2D,n,0,0,e.x,e.y,s,r),Ne.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const s=t.image.width,r=t.image.height,o=Ke.convert(n.format),a=Ke.convert(n.type);Oe.setTexture2D(n,0),et.pixelStorei(et.UNPACK_FLIP_Y_WEBGL,n.flipY),et.pixelStorei(et.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),et.pixelStorei(et.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?et.texSubImage2D(et.TEXTURE_2D,i,e.x,e.y,s,r,o,a,t.image.data):t.isCompressedTexture?et.compressedTexSubImage2D(et.TEXTURE_2D,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):et.texSubImage2D(et.TEXTURE_2D,i,e.x,e.y,o,a,t.image),0===i&&n.generateMipmaps&&et.generateMipmap(et.TEXTURE_2D),Ne.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,s=0){if(te.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const r=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=Ke.convert(i.format),c=Ke.convert(i.type);let h;if(i.isData3DTexture)Oe.setTexture3D(i,0),h=et.TEXTURE_3D;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Oe.setTexture2DArray(i,0),h=et.TEXTURE_2D_ARRAY}et.pixelStorei(et.UNPACK_FLIP_Y_WEBGL,i.flipY),et.pixelStorei(et.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),et.pixelStorei(et.UNPACK_ALIGNMENT,i.unpackAlignment);const d=et.getParameter(et.UNPACK_ROW_LENGTH),u=et.getParameter(et.UNPACK_IMAGE_HEIGHT),p=et.getParameter(et.UNPACK_SKIP_PIXELS),m=et.getParameter(et.UNPACK_SKIP_ROWS),f=et.getParameter(et.UNPACK_SKIP_IMAGES),g=n.isCompressedTexture?n.mipmaps[0]:n.image;et.pixelStorei(et.UNPACK_ROW_LENGTH,g.width),et.pixelStorei(et.UNPACK_IMAGE_HEIGHT,g.height),et.pixelStorei(et.UNPACK_SKIP_PIXELS,e.min.x),et.pixelStorei(et.UNPACK_SKIP_ROWS,e.min.y),et.pixelStorei(et.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isData3DTexture?et.texSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,c,g.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),et.compressedTexSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,g.data)):et.texSubImage3D(h,s,t.x,t.y,t.z,r,o,a,l,c,g),et.pixelStorei(et.UNPACK_ROW_LENGTH,d),et.pixelStorei(et.UNPACK_IMAGE_HEIGHT,u),et.pixelStorei(et.UNPACK_SKIP_PIXELS,p),et.pixelStorei(et.UNPACK_SKIP_ROWS,m),et.pixelStorei(et.UNPACK_SKIP_IMAGES,f),0===s&&i.generateMipmaps&&et.generateMipmap(h),Ne.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?Oe.setTextureCube(e,0):e.isData3DTexture?Oe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Oe.setTexture2DArray(e,0):Oe.setTexture2D(e,0),Ne.unbindTexture()},this.resetState=function(){ie=0,se=0,re=null,Ne.reset(),Je.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return i._RZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===i.ntt?"display-p3":"srgb",t.unpackColorSpace=F.ep.workingColorSpace===i.AmZ?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===i.KI_?i.knz:i.rnI}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===i.knz?i.KI_:i.GUF}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}},76944:(e,t,n)=>{"use strict";n.d(t,{W:()=>i});const i={alphahash_fragment:"\n#ifdef USE_ALPHAHASH\n\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n\n#endif\n",alphahash_pars_fragment:"\n#ifdef USE_ALPHAHASH\n\n\t/**\n\t * See: https://casual-effects.com/research/Wyman2017Hashed/index.html\n\t */\n\n\tconst float ALPHA_HASH_SCALE = 0.05; // Derived from trials only, and may be changed.\n\n\tfloat hash2D( vec2 value ) {\n\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\n\t}\n\n\tfloat hash3D( vec3 value ) {\n\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\n\t}\n\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\n\t\t// Find the discretized derivatives of our coordinates\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\n\t\t// Find two nearest log-discretized noise scales\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\n\t\t// Compute alpha thresholds at our two noise scales\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\n\t\t// Factor to interpolate lerp with\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\n\t\t// Interpolate alpha threshold from noise at two scales\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\n\t\t// Pass into CDF to compute uniformly distrib threshold\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\n\t\t// Find our final, uniformly distributed alpha threshold (ατ)\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\n\t\t// Avoids ατ == 0. Could also do ατ =1-ατ\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\n\t}\n\n#endif\n",alphamap_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n\n#endif\n",alphamap_pars_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",alphatest_fragment:"\n#ifdef USE_ALPHATEST\n\n\tif ( diffuseColor.a < alphaTest ) discard;\n\n#endif\n",alphatest_pars_fragment:"\n#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif\n",aomap_fragment:"\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\n\t#endif\n\n#endif\n",aomap_pars_fragment:"\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n",begin_vertex:"\nvec3 transformed = vec3( position );\n\n#ifdef USE_ALPHAHASH\n\n\tvPosition = vec3( position );\n\n#endif\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n\n#ifdef USE_TANGENT\n\n\tvec3 objectTangent = vec3( tangent.xyz );\n\n#endif\n",bsdfs:"\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n",iridescence_fragment:"\n\n#ifdef USE_IRIDESCENCE\n\n\t// XYZ to linear-sRGB color space\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\n\t// Assume air interface for top\n\t// Note: We don't handle the case fresnel0 == 1\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\n\t}\n\n\t// Conversion FO/IOR\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\n\t}\n\n\t// ior is a value between 1.0 and 3.0. 1.0 is air interface\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\n\t}\n\n\t// Fresnel equations for dielectric/dielectric interfaces.\n\t// Ref: https://belcour.github.io/blog/research/2017/05/01/brdf-thin-film.html\n\t// Evaluation XYZ sensitivity curves in Fourier space\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\n\t}\n\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\n\t\tvec3 I;\n\n\t\t// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\t// Evaluate the cosTheta on the base layer (Snell law)\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\n\t\t// Handle TIR:\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\n\t\t\treturn vec3( 1.0 );\n\n\t\t}\n\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\n\t\t// First interface\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\n\t\t// Second interface\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0\n\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\n\t\t// Phase shift\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\n\t\t// Compound terms\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\n\t\t// Reflectance term for m = 0 (DC term amplitude)\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\n\t\t// Reflectance term for m > 0 (pairs of diracs)\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\n\t\t}\n\n\t\t// Since out of gamut colors might be produced, negative color values are clamped to 0.\n\t\treturn max( I, vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n",bumpmap_pars_fragment:"\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n\t\t// normalize is done to ensure that the bump map looks the same regardless of the texture's scale\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm; // normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",clipping_planes_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\tbool clipped = true;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\tif ( clipped ) discard;\n\n\t#endif\n\n#endif\n",clipping_planes_pars_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n",clipping_planes_pars_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n",clipping_planes_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n",color_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tdiffuseColor *= vColor;\n\n#elif defined( USE_COLOR )\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif\n",color_pars_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_pars_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvColor = vec4( 1.0 );\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvColor = vec3( 1.0 );\n\n#endif\n\n#ifdef USE_COLOR\n\n\tvColor *= color;\n\n#endif\n\n#ifdef USE_INSTANCING_COLOR\n\n\tvColor.xyz *= instanceColor.xyz;\n\n#endif\n",common:"\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n\treturn fract( sin( sn ) * c );\n\n}\n\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\n#ifdef USE_ALPHAHASH\n\n\tvarying vec3 vPosition;\n\n#endif\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t// dir can be either a direction vector or a normal vector\n\t// upper-left 3x3 of matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nmat3 transposeMat3( const in mat3 m ) {\n\n\tmat3 tmp;\n\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\n\treturn tmp;\n\n}\n\nfloat luminance( const in vec3 rgb ) {\n\n\t// assumes rgb is in linear color space with sRGB primaries and D65 white point\n\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\n\treturn dot( weights, rgb );\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n\treturn m[ 2 ][ 3 ] == - 1.0;\n\n}\n\nvec2 equirectUv( in vec3 dir ) {\n\n\t// dir is assumed to be unit length\n\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\treturn vec2( u, v );\n\n}\n\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n",cube_uv_reflection_fragment:"\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\n\t// These shader functions convert between the UV coordinates of a single face of\n\t// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n\t// sampling a textureCube (not generally normalized ).\n\n\tfloat getFace( vec3 direction ) {\n\n\t\tvec3 absDirection = abs( direction );\n\n\t\tfloat face = - 1.0;\n\n\t\tif ( absDirection.x > absDirection.z ) {\n\n\t\t\tif ( absDirection.x > absDirection.y )\n\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t} else {\n\n\t\t\tif ( absDirection.z > absDirection.y )\n\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t}\n\n\t\treturn face;\n\n\t}\n\n\t// RH coordinate system; PMREM face-indexing convention\n\tvec2 getUV( vec3 direction, float face ) {\n\n\t\tvec2 uv;\n\n\t\tif ( face == 0.0 ) {\n\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n\n\t\t} else if ( face == 1.0 ) {\n\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n\n\t\t} else if ( face == 2.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n\n\t\t} else if ( face == 3.0 ) {\n\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n\n\t\t} else if ( face == 4.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n\n\t\t} else {\n\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n\n\t\t}\n\n\t\treturn 0.5 * ( uv + 1.0 );\n\n\t}\n\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\n\t\tfloat face = getFace( direction );\n\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\n\t\tfloat faceSize = exp2( mipInt );\n\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071\n\n\t\tif ( face > 2.0 ) {\n\n\t\t\tuv.y += faceSize;\n\n\t\t\tface -= 3.0;\n\n\t\t}\n\n\t\tuv.x += face * faceSize;\n\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\n\t\t#ifdef texture2DGradEXT\n\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering\n\n\t\t#else\n\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\n\t\t#endif\n\n\t}\n\n\t// These defines must match with PMREMGenerator\n\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\n\tfloat roughnessToMip( float roughness ) {\n\n\t\tfloat mip = 0.0;\n\n\t\tif ( roughness >= cubeUV_r1 ) {\n\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\n\t\t} else {\n\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25\n\t\t}\n\n\t\treturn mip;\n\n\t}\n\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\n\t\tfloat mipF = fract( mip );\n\n\t\tfloat mipInt = floor( mip );\n\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\n\t\tif ( mipF == 0.0 ) {\n\n\t\t\treturn vec4( color0, 1.0 );\n\n\t\t} else {\n\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\n\t\t}\n\n\t}\n\n#endif\n",defaultnormal_vertex:"\nvec3 transformedNormal = objectNormal;\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// shear transforms in the instance matrix are not supported\n\n\tmat3 m = mat3( instanceMatrix );\n\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\n\ttransformedNormal = m * transformedNormal;\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#ifdef FLIP_SIDED\n\n\t\ttransformedTangent = - transformedTangent;\n\n\t#endif\n\n#endif\n",displacementmap_pars_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",displacementmap_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n\n#endif\n",emissivemap_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n",emissivemap_pars_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",colorspace_fragment:"\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n",colorspace_pars_fragment:"\n\n// http://www.russellcottrell.com/photo/matrixCalculator.htm\n\n// Linear sRGB => XYZ => Linear Display P3\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\n\n// Linear Display P3 => XYZ => Linear sRGB\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\n\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\n\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\n\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\n\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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 );\n}\n\n// @deprecated, r156\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\n\n// @deprecated, r156\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}\n",envmap_fragment:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",envmap_common_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif\n",envmap_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n",envmap_pars_vertex:"\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n",envmap_physical_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\n\t\t\t// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\t // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\n\t\t\t#else\n\n\t\t\t\treturn vec3( 0.0 );\n\n\t\t\t#endif\n\n\t\t}\n\n\t#endif\n\n#endif\n",envmap_vertex:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\n\n\tvFogDepth = - mvPosition.z;\n\n#endif\n",fog_pars_vertex:"\n#ifdef USE_FOG\n\n\tvarying float vFogDepth;\n\n#endif\n",fog_fragment:"\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",fog_pars_fragment:"\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n",gradientmap_pars_fragment:"\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\n\t#else\n\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\n\t#endif\n\n}\n",lightmap_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n\n#endif\n",lightmap_pars_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n",lights_lambert_fragment:"\nLambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;\n",lights_lambert_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct LambertMaterial {\n\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n\n};\n\nvoid 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 ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid 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 ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n",lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n\n#if defined( USE_LIGHT_PROBES )\n\n\tuniform vec3 lightProbe[ 9 ];\n\n#endif\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\treturn irradiance;\n\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t#if defined ( LEGACY_LIGHTS )\n\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t\t}\n\n\t\treturn 1.0;\n\n\t#else\n\n\t\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t\t// page 32, equation 26: E[window1]\n\t\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\t\tif ( cutoffDistance > 0.0 ) {\n\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t\t}\n\n\t\treturn distanceFalloff;\n\n\t#endif\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",lights_toon_fragment:"\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\n",lights_toon_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct ToonMaterial {\n\n\tvec3 diffuseColor;\n\n};\n\nvoid 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 ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid 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 ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n",lights_phong_fragment:"\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid 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 ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid 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 ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n",lights_physical_fragment:"\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\n\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n\n#ifdef IOR\n\n\tmaterial.ior = ior;\n\n\t#ifdef USE_SPECULAR\n\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\n\t\t#endif\n\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\n\t\t#endif\n\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\n\t#else\n\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\n\t#endif\n\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\n\t#ifdef USE_IRIDESCENCEMAP\n\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\n\t#else\n\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\n\t#endif\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheenColor;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\n\t#endif\n\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\n\t#endif\n\n#endif\n\n#ifdef USE_ANISOTROPY\n\n\t#ifdef USE_ANISOTROPYMAP\n\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\n\t#else\n\n\t\tvec2 anisotropyV = anisotropyVector;\n\n\t#endif\n\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\n\t// Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy.\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n\n#endif\n",lights_physical_pars_fragment:'\n\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\n\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf\n#ifdef USE_ANISOTROPY\n\n\tfloat 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 ) {\n\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\n\t\treturn saturate(v);\n\n\t}\n\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\n\t}\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\t// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\n\t\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t\treturn F * ( V * D );\n\n\t}\n\n#endif\n\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\n\t#else\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t#endif\n\n\treturn F * ( V * D );\n\n}\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\n\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\n\t// project rect onto sphere\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\n\t// calculate vector form factor\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n\n// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from \n// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found\n// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\n\treturn saturate( DG * RECIPROCAL_PI );\n\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\n\treturn fab;\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\n\t#else\n\n\t\tvec3 Fr = specularColor;\n\n\t#endif\n\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid 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 ) {\n\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid 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 ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\n\t#endif\n\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvoid 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 ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid 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) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\n\t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\n\t#else\n\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\n\t#endif\n\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n',lights_fragment_begin:"\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometryClearcoatNormal = clearcoatNormal;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\n\tif ( material.iridescenceThickness == 0.0 ) {\n\n\t\tmaterial.iridescence = 0.0;\n\n\t} else {\n\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\n\t}\n\n\tif ( material.iridescence > 0.0 ) {\n\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\n\t\t// Iridescence F0 approximation\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\n\t}\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\n\t\t// spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\t#if defined( USE_LIGHT_PROBES )\n\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\n\t#endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\n\t#else\n\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\n\t#endif\n\n#endif\n",lights_fragment_end:"\n#if defined( RE_IndirectDiffuse )\n\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n",logdepthbuf_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n",logdepthbuf_pars_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_pars_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\n\t#else\n\n\t\tuniform float logDepthBufFC;\n\n\t#endif\n\n#endif\n",logdepthbuf_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n\t#else\n\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\n\t\t\tgl_Position.z *= gl_Position.w;\n\n\t\t}\n\n\t#endif\n\n#endif\n",map_fragment:"\n#ifdef USE_MAP\n\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures\n\n\t\tsampledDiffuseColor = 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 );\n\t\n\t#endif\n\n\tdiffuseColor *= sampledDiffuseColor;\n\n#endif\n",map_pars_fragment:"\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",map_particle_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t#if defined( USE_POINTS_UV )\n\n\t\tvec2 uv = vUv;\n\n\t#else\n\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, uv );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n",map_particle_pars_fragment:"\n#if defined( USE_POINTS_UV )\n\n\tvarying vec2 vUv;\n\n#else\n\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t\tuniform mat3 uvTransform;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n",metalnessmap_pars_fragment:"\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n",morphcolor_vertex:"\n#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tvColor *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t#if defined( USE_COLOR_ALPHA )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\n\t\t#elif defined( USE_COLOR )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\n\t\t#endif\n\n\t}\n\n#endif\n",morphnormal_vertex:"\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\n\t\t}\n\n\t#else\n\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\n\t#endif\n\n#endif\n",morphtarget_pars_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\tuniform float morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\n\t\t}\n\n\t#else\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\n\t\t#else\n\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",morphtarget_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\n\t\t}\n\n\t#else\n\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",normal_fragment_begin:"\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal *= faceDirection;\n\n\t#endif\n\n#endif\n\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\n\t#endif\n\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\n\t#endif\n\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 nonPerturbedNormal = normal;\n\n",normal_fragment_maps:"\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\n\tnormal = normalize( tbn * mapN );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n\n#endif\n",normal_pars_fragment:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_pars_vertex:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_vertex:"\n#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n",normalmap_pars_fragment:"\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\n\t// Normal Mapping Without Precomputed Tangents\n\t// http://www.thetenthplanet.de/archives/1180\n\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\n\t\tvec3 N = surf_norm; // normalized\n\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\n\t\treturn mat3( T * scale, B * scale, N );\n\n\t}\n\n#endif\n",clearcoat_normal_fragment_begin:"\n#ifdef USE_CLEARCOAT\n\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n\n#endif\n",clearcoat_normal_fragment_maps:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n\n#endif\n",clearcoat_pars_fragment:"\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n",iridescence_pars_fragment:"\n\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform sampler2D iridescenceMap;\n\n#endif\n\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform sampler2D iridescenceThicknessMap;\n\n#endif\n",opaque_fragment:"\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\n\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n",packing:"\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\n\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\n\nconst float ShiftRight8 = 1. / 256.;\n\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\n\treturn r * PackUpscale;\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\n\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\n\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\n\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\n\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( viewZ + near ) / ( near - far );\n}\n\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t// maps orthographic depth in [ 0, 1 ] to viewZ\n\treturn depth * ( near - far ) - near;\n}\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\n\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t// maps perspective depth in [ 0, 1 ] to viewZ\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}\n",premultiplied_alpha_fragment:"\n#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n",dithering_pars_fragment:"\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift according to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n",roughnessmap_fragment:"\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n",roughnessmap_pars_fragment:"\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n",shadowmap_pars_fragment:"\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#if NUM_SPOT_LIGHT_MAPS > 0\n\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): create uniforms for area light shadows\n\n\t#endif\n\t*/\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n\t}\n\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n\t\tfloat occlusion = 1.0;\n\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\n\t\tfloat hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n\t\tif (hard_shadow != 1.0 ) {\n\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality\n\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n\t\t}\n\t\treturn occlusion;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#else // no percentage-closer filtering:\n\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn shadow;\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// dp = normalized distance from light to fragment position\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n\t\tdp += shadowBias;\n\n\t\t// bd3D = base direction 3D\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#else // no percentage-closer filtering\n\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t#endif\n\n\t}\n\n#endif\n",shadowmap_pars_vertex:"\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n",shadowmap_vertex:"\n\n#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\n\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n\n#endif\n\n#if defined( USE_SHADOWMAP )\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n\n// spot lights can be evaluated without active shadow mapping (when SpotLight.map is used)\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n\n",shadowmask_pars_fragment:"\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n",skinbase_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif\n",skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\n\tmat4 getBoneMatrix( const in float i ) {\n\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\n\t\ty = dy * ( y + 0.5 );\n\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\treturn bone;\n\n\t}\n\n#endif\n",skinning_vertex:"\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",skinnormal_vertex:"\n#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",specularmap_fragment:"\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n",specularmap_pars_fragment:"\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n",tonemapping_fragment:"\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",tonemapping_pars_fragment:"\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn saturate( toneMappingExposure * color );\n\n}\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nvec3 RRTAndODTFit( vec3 v ) {\n\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n\n}\n\n// this implementation of ACES is modified to accommodate a brighter viewing environment.\n// the scale factor of 1/0.6 is subjective. see discussion in #19621.\n\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\n\tcolor *= toneMappingExposure / 0.6;\n\n\tcolor = ACESInputMat * color;\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( color );\n\n\tcolor = ACESOutputMat * color;\n\n\t// Clamp to [0, 1]\n\treturn saturate( color );\n\n}\n\nvec3 CustomToneMapping( vec3 color ) { return color; }\n",transmission_fragment:"\n#ifdef USE_TRANSMISSION\n\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\n\t#endif\n\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n\n#endif\n",transmission_pars_fragment:"\n#ifdef USE_TRANSMISSION\n\n\t// Transmission code is based on glTF-Sampler-Viewer\n\t// https://github.com/KhronosGroup/glTF-Sample-Viewer\n\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tuniform sampler2D transmissionMap;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tuniform sampler2D thicknessMap;\n\n\t#endif\n\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\n\tvarying vec3 vWorldPosition;\n\n\t// Mipped Bicubic Texture Filtering by N8\n\t// https://www.shadertoy.com/view/Dl2SDW\n\n\tfloat w0( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w1( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\n\t}\n\n\tfloat w2( float a ){\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w3( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\n\t}\n\n\t// g0 and g1 are the two amplitude functions\n\tfloat g0( float a ) {\n\n\t\treturn w0( a ) + w1( a );\n\n\t}\n\n\tfloat g1( float a ) {\n\n\t\treturn w2( a ) + w3( a );\n\n\t}\n\n\t// h0 and h1 are the two offset functions\n\tfloat h0( float a ) {\n\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\n\t}\n\n\tfloat h1( float a ) {\n\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\n\t}\n\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\n\t\tuv = uv * texelSize.zw + 0.5;\n\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\n\t}\n\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\n\t}\n\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\n\t\t// Direction of refracted light.\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\n\t\t// Compute rotation-independant scaling of the model matrix.\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t// The thickness is specified in local space.\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\n\t}\n\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\n\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\n\t}\n\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\n\t}\n\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tif ( isinf( attenuationDistance ) ) {\n\n\t\t\t// Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all.\n\t\t\treturn vec3( 1.0 );\n\n\t\t} else {\n\n\t\t\t// Compute light attenuation using Beer's law.\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law\n\t\t\treturn transmittance;\n\n\t\t}\n\n\t}\n\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\n\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\n\t\t// Get the specular component.\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\n\t\t// As less light is transmitted, the opacity should be increased. This simple approximation does a decent job \n\t\t// of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color.\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\n\t}\n#endif\n",uv_pars_fragment:"\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n",uv_pars_vertex:"\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n",uv_vertex:"\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvUv = vec3( uv, 1 ).xy;\n\n#endif\n#ifdef USE_MAP\n\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n",worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n",background_vert:"\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n",background_frag:"\nuniform sampler2D t2D;\nuniform float backgroundIntensity;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tvec4 texColor = texture2D( t2D, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures\n\n\t\ttexColor = 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 );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n",backgroundCube_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",backgroundCube_frag:"\n\n#ifdef ENVMAP_TYPE_CUBE\n\n\tuniform samplerCube envMap;\n\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\tuniform sampler2D envMap;\n\n#endif\n\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\n\t#else\n\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n",cube_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",cube_frag:"\nuniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\nvoid main() {\n\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include \n\t#include \n\n}\n",depth_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n",depth_frag:"\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n",distanceRGBA_vert:"\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n",distanceRGBA_frag:"\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main () {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n",equirect_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n}\n",equirect_frag:"\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV = equirectUv( direction );\n\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t#include \n\t#include \n\n}\n",linedashed_vert:"\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",linedashed_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshlambert_frag:"\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshmatcap_vert:"\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n",meshmatcap_frag:"\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshnormal_vert:"\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n",meshnormal_frag:"\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\n\t#ifdef OPAQUE\n\n\t\tgl_FragColor.a = 1.0;\n\n\t#endif\n\n}\n",meshphong_vert:"\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphong_frag:"\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n",meshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_vert:"\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n",meshtoon_frag:"\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_vert:"\nuniform float size;\nuniform float scale;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_POINTS_UV\n\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n\n#endif\n\nvoid main() {\n\n\t#ifdef USE_POINTS_UV\n\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",shadow_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n",shadow_frag:"\nuniform vec3 color;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_vert:"\nuniform float rotation;\nuniform vec2 center;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"}},17393:(e,t,n)=>{"use strict";n.d(t,{V:()=>h});var i=n(76944),s=n(8173),r=n(40693),o=n(19588),a=n(74102),l=n(93113),c=n(23130);const h={basic:{uniforms:(0,s.Rh)([a.r.common,a.r.specularmap,a.r.envmap,a.r.aomap,a.r.lightmap,a.r.fog]),vertexShader:i.W.meshbasic_vert,fragmentShader:i.W.meshbasic_frag},lambert:{uniforms:(0,s.Rh)([a.r.common,a.r.specularmap,a.r.envmap,a.r.aomap,a.r.lightmap,a.r.emissivemap,a.r.bumpmap,a.r.normalmap,a.r.displacementmap,a.r.fog,a.r.lights,{emissive:{value:new l.I(0)}}]),vertexShader:i.W.meshlambert_vert,fragmentShader:i.W.meshlambert_frag},phong:{uniforms:(0,s.Rh)([a.r.common,a.r.specularmap,a.r.envmap,a.r.aomap,a.r.lightmap,a.r.emissivemap,a.r.bumpmap,a.r.normalmap,a.r.displacementmap,a.r.fog,a.r.lights,{emissive:{value:new l.I(0)},specular:{value:new l.I(1118481)},shininess:{value:30}}]),vertexShader:i.W.meshphong_vert,fragmentShader:i.W.meshphong_frag},standard:{uniforms:(0,s.Rh)([a.r.common,a.r.envmap,a.r.aomap,a.r.lightmap,a.r.emissivemap,a.r.bumpmap,a.r.normalmap,a.r.displacementmap,a.r.roughnessmap,a.r.metalnessmap,a.r.fog,a.r.lights,{emissive:{value:new l.I(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:i.W.meshphysical_vert,fragmentShader:i.W.meshphysical_frag},toon:{uniforms:(0,s.Rh)([a.r.common,a.r.aomap,a.r.lightmap,a.r.emissivemap,a.r.bumpmap,a.r.normalmap,a.r.displacementmap,a.r.gradientmap,a.r.fog,a.r.lights,{emissive:{value:new l.I(0)}}]),vertexShader:i.W.meshtoon_vert,fragmentShader:i.W.meshtoon_frag},matcap:{uniforms:(0,s.Rh)([a.r.common,a.r.bumpmap,a.r.normalmap,a.r.displacementmap,a.r.fog,{matcap:{value:null}}]),vertexShader:i.W.meshmatcap_vert,fragmentShader:i.W.meshmatcap_frag},points:{uniforms:(0,s.Rh)([a.r.points,a.r.fog]),vertexShader:i.W.points_vert,fragmentShader:i.W.points_frag},dashed:{uniforms:(0,s.Rh)([a.r.common,a.r.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:i.W.linedashed_vert,fragmentShader:i.W.linedashed_frag},depth:{uniforms:(0,s.Rh)([a.r.common,a.r.displacementmap]),vertexShader:i.W.depth_vert,fragmentShader:i.W.depth_frag},normal:{uniforms:(0,s.Rh)([a.r.common,a.r.bumpmap,a.r.normalmap,a.r.displacementmap,{opacity:{value:1}}]),vertexShader:i.W.meshnormal_vert,fragmentShader:i.W.meshnormal_frag},sprite:{uniforms:(0,s.Rh)([a.r.sprite,a.r.fog]),vertexShader:i.W.sprite_vert,fragmentShader:i.W.sprite_frag},background:{uniforms:{uvTransform:{value:new c.V},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:i.W.background_vert,fragmentShader:i.W.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:i.W.backgroundCube_vert,fragmentShader:i.W.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:i.W.cube_vert,fragmentShader:i.W.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:i.W.equirect_vert,fragmentShader:i.W.equirect_frag},distanceRGBA:{uniforms:(0,s.Rh)([a.r.common,a.r.displacementmap,{referencePosition:{value:new o.P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:i.W.distanceRGBA_vert,fragmentShader:i.W.distanceRGBA_frag},shadow:{uniforms:(0,s.Rh)([a.r.lights,a.r.fog,{color:{value:new l.I(0)},opacity:{value:1}}]),vertexShader:i.W.shadow_vert,fragmentShader:i.W.shadow_frag}};h.physical={uniforms:(0,s.Rh)([h.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new c.V},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new c.V},clearcoatNormalScale:{value:new r.F(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new c.V},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new c.V},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new c.V},sheen:{value:0},sheenColor:{value:new l.I(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new c.V},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new c.V},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new c.V},transmissionSamplerSize:{value:new r.F},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new c.V},attenuationDistance:{value:0},attenuationColor:{value:new l.I(0)},specularColor:{value:new l.I(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new c.V},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new c.V},anisotropyVector:{value:new r.F},anisotropyMap:{value:null},anisotropyMapTransform:{value:new c.V}}]),vertexShader:i.W.meshphysical_vert,fragmentShader:i.W.meshphysical_frag}},89260:(e,t,n)=>{"use strict";n.d(t,{D:()=>s,u:()=>i});const i="\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n",s="\nuniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n\n#include \n\nvoid main() {\n\n\tconst float samples = float( VSM_SAMPLES );\n\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\n\t\t#ifdef HORIZONTAL_PASS\n\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\n\t\t#else\n\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\n\t\t#endif\n\n\t}\n\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n\n}\n"},74102:(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var i=n(93113),s=n(40693),r=n(23130);const o={common:{diffuse:{value:new i.I(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new r.V},alphaMap:{value:null},alphaMapTransform:{value:new r.V},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new r.V}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new r.V}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new r.V}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new r.V},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new r.V},normalScale:{value:new s.F(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new r.V},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new r.V}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new r.V}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new r.V}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new i.I(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new i.I(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new r.V},alphaTest:{value:0},uvTransform:{value:new r.V}},sprite:{diffuse:{value:new i.I(16777215)},opacity:{value:1},center:{value:new s.F(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new r.V},alphaMap:{value:null},alphaMapTransform:{value:new r.V},alphaTest:{value:0}}}},8173:(e,t,n)=>{"use strict";n.d(t,{Rh:()=>r,dw:()=>s,fd:()=>o,oD:()=>a,rD:()=>l});var i=n(19748);function s(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const s=e[n][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=s.clone():Array.isArray(s)?t[n][i]=s.slice():t[n][i]=s}}return t}function r(e){const t={};for(let n=0;n{"use strict";function i(){let e=null,t=!1,n=null,i=null;function s(t,r){n(t,r),i=e.requestAnimationFrame(s)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(s),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}n.d(t,{C:()=>i})},34455:(e,t,n)=>{"use strict";function i(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,s){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.versioni})},26067:(e,t,n)=>{"use strict";n.d(t,{a:()=>p});var i=n(75544),s=n(40071),r=n(83866),o=n(44428),a=n(93113),l=n(19748),c=n(8035),h=n(17393),d=n(8173);const u={r:0,b:0,g:0};function p(e,t,n,p,m,f,g){const v=new a.I(0);let y,b,_=!0===f?0:1,x=null,w=0,S=null;function M(t,n){t.getRGB(u,(0,d.oD)(e)),p.buffers.color.setClear(u.r,u.g,u.b,n,g)}return{getClearColor:function(){return v},setClearColor:function(e,t=1){v.set(e),_=t,M(v,_)},getClearAlpha:function(){return _},setClearAlpha:function(e){_=e,M(v,_)},render:function(a,u){let f=!1,E=!0===u.isScene?u.background:null;if(E&&E.isTexture){E=(u.backgroundBlurriness>0?n:t).get(E)}null===E?M(v,_):E&&E.isColor&&(M(E,1),f=!0);const T=e.xr.getEnvironmentBlendMode();"additive"===T?p.buffers.color.setClear(0,0,0,1,g):"alpha-blend"===T&&p.buffers.color.setClear(0,0,0,0,g),(e.autoClear||f)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),E&&(E.isCubeTexture||E.mapping===i.g8_)?(void 0===b&&(b=new c.K(new s.D(1,1,1),new o.j({name:"BackgroundCubeMaterial",uniforms:(0,d.dw)(h.V.backgroundCube.uniforms),vertexShader:h.V.backgroundCube.vertexShader,fragmentShader:h.V.backgroundCube.fragmentShader,side:i._Li,depthTest:!1,depthWrite:!1,fog:!1})),b.geometry.deleteAttribute("normal"),b.geometry.deleteAttribute("uv"),b.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(b.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),m.update(b)),b.material.uniforms.envMap.value=E,b.material.uniforms.flipEnvMap.value=E.isCubeTexture&&!1===E.isRenderTargetTexture?-1:1,b.material.uniforms.backgroundBlurriness.value=u.backgroundBlurriness,b.material.uniforms.backgroundIntensity.value=u.backgroundIntensity,b.material.toneMapped=l.ep.getTransfer(E.colorSpace)!==i.j17,x===E&&w===E.version&&S===e.toneMapping||(b.material.needsUpdate=!0,x=E,w=E.version,S=e.toneMapping),b.layers.enableAll(),a.unshift(b,b.geometry,b.material,0,0,null)):E&&E.isTexture&&(void 0===y&&(y=new c.K(new r._(2,2),new o.j({name:"BackgroundMaterial",uniforms:(0,d.dw)(h.V.background.uniforms),vertexShader:h.V.background.vertexShader,fragmentShader:h.V.background.fragmentShader,side:i.Wl3,depthTest:!1,depthWrite:!1,fog:!1})),y.geometry.deleteAttribute("normal"),Object.defineProperty(y.material,"map",{get:function(){return this.uniforms.t2D.value}}),m.update(y)),y.material.uniforms.t2D.value=E,y.material.uniforms.backgroundIntensity.value=u.backgroundIntensity,y.material.toneMapped=l.ep.getTransfer(E.colorSpace)!==i.j17,!0===E.matrixAutoUpdate&&E.updateMatrix(),y.material.uniforms.uvTransform.value.copy(E.matrix),x===E&&w===E.version&&S===e.toneMapping||(y.material.needsUpdate=!0,x=E,w=E.version,S=e.toneMapping),y.layers.enableAll(),a.unshift(y,y.geometry,y.material,0,0,null))}}}},83596:(e,t,n)=>{"use strict";n.d(t,{s:()=>s});var i=n(75544);function s(e,t,n,s){const r=e.getParameter(e.MAX_VERTEX_ATTRIBS),o=s.isWebGL2?null:t.get("OES_vertex_array_object"),a=s.isWebGL2||null!==o,l={},c=m(null);let h=c,d=!1;function u(t){return s.isWebGL2?e.bindVertexArray(t):o.bindVertexArrayOES(t)}function p(t){return s.isWebGL2?e.deleteVertexArray(t):o.deleteVertexArrayOES(t)}function m(e){const t=[],n=[],i=[];for(let e=0;e=0){const n=s[t];let i=r[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}}return h.attributesNum!==o||h.index!==i}(r,_,p,x),w&&function(e,t,n,i){const s={},r=t.attributes;let o=0;const a=n.getAttributes();for(const t in a){if(a[t].location>=0){let n=r[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),s[t]=i,o++}}h.attributes=s,h.attributesNum=o,h.index=i}(r,_,p,x)}else{const e=!0===c.wireframe;h.geometry===_.id&&h.program===p.id&&h.wireframe===e||(h.geometry=_.id,h.program=p.id,h.wireframe=e,w=!0)}null!==x&&n.update(x,e.ELEMENT_ARRAY_BUFFER),(w||d)&&(d=!1,function(r,o,a,l){if(!1===s.isWebGL2&&(r.isInstancedMesh||l.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();const c=l.attributes,h=a.getAttributes(),d=o.defaultAttributeValues;for(const t in h){const o=h[t];if(o.location>=0){let a=c[t];if(void 0===a&&("instanceMatrix"===t&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const t=a.normalized,c=a.itemSize,h=n.get(a);if(void 0===h)continue;const d=h.buffer,u=h.type,p=h.bytesPerElement,m=!0===s.isWebGL2&&(u===e.INT||u===e.UNSIGNED_INT||a.gpuType===i.Kz5);if(a.isInterleavedBufferAttribute){const n=a.data,i=n.stride,s=a.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e{"use strict";function i(e,t,n,i){const s=i.isWebGL2;let r;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r,1)},this.renderInstances=function(i,o,a){if(0===a)return;let l,c;if(s)l=e,c="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](r,i,o,a),n.update(o,r,a)}}n.d(t,{w:()=>i})},49917:(e,t,n)=>{"use strict";function i(e,t,n){let i;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const r="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name;let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=r||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),m=e.getParameter(e.MAX_VERTEX_ATTRIBS),f=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=d>0,b=r||t.has("OES_texture_float");return{isWebGL2:r,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:s,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:r?e.getParameter(e.MAX_SAMPLES):0}}n.d(t,{G:()=>i})},89479:(e,t,n)=>{"use strict";n.d(t,{h:()=>r});var i=n(23130),s=n(82094);function r(e){const t=this;let n=null,r=0,o=!1,a=!1;const l=new s.J,c=new i.V,h={value:null,needsUpdate:!1};function d(e,n,i,s){const r=null!==e?e.length:0;let o=null;if(0!==r){if(o=h.value,!0!==s||null===o){const t=i+4*r,s=n.matrixWorldInverse;c.getNormalMatrix(s),(null===o||o.length0);t.numPlanes=r,t.numIntersection=0}();else{const e=a?0:r,t=4*e;let i=m.clippingState||null;h.value=i,i=d(c,s,t,l);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}},5058:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});var i=n(75544),s=n(65996);function r(e){let t=new WeakMap;function n(e,t){return t===i.dSO?e.mapping=i.fY$:t===i.Bf4&&(e.mapping=i.vxC),e}function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(o){if(o&&o.isTexture&&!1===o.isRenderTargetTexture){const a=o.mapping;if(a===i.dSO||a===i.Bf4){if(t.has(o)){return n(t.get(o).texture,o.mapping)}{const i=o.image;if(i&&i.height>0){const a=new s.o(i.height/2);return a.fromEquirectangularTexture(e,o),t.set(o,a),o.addEventListener("dispose",r),n(a.texture,o.mapping)}return null}}}return o},dispose:function(){t=new WeakMap}}}},39412:(e,t,n)=>{"use strict";n.d(t,{W:()=>r});var i=n(75544),s=n(93612);function r(e){let t=new WeakMap,n=null;function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(o){if(o&&o.isTexture){const a=o.mapping,l=a===i.dSO||a===i.Bf4,c=a===i.fY$||a===i.vxC;if(l||c){if(o.isRenderTargetTexture&&!0===o.needsPMREMUpdate){o.needsPMREMUpdate=!1;let i=t.get(o);return null===n&&(n=new s.a(e)),i=l?n.fromEquirectangular(o,i):n.fromCubemap(o,i),t.set(o,i),i.texture}if(t.has(o))return t.get(o).texture;{const i=o.image;if(l&&i&&i.height>0||c&&i&&function(e){let t=0;const n=6;for(let i=0;i{"use strict";function i(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}n.d(t,{P:()=>i})},88753:(e,t,n)=>{"use strict";n.d(t,{Y:()=>r});var i=n(35322),s=n(19564);function r(e,t,n,r){const o={},a=new WeakMap;function l(e){const i=e.target;null!==i.index&&t.remove(i.index);for(const e in i.attributes)t.remove(i.attributes[e]);for(const e in i.morphAttributes){const n=i.morphAttributes[e];for(let e=0,i=n.length;e{"use strict";function i(e,t,n,i){const s=i.isWebGL2;let r,o,a;this.setMode=function(e){r=e},this.setIndex=function(e){o=e.type,a=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,o,t*a),n.update(i,r,1)},this.renderInstances=function(i,l,c){if(0===c)return;let h,d;if(s)h=e,d="drawElementsInstanced";else if(h=t.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](r,l,o,i*a,c),n.update(l,r,c)}}n.d(t,{x:()=>i})},31132:(e,t,n)=>{"use strict";function i(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,s){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=s*(n/3);break;case e.LINES:t.lines+=s*(n/2);break;case e.LINE_STRIP:t.lines+=s*(n-1);break;case e.LINE_LOOP:t.lines+=s*n;break;case e.POINTS:t.points+=s*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}n.d(t,{I:()=>i})},19836:(e,t,n)=>{"use strict";n.d(t,{h:()=>d});var i=n(93113),s=n(82587),r=n(40693),o=n(19588),a=n(74102);function l(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new o.P,color:new i.I};break;case"SpotLight":n={position:new o.P,direction:new o.P,color:new i.I,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new o.P,color:new i.I,distance:0,decay:0};break;case"HemisphereLight":n={direction:new o.P,skyColor:new i.I,groundColor:new i.I};break;case"RectAreaLight":n={color:new i.I,position:new o.P,halfWidth:new o.P,halfHeight:new o.P}}return e[t.id]=n,n}}}let c=0;function h(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function d(e,t){const n=new l,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new r.F};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new r.F,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),d={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 e=0;e<9;e++)d.probe.push(new o.P);const u=new o.P,p=new s.y,m=new s.y;return{setup:function(s,r){let o=0,l=0,u=0;for(let e=0;e<9;e++)d.probe[e].set(0,0,0);let p=0,m=0,f=0,g=0,v=0,y=0,b=0,_=0,x=0,w=0,S=0;s.sort(h);const M=!0===r?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(d.rectAreaLTC1=a.r.LTC_FLOAT_1,d.rectAreaLTC2=a.r.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(d.rectAreaLTC1=a.r.LTC_HALF_1,d.rectAreaLTC2=a.r.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),d.ambient[0]=o,d.ambient[1]=l,d.ambient[2]=u;const E=d.hash;E.directionalLength===p&&E.pointLength===m&&E.spotLength===f&&E.rectAreaLength===g&&E.hemiLength===v&&E.numDirectionalShadows===y&&E.numPointShadows===b&&E.numSpotShadows===_&&E.numSpotMaps===x&&E.numLightProbes===S||(d.directional.length=p,d.spot.length=f,d.rectArea.length=g,d.point.length=m,d.hemi.length=v,d.directionalShadow.length=y,d.directionalShadowMap.length=y,d.pointShadow.length=b,d.pointShadowMap.length=b,d.spotShadow.length=_,d.spotShadowMap.length=_,d.directionalShadowMatrix.length=y,d.pointShadowMatrix.length=b,d.spotLightMatrix.length=_+x-w,d.spotLightMap.length=x,d.numSpotLightShadowsWithMaps=w,d.numLightProbes=S,E.directionalLength=p,E.pointLength=m,E.spotLength=f,E.rectAreaLength=g,E.hemiLength=v,E.numDirectionalShadows=y,E.numPointShadows=b,E.numSpotShadows=_,E.numSpotMaps=x,E.numLightProbes=S,d.version=c++)},setupView:function(e,t){let n=0,i=0,s=0,r=0,o=0;const a=t.matrixWorldInverse;for(let t=0,l=e.length;t{"use strict";n.d(t,{J:()=>r});var i=n(75544),s=n(8173);function r(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(s,r){s.opacity.value=r.opacity,r.color&&s.diffuse.value.copy(r.color),r.emissive&&s.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(s.map.value=r.map,n(r.map,s.mapTransform)),r.alphaMap&&(s.alphaMap.value=r.alphaMap,n(r.alphaMap,s.alphaMapTransform)),r.bumpMap&&(s.bumpMap.value=r.bumpMap,n(r.bumpMap,s.bumpMapTransform),s.bumpScale.value=r.bumpScale,r.side===i._Li&&(s.bumpScale.value*=-1)),r.normalMap&&(s.normalMap.value=r.normalMap,n(r.normalMap,s.normalMapTransform),s.normalScale.value.copy(r.normalScale),r.side===i._Li&&s.normalScale.value.negate()),r.displacementMap&&(s.displacementMap.value=r.displacementMap,n(r.displacementMap,s.displacementMapTransform),s.displacementScale.value=r.displacementScale,s.displacementBias.value=r.displacementBias),r.emissiveMap&&(s.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,s.emissiveMapTransform)),r.specularMap&&(s.specularMap.value=r.specularMap,n(r.specularMap,s.specularMapTransform)),r.alphaTest>0&&(s.alphaTest.value=r.alphaTest);const o=t.get(r).envMap;if(o&&(s.envMap.value=o,s.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,s.reflectivity.value=r.reflectivity,s.ior.value=r.ior,s.refractionRatio.value=r.refractionRatio),r.lightMap){s.lightMap.value=r.lightMap;const t=!0===e._useLegacyLights?Math.PI:1;s.lightMapIntensity.value=r.lightMapIntensity*t,n(r.lightMap,s.lightMapTransform)}r.aoMap&&(s.aoMap.value=r.aoMap,s.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,s.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,(0,s.oD)(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,s,o,a,l){s.isMeshBasicMaterial||s.isMeshLambertMaterial?r(e,s):s.isMeshToonMaterial?(r(e,s),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,s)):s.isMeshPhongMaterial?(r(e,s),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,s)):s.isMeshStandardMaterial?(r(e,s),function(e,i){e.metalness.value=i.metalness,i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,e.metalnessMapTransform));e.roughness.value=i.roughness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,e.roughnessMapTransform));t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}(e,s),s.isMeshPhysicalMaterial&&function(e,t,s){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===i._Li&&e.clearcoatNormalScale.value.negate()));t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=s.texture,e.transmissionSamplerSize.value.set(s.width,s.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,s,l)):s.isMeshMatcapMaterial?(r(e,s),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,s)):s.isMeshDepthMaterial?r(e,s):s.isMeshDistanceMaterial?(r(e,s),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,s)):s.isMeshNormalMaterial?r(e,s):s.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,s),s.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,s)):s.isPointsMaterial?function(e,t,i,s){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*s,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,s,o,a):s.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,s):s.isShadowMaterial?(e.color.value.copy(s.color),e.opacity.value=s.opacity):s.isShaderMaterial&&(s.uniformsNeedUpdate=!1)}}}},27153:(e,t,n)=>{"use strict";n.d(t,{i:()=>c});var i=n(75544),s=n(57938),r=n(84538),o=n(40693);function a(e,t){return e[0]-t[0]}function l(e,t){return Math.abs(t[1])-Math.abs(e[1])}function c(e,t,n){const c={},h=new Float32Array(8),d=new WeakMap,u=new r.L,p=[];for(let e=0;e<8;e++)p[e]=[e,0];return{update:function(r,m,f){const g=r.morphTargetInfluences;if(!0===t.isWebGL2){const v=m.morphAttributes.position||m.morphAttributes.normal||m.morphAttributes.color,y=void 0!==v?v.length:0;let b=d.get(m);if(void 0===b||b.count!==y){void 0!==b&&b.texture.dispose();const w=void 0!==m.morphAttributes.position,S=void 0!==m.morphAttributes.normal,M=void 0!==m.morphAttributes.color,E=m.morphAttributes.position||[],T=m.morphAttributes.normal||[],C=m.morphAttributes.color||[];let A=0;!0===w&&(A=1),!0===S&&(A=2),!0===M&&(A=3);let P=m.attributes.position.count*A,R=1;P>t.maxTextureSize&&(R=Math.ceil(P/t.maxTextureSize),P=t.maxTextureSize);const L=new Float32Array(P*R*4*y),N=new s.p(L,P,R,y);N.type=i.VzW,N.needsUpdate=!0;const D=4*A;for(let O=0;O{"use strict";function i(e,t,n,i){let s=new WeakMap;function r(e){const t=e.target;t.removeEventListener("dispose",r),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){const a=i.render.frame,l=o.geometry,c=t.get(o,l);if(s.get(c)!==a&&(t.update(c),s.set(c,a)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",r)&&o.addEventListener("dispose",r),s.get(o)!==a&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),s.set(o,a))),o.isSkinnedMesh){const e=o.skeleton;s.get(e)!==a&&(e.update(),s.set(e,a))}return c},dispose:function(){s=new WeakMap}}}n.d(t,{E:()=>i})},48580:(e,t,n)=>{"use strict";n.d(t,{d:()=>S});var i=n(64061),s=n(31685),r=n(76944),o=n(75544),a=n(19748);let l=0;function c(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),s=e.getShaderInfoLog(t).trim();if(i&&""===s)return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const i=parseInt(r[1]);return n.toUpperCase()+"\n\n"+s+"\n\n"+function(e,t){const n=e.split("\n"),i=[],s=Math.max(t-6,0),r=Math.min(t+6,n.length);for(let e=s;e":" "} ${s}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return s}function h(e,t){const n=function(e){const t=a.ep.getPrimaries(a.ep.workingColorSpace),n=a.ep.getPrimaries(e);let i;switch(t===n?i="":t===o.FVh&&n===o.Vtg?i="LinearDisplayP3ToLinearSRGB":t===o.Vtg&&n===o.FVh&&(i="LinearSRGBToLinearDisplayP3"),e){case o.GUF:case o.AmZ:return[i,"LinearTransferOETF"];case o.KI_:case o.ntt:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function d(e,t){let n;switch(t){case o.EoG:n="Linear";break;case o.CdI:n="Reinhard";break;case o.YGz:n="OptimizedCineon";break;case o.LY2:n="ACESFilmic";break;case o.dZ3:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function u(e){return""!==e}function p(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function m(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const f=/^[ \t]*#include +<([\w\d./]+)>/gm;function g(e){return e.replace(f,y)}const v=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function y(e,t){let n=r.W[t];if(void 0===n){const e=v.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=r.W[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return g(n)}const b=/#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 _(e){return e.replace(b,x)}function x(e,t,n,i){let s="";for(let e=parseInt(t);e0&&(R+="\n"),L=[C,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(u).join("\n"),L.length>0&&(L+="\n")):(R=[w(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+M:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+x:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(u).join("\n"),L=[C,w(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+S:"",n.envMap?"#define "+M:"",n.envMap?"#define "+E:"",T?"#define CUBEUV_TEXEL_WIDTH "+T.texelWidth:"",T?"#define CUBEUV_TEXEL_HEIGHT "+T.texelHeight:"",T?"#define CUBEUV_MAX_MIP "+T.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+x:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==o.uL9?"#define TONE_MAPPING":"",n.toneMapping!==o.uL9?r.W.tonemapping_pars_fragment:"",n.toneMapping!==o.uL9?d("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",r.W.colorspace_pars_fragment,h("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(u).join("\n")),y=g(y),y=p(y,n),y=m(y,n),b=g(b),b=p(b,n),b=m(b,n),y=_(y),b=_(b),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(N="#version 300 es\n",R=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+R,L=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===o.LSk?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===o.LSk?"":"#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("\n")+"\n"+L);const D=N+R+y,I=N+L+b,O=(0,s.d)(f,f.VERTEX_SHADER,D),U=(0,s.d)(f,f.FRAGMENT_SHADER,I);function k(t){if(e.debug.checkShaderErrors){const n=f.getProgramInfoLog(P).trim(),i=f.getShaderInfoLog(O).trim(),s=f.getShaderInfoLog(U).trim();let r=!0,o=!0;if(!1===f.getProgramParameter(P,f.LINK_STATUS))if(r=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(f,P,O,U);else{const e=c(f,O,"vertex"),t=c(f,U,"fragment");console.error("THREE.WebGLProgram: Shader Error "+f.getError()+" - VALIDATE_STATUS "+f.getProgramParameter(P,f.VALIDATE_STATUS)+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+t)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(o=!1);o&&(t.diagnostics={runnable:r,programLog:n,vertexShader:{log:i,prefix:R},fragmentShader:{log:s,prefix:L}})}f.deleteShader(O),f.deleteShader(U),V=new i.y(f,P),z=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s{"use strict";n.d(t,{Z:()=>h});var i=n(75544),s=n(45787),r=n(48580),o=n(97386),a=n(17393),l=n(8173),c=n(19748);function h(e,t,n,h,d,u,p){const m=new s.S,f=new o.T,g=[],v=d.isWebGL2,y=d.logarithmicDepthBuffer,b=d.vertexTextures;let _=d.precision;const x={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 w(e){return 0===e?"uv":`uv${e}`}return{getParameters:function(s,r,o,l,u){const m=l.fog,g=u.geometry,S=s.isMeshStandardMaterial?l.environment:null,M=(s.isMeshStandardMaterial?n:t).get(s.envMap||S),E=M&&M.mapping===i.g8_?M.image.height:null,T=x[s.type];null!==s.precision&&(_=d.getMaxPrecision(s.precision),_!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",_,"instead."));const C=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,A=void 0!==C?C.length:0;let P,R,L,N,D=0;if(void 0!==g.morphAttributes.position&&(D=1),void 0!==g.morphAttributes.normal&&(D=2),void 0!==g.morphAttributes.color&&(D=3),T){const e=a.V[T];P=e.vertexShader,R=e.fragmentShader}else P=s.vertexShader,R=s.fragmentShader,f.update(s),L=f.getVertexShaderID(s),N=f.getFragmentShaderID(s);const I=e.getRenderTarget(),O=!0===u.isInstancedMesh,U=!!s.map,k=!!s.matcap,V=!!M,z=!!s.aoMap,F=!!s.lightMap,B=!!s.bumpMap,$=!!s.normalMap,j=!!s.displacementMap,H=!!s.emissiveMap,G=!!s.metalnessMap,Z=!!s.roughnessMap,W=s.anisotropy>0,q=s.clearcoat>0,X=s.iridescence>0,Y=s.sheen>0,K=s.transmission>0,J=W&&!!s.anisotropyMap,Q=q&&!!s.clearcoatMap,ee=q&&!!s.clearcoatNormalMap,te=q&&!!s.clearcoatRoughnessMap,ne=X&&!!s.iridescenceMap,ie=X&&!!s.iridescenceThicknessMap,se=Y&&!!s.sheenColorMap,re=Y&&!!s.sheenRoughnessMap,oe=!!s.specularMap,ae=!!s.specularColorMap,le=!!s.specularIntensityMap,ce=K&&!!s.transmissionMap,he=K&&!!s.thicknessMap,de=!!s.gradientMap,ue=!!s.alphaMap,pe=s.alphaTest>0,me=!!s.alphaHash,fe=!!s.extensions,ge=!!g.attributes.uv1,ve=!!g.attributes.uv2,ye=!!g.attributes.uv3;let be=i.uL9;return s.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(be=e.toneMapping)),{isWebGL2:v,shaderID:T,shaderType:s.type,shaderName:s.name,vertexShader:P,fragmentShader:R,defines:s.defines,customVertexShaderID:L,customFragmentShaderID:N,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:_,instancing:O,instancingColor:O&&null!==u.instanceColor,supportsVertexTextures:b,outputColorSpace:null===I?e.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:i.GUF,map:U,matcap:k,envMap:V,envMapMode:V&&M.mapping,envMapCubeUVHeight:E,aoMap:z,lightMap:F,bumpMap:B,normalMap:$,displacementMap:b&&j,emissiveMap:H,normalMapObjectSpace:$&&s.normalMapType===i.PA7,normalMapTangentSpace:$&&s.normalMapType===i.IOt,metalnessMap:G,roughnessMap:Z,anisotropy:W,anisotropyMap:J,clearcoat:q,clearcoatMap:Q,clearcoatNormalMap:ee,clearcoatRoughnessMap:te,iridescence:X,iridescenceMap:ne,iridescenceThicknessMap:ie,sheen:Y,sheenColorMap:se,sheenRoughnessMap:re,specularMap:oe,specularColorMap:ae,specularIntensityMap:le,transmission:K,transmissionMap:ce,thicknessMap:he,gradientMap:de,opaque:!1===s.transparent&&s.blending===i.bdR,alphaMap:ue,alphaTest:pe,alphaHash:me,combine:s.combine,mapUv:U&&w(s.map.channel),aoMapUv:z&&w(s.aoMap.channel),lightMapUv:F&&w(s.lightMap.channel),bumpMapUv:B&&w(s.bumpMap.channel),normalMapUv:$&&w(s.normalMap.channel),displacementMapUv:j&&w(s.displacementMap.channel),emissiveMapUv:H&&w(s.emissiveMap.channel),metalnessMapUv:G&&w(s.metalnessMap.channel),roughnessMapUv:Z&&w(s.roughnessMap.channel),anisotropyMapUv:J&&w(s.anisotropyMap.channel),clearcoatMapUv:Q&&w(s.clearcoatMap.channel),clearcoatNormalMapUv:ee&&w(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&w(s.clearcoatRoughnessMap.channel),iridescenceMapUv:ne&&w(s.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&w(s.iridescenceThicknessMap.channel),sheenColorMapUv:se&&w(s.sheenColorMap.channel),sheenRoughnessMapUv:re&&w(s.sheenRoughnessMap.channel),specularMapUv:oe&&w(s.specularMap.channel),specularColorMapUv:ae&&w(s.specularColorMap.channel),specularIntensityMapUv:le&&w(s.specularIntensityMap.channel),transmissionMapUv:ce&&w(s.transmissionMap.channel),thicknessMapUv:he&&w(s.thicknessMap.channel),alphaMapUv:ue&&w(s.alphaMap.channel),vertexTangents:!!g.attributes.tangent&&($||W),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!g.attributes.color&&4===g.attributes.color.itemSize,vertexUv1s:ge,vertexUv2s:ve,vertexUv3s:ye,pointsUvs:!0===u.isPoints&&!!g.attributes.uv&&(U||ue),fog:!!m,useFog:!0===s.fog,fogExp2:m&&m.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:y,skinning:!0===u.isSkinnedMesh,morphTargets:void 0!==g.morphAttributes.position,morphNormals:void 0!==g.morphAttributes.normal,morphColors:void 0!==g.morphAttributes.color,morphTargetsCount:A,morphTextureStride:D,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numSpotLightMaps:r.spotLightMap.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numDirLightShadows:r.directionalShadowMap.length,numPointLightShadows:r.pointShadowMap.length,numSpotLightShadows:r.spotShadowMap.length,numSpotLightShadowsWithMaps:r.numSpotLightShadowsWithMaps,numLightProbes:r.numLightProbes,numClippingPlanes:p.numPlanes,numClipIntersection:p.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&o.length>0,shadowMapType:e.shadowMap.type,toneMapping:be,useLegacyLights:e._useLegacyLights,decodeVideoTexture:U&&!0===s.map.isVideoTexture&&c.ep.getTransfer(s.map.colorSpace)===i.j17,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===i.ehD,flipSided:s.side===i._Li,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:fe&&!0===s.extensions.derivatives,extensionFragDepth:fe&&!0===s.extensions.fragDepth,extensionDrawBuffers:fe&&!0===s.extensions.drawBuffers,extensionShaderTextureLOD:fe&&!0===s.extensions.shaderTextureLOD,rendererExtensionFragDepth:v||h.has("EXT_frag_depth"),rendererExtensionDrawBuffers:v||h.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:v||h.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:h.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){m.disableAll(),t.isWebGL2&&m.enable(0);t.supportsVertexTextures&&m.enable(1);t.instancing&&m.enable(2);t.instancingColor&&m.enable(3);t.matcap&&m.enable(4);t.envMap&&m.enable(5);t.normalMapObjectSpace&&m.enable(6);t.normalMapTangentSpace&&m.enable(7);t.clearcoat&&m.enable(8);t.iridescence&&m.enable(9);t.alphaTest&&m.enable(10);t.vertexColors&&m.enable(11);t.vertexAlphas&&m.enable(12);t.vertexUv1s&&m.enable(13);t.vertexUv2s&&m.enable(14);t.vertexUv3s&&m.enable(15);t.vertexTangents&&m.enable(16);t.anisotropy&&m.enable(17);t.alphaHash&&m.enable(18);e.push(m.mask),m.disableAll(),t.fog&&m.enable(0);t.useFog&&m.enable(1);t.flatShading&&m.enable(2);t.logarithmicDepthBuffer&&m.enable(3);t.skinning&&m.enable(4);t.morphTargets&&m.enable(5);t.morphNormals&&m.enable(6);t.morphColors&&m.enable(7);t.premultipliedAlpha&&m.enable(8);t.shadowMapEnabled&&m.enable(9);t.useLegacyLights&&m.enable(10);t.doubleSided&&m.enable(11);t.flipSided&&m.enable(12);t.useDepthPacking&&m.enable(13);t.dithering&&m.enable(14);t.transmission&&m.enable(15);t.sheen&&m.enable(16);t.opaque&&m.enable(17);t.pointsUvs&&m.enable(18);t.decodeVideoTexture&&m.enable(19);e.push(m.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=x[e.type];let n;if(t){const e=a.V[t];n=l.rD.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=g.length;e{"use strict";function i(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}n.d(t,{Z:()=>i})},84153:(e,t,n)=>{"use strict";function i(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function s(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function r(){const e=[];let t=0;const n=[],r=[],o=[];function a(n,i,s,r,o,a){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:s,groupOrder:r,renderOrder:n.renderOrder,z:o,group:a},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=s,l.groupOrder=r,l.renderOrder=n.renderOrder,l.z=o,l.group=a),t++,l}return{opaque:n,transmissive:r,transparent:o,init:function(){t=0,n.length=0,r.length=0,o.length=0},push:function(e,t,i,s,l,c){const h=a(e,t,i,s,l,c);i.transmission>0?r.push(h):!0===i.transparent?o.push(h):n.push(h)},unshift:function(e,t,i,s,l,c){const h=a(e,t,i,s,l,c);i.transmission>0?r.unshift(h):!0===i.transparent?o.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||i),r.length>1&&r.sort(t||s),o.length>1&&o.sort(t||s)}}}function o(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let s;return void 0===i?(s=new r,e.set(t,[s])):n>=i.length?(s=new r,i.push(s)):s=i[n],s},dispose:function(){e=new WeakMap}}}n.d(t,{M:()=>o})},73981:(e,t,n)=>{"use strict";n.d(t,{Q:()=>r});var i=n(19836);function s(e,t){const n=new i.h(e,t),s=[],r=[];return{init:function(){s.length=0,r.length=0},state:{lightsArray:s,shadowsArray:r,lights:n},setupLights:function(e){n.setup(s,e)},setupLightsView:function(e){n.setupView(s,e)},pushLight:function(e){s.push(e)},pushShadow:function(e){r.push(e)}}}function r(e,t){let n=new WeakMap;return{get:function(i,r=0){const o=n.get(i);let a;return void 0===o?(a=new s(e,t),n.set(i,[a])):r>=o.length?(a=new s(e,t),o.push(a)):a=o[r],a},dispose:function(){n=new WeakMap}}}},31685:(e,t,n)=>{"use strict";function i(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}n.d(t,{d:()=>i})},97386:(e,t,n)=>{"use strict";n.d(t,{T:()=>s});let i=0;class s{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),r=this._getShaderCacheForMaterial(e);return!1===r.has(i)&&(r.add(i),i.usedTimes++),!1===r.has(s)&&(r.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new r(e),t.set(e,n)),n}}class r{constructor(e){this.id=i++,this.code=e,this.usedTimes=0}}},74859:(e,t,n)=>{"use strict";n.d(t,{c:()=>f});var i=n(75544),s=n(46953),r=n(90652),o=n(35536),a=n(44428),l=n(35322),c=n(75809),h=n(8035),d=n(84538),u=n(40693),p=n(53763),m=n(89260);function f(e,t,n){let f=new p.i;const g=new u.F,v=new u.F,y=new d.L,b=new r.l({depthPacking:i.mSO}),_=new o.L,x={},w=n.maxTextureSize,S={[i.Wl3]:i._Li,[i._Li]:i.Wl3,[i.ehD]:i.ehD},M=new a.j({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new u.F},radius:{value:4}},vertexShader:m.u,fragmentShader:m.D}),E=M.clone();E.defines.HORIZONTAL_PASS=1;const T=new c.u;T.setAttribute("position",new l.Tl(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const C=new h.K(T,M),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i._iA;let P=this.type;function R(n,i){const r=t.update(C);M.defines.VSM_SAMPLES!==n.blurSamples&&(M.defines.VSM_SAMPLES=n.blurSamples,E.defines.VSM_SAMPLES=n.blurSamples,M.needsUpdate=!0,E.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new s.d(g.x,g.y)),M.uniforms.shadow_pass.value=n.map.texture,M.uniforms.resolution.value=n.mapSize,M.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,M,C,null),E.uniforms.shadow_pass.value=n.mapPass.texture,E.uniforms.resolution.value=n.mapSize,E.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,E,C,null)}function L(t,n,s,r){let o=null;const a=!0===s.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==a)o=a;else if(o=!0===s.isPointLight?_:b,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=o.uuid,t=n.uuid;let i=x[e];void 0===i&&(i={},x[e]=i);let s=i[t];void 0===s&&(s=o.clone(),i[t]=s),o=s}if(o.visible=n.visible,o.wireframe=n.wireframe,r===i.dwk?o.side=null!==n.shadowSide?n.shadowSide:n.side:o.side=null!==n.shadowSide?n.shadowSide:S[n.side],o.alphaMap=n.alphaMap,o.alphaTest=n.alphaTest,o.map=n.map,o.clipShadows=n.clipShadows,o.clippingPlanes=n.clippingPlanes,o.clipIntersection=n.clipIntersection,o.displacementMap=n.displacementMap,o.displacementScale=n.displacementScale,o.displacementBias=n.displacementBias,o.wireframeLinewidth=n.wireframeLinewidth,o.linewidth=n.linewidth,!0===s.isPointLight&&!0===o.isMeshDistanceMaterial){e.properties.get(o).light=s}return o}function N(n,s,r,o,a){if(!1===n.visible)return;if(n.layers.test(s.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===i.dwk)&&(!n.frustumCulled||f.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld);const i=t.update(n),s=n.material;if(Array.isArray(s)){const t=i.groups;for(let l=0,c=t.length;lw||g.y>w)&&(g.x>w&&(v.x=Math.floor(w/u.x),g.x=v.x*u.x,l.mapSize.x=v.x),g.y>w&&(v.y=Math.floor(w/u.y),g.y=v.y*u.y,l.mapSize.y=v.y)),null===l.map||!0===h||!0===d){const e=this.type!==i.dwk?{minFilter:i.TyD,magFilter:i.TyD}:{};null!==l.map&&l.map.dispose(),l.map=new s.d(g.x,g.y,e),l.map.texture.name=a.name+".shadowMap",l.camera.updateProjectionMatrix()}e.setRenderTarget(l.map),e.clear();const p=l.getViewportCount();for(let e=0;e{"use strict";n.d(t,{m:()=>o});var i=n(75544),s=n(93113),r=n(84538);function o(e,t,n){const o=n.isWebGL2;const a=new function(){let t=!1;const n=new r.L;let i=null;const s=new r.L(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,r,o,a){!0===a&&(t*=o,i*=o,r*=o),n.set(t,i,r,o),!1===s.equals(n)&&(e.clearColor(t,i,r,o),s.copy(n))},reset:function(){t=!1,i=null,s.set(-1,0,0,0)}}},l=new function(){let t=!1,n=null,s=null,r=null;return{setTest:function(t){t?G(e.DEPTH_TEST):Z(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(s!==t){switch(t){case i.BVF:e.depthFunc(e.NEVER);break;case i.Se2:e.depthFunc(e.ALWAYS);break;case i.Zr5:e.depthFunc(e.LESS);break;case i.vCF:e.depthFunc(e.LEQUAL);break;case i.eD:e.depthFunc(e.EQUAL);break;case i.ksN:e.depthFunc(e.GEQUAL);break;case i.w$m:e.depthFunc(e.GREATER);break;case i.M6v:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}s=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,s=null,r=null}}},c=new function(){let t=!1,n=null,i=null,s=null,r=null,o=null,a=null,l=null,c=null;return{setTest:function(n){t||(n?G(e.STENCIL_TEST):Z(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&s===n&&r===o||(e.stencilFunc(t,n,o),i=t,s=n,r=o)},setOp:function(t,n,i){o===t&&a===n&&l===i||(e.stencilOp(t,n,i),o=t,a=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,s=null,r=null,o=null,a=null,l=null,c=null}}},h=new WeakMap,d=new WeakMap;let u={},p={},m=new WeakMap,f=[],g=null,v=!1,y=null,b=null,_=null,x=null,w=null,S=null,M=null,E=new s.I(0,0,0),T=0,C=!1,A=null,P=null,R=null,L=null,N=null;const D=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let I=!1,O=0;const U=e.getParameter(e.VERSION);-1!==U.indexOf("WebGL")?(O=parseFloat(/^WebGL (\d)/.exec(U)[1]),I=O>=1):-1!==U.indexOf("OpenGL ES")&&(O=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),I=O>=2);let k=null,V={};const z=e.getParameter(e.SCISSOR_BOX),F=e.getParameter(e.VIEWPORT),B=(new r.L).fromArray(z),$=(new r.L).fromArray(F);function j(t,n,i,s){const r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let a=0;a{"use strict";n.d(t,{w:()=>l});var i=n(75544),s=n(71050),r=n(80109),o=n(19564),a=n(19748);function l(e,t,n,l,c,h,d){const u=c.isWebGL2,p=c.maxTextures,m=c.maxCubemapSize,f=c.maxTextureSize,g=c.maxSamples,v=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,y="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),b=new WeakMap;let _;const x=new WeakMap;let w=!1;try{w="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function S(e,t){return w?new OffscreenCanvas(e,t):(0,o.c)("canvas")}function M(e,t,n,i){let r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?s.gy:Math.floor,o=i(r*e.width),a=i(r*e.height);void 0===_&&(_=S(o,a));const l=n?S(o,a):_;l.width=o,l.height=a;return l.getContext("2d").drawImage(e,0,0,o,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+a+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function E(e){return s.wt(e.width)&&s.wt(e.height)}function T(e,t){return e.generateMipmaps&&t&&e.minFilter!==i.TyD&&e.minFilter!==i.wem}function C(t){e.generateMipmap(t)}function A(n,s,r,o,l=!1){if(!1===u)return s;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let c=s;if(s===e.RED&&(r===e.FLOAT&&(c=e.R32F),r===e.HALF_FLOAT&&(c=e.R16F),r===e.UNSIGNED_BYTE&&(c=e.R8)),s===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.R8UI),r===e.UNSIGNED_SHORT&&(c=e.R16UI),r===e.UNSIGNED_INT&&(c=e.R32UI),r===e.BYTE&&(c=e.R8I),r===e.SHORT&&(c=e.R16I),r===e.INT&&(c=e.R32I)),s===e.RG&&(r===e.FLOAT&&(c=e.RG32F),r===e.HALF_FLOAT&&(c=e.RG16F),r===e.UNSIGNED_BYTE&&(c=e.RG8)),s===e.RGBA){const t=l?i.l6D:a.ep.getTransfer(o);r===e.FLOAT&&(c=e.RGBA32F),r===e.HALF_FLOAT&&(c=e.RGBA16F),r===e.UNSIGNED_BYTE&&(c=t===i.j17?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(c=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(c=e.RGB5_A1)}return c!==e.R16F&&c!==e.R32F&&c!==e.RG16F&&c!==e.RG32F&&c!==e.RGBA16F&&c!==e.RGBA32F||t.get("EXT_color_buffer_float"),c}function P(e,t,n){return!0===T(e,n)||e.isFramebufferTexture&&e.minFilter!==i.TyD&&e.minFilter!==i.wem?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function R(t){return t===i.TyD||t===i.YLQ||t===i.aH4?e.NEAREST:e.LINEAR}function L(e){const t=e.target;t.removeEventListener("dispose",L),function(e){const t=l.get(e);if(void 0===t.__webglInit)return;const n=e.source,i=x.get(n);if(i){const s=i[t.__cacheKey];s.usedTimes--,0===s.usedTimes&&D(e),0===Object.keys(i).length&&x.delete(n)}l.remove(e)}(t),t.isVideoTexture&&b.delete(t)}function N(t){const n=t.target;n.removeEventListener("dispose",N),function(t){const n=t.texture,i=l.get(t),s=l.get(n);void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),d.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let n=0;n0&&s.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void B(s,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+i)}const U={[i.rpg]:e.REPEAT,[i.uWy]:e.CLAMP_TO_EDGE,[i.OoA]:e.MIRRORED_REPEAT},k={[i.TyD]:e.NEAREST,[i.YLQ]:e.NEAREST_MIPMAP_NEAREST,[i.aH4]:e.NEAREST_MIPMAP_LINEAR,[i.wem]:e.LINEAR,[i.qyh]:e.LINEAR_MIPMAP_NEAREST,[i.D1R]:e.LINEAR_MIPMAP_LINEAR},V={[i.xoQ]:e.NEVER,[i.T6w]:e.ALWAYS,[i.D67]:e.LESS,[i.M$G]:e.LEQUAL,[i.F1y]:e.EQUAL,[i.Jjb]:e.GEQUAL,[i.Zen]:e.GREATER,[i.O78]:e.NOTEQUAL};function z(n,s,r){if(r?(e.texParameteri(n,e.TEXTURE_WRAP_S,U[s.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,U[s.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,U[s.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,k[s.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,k[s.minFilter])):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),s.wrapS===i.uWy&&s.wrapT===i.uWy||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,e.TEXTURE_MAG_FILTER,R(s.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,R(s.minFilter)),s.minFilter!==i.TyD&&s.minFilter!==i.wem&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),s.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,V[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){const r=t.get("EXT_texture_filter_anisotropic");if(s.magFilter===i.TyD)return;if(s.minFilter!==i.aH4&&s.minFilter!==i.D1R)return;if(s.type===i.VzW&&!1===t.has("OES_texture_float_linear"))return;if(!1===u&&s.type===i.cLu&&!1===t.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||l.get(s).__currentAnisotropy)&&(e.texParameterf(n,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,c.getMaxAnisotropy())),l.get(s).__currentAnisotropy=s.anisotropy)}}function F(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",L));const s=n.source;let r=x.get(s);void 0===r&&(r={},x.set(s,r));const o=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===r[o]&&(r[o]={texture:e.createTexture(),usedTimes:0},d.memory.textures++,i=!0),r[o].usedTimes++;const s=r[t.__cacheKey];void 0!==s&&(r[t.__cacheKey].usedTimes--,0===s.usedTimes&&D(n)),t.__cacheKey=o,t.__webglTexture=r[o].texture}return i}function B(t,s,r){let o=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(o=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(o=e.TEXTURE_3D);const c=F(t,s),d=s.source;n.bindTexture(o,t.__webglTexture,e.TEXTURE0+r);const p=l.get(d);if(d.version!==p.__version||!0===c){n.activeTexture(e.TEXTURE0+r);const t=a.ep.getPrimaries(a.ep.workingColorSpace),l=s.colorSpace===i.aCh?null:a.ep.getPrimaries(s.colorSpace),m=s.colorSpace===i.aCh||t===l?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,m);const g=function(e){return!u&&(e.wrapS!==i.uWy||e.wrapT!==i.uWy||e.minFilter!==i.TyD&&e.minFilter!==i.wem)}(s)&&!1===E(s.image);let v=M(s.image,g,!1,f);v=W(s,v);const y=E(v)||u,b=h.convert(s.format,s.colorSpace);let _,x=h.convert(s.type),w=A(s.internalFormat,b,x,s.colorSpace,s.isVideoTexture);z(o,s,y);const S=s.mipmaps,R=u&&!0!==s.isVideoTexture,L=void 0===p.__version||!0===c,N=P(s,v,y);if(s.isDepthTexture)w=e.DEPTH_COMPONENT,u?w=s.type===i.VzW?e.DEPTH_COMPONENT32F:s.type===i.JQ4?e.DEPTH_COMPONENT24:s.type===i.wJv?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:s.type===i.VzW&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),s.format===i.qkB&&w===e.DEPTH_COMPONENT&&s.type!==i.LsT&&s.type!==i.JQ4&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),s.type=i.JQ4,x=h.convert(s.type)),s.format===i.brP&&w===e.DEPTH_COMPONENT&&(w=e.DEPTH_STENCIL,s.type!==i.wJv&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),s.type=i.wJv,x=h.convert(s.type))),L&&(R?n.texStorage2D(e.TEXTURE_2D,1,w,v.width,v.height):n.texImage2D(e.TEXTURE_2D,0,w,v.width,v.height,0,b,x,null));else if(s.isDataTexture)if(S.length>0&&y){R&&L&&n.texStorage2D(e.TEXTURE_2D,N,w,S[0].width,S[0].height);for(let t=0,i=S.length;t>=1,i>>=1}}else if(S.length>0&&y){R&&L&&n.texStorage2D(e.TEXTURE_2D,N,w,S[0].width,S[0].height);for(let t=0,i=S.length;t>a),s=Math.max(1,i.height>>a);o===e.TEXTURE_3D||o===e.TEXTURE_2D_ARRAY?n.texImage3D(o,a,u,t,s,i.depth,0,c,d,null):n.texImage2D(o,a,u,t,s,0,c,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),Z(i)?v.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,r,o,l.get(s).__webglTexture,0,G(i)):(o===e.TEXTURE_2D||o>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&o<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,r,o,l.get(s).__webglTexture,a),n.bindFramebuffer(e.FRAMEBUFFER,null)}function j(t,n,s){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer){let r=!0===u?e.DEPTH_COMPONENT24:e.DEPTH_COMPONENT16;if(s||Z(n)){const t=n.depthTexture;t&&t.isDepthTexture&&(t.type===i.VzW?r=e.DEPTH_COMPONENT32F:t.type===i.JQ4&&(r=e.DEPTH_COMPONENT24));const s=G(n);Z(n)?v.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,s,r,n.width,n.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,s,r,n.width,n.height)}else e.renderbufferStorage(e.RENDERBUFFER,r,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(n.depthBuffer&&n.stencilBuffer){const i=G(n);s&&!1===Z(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,i,e.DEPTH24_STENCIL8,n.width,n.height):Z(n)?v.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,i,e.DEPTH24_STENCIL8,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else{const t=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let i=0;i0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function W(e,n){const s=e.colorSpace,o=e.format,l=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===i.L_r||s!==i.GUF&&s!==i.aCh&&(a.ep.getTransfer(s)===i.j17?!1===u?!0===t.has("EXT_sRGB")&&o===i.wk1?(e.format=i.L_r,e.minFilter=i.wem,e.generateMipmaps=!1):n=r.P.sRGBToLinear(n):o===i.wk1&&l===i.ywz||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",s)),n}this.allocateTextureUnit=function(){const e=I;return e>=p&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+p),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=O,this.setTexture2DArray=function(t,i){const s=l.get(t);t.version>0&&s.__version!==t.version?B(s,t,i):n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+i)},this.setTexture3D=function(t,i){const s=l.get(t);t.version>0&&s.__version!==t.version?B(s,t,i):n.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,s){const r=l.get(t);t.version>0&&r.__version!==t.version?function(t,s,r){if(6!==s.image.length)return;const o=F(t,s),c=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+r);const d=l.get(c);if(c.version!==d.__version||!0===o){n.activeTexture(e.TEXTURE0+r);const t=a.ep.getPrimaries(a.ep.workingColorSpace),l=s.colorSpace===i.aCh?null:a.ep.getPrimaries(s.colorSpace),p=s.colorSpace===i.aCh||t===l?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);const f=s.isCompressedTexture||s.image[0].isCompressedTexture,g=s.image[0]&&s.image[0].isDataTexture,v=[];for(let e=0;e<6;e++)v[e]=f||g?g?s.image[e].image:s.image[e]:M(s.image[e],!1,!0,m),v[e]=W(s,v[e]);const y=v[0],b=E(y)||u,_=h.convert(s.format,s.colorSpace),x=h.convert(s.type),w=A(s.internalFormat,_,x,s.colorSpace),S=u&&!0!==s.isVideoTexture,R=void 0===d.__version||!0===o;let L,N=P(s,y,b);if(z(e.TEXTURE_CUBE_MAP,s,b),f){S&&R&&n.texStorage2D(e.TEXTURE_CUBE_MAP,N,w,y.width,y.height);for(let t=0;t<6;t++){L=v[t].mipmaps;for(let r=0;r0&&N++,n.texStorage2D(e.TEXTURE_CUBE_MAP,N,w,v[0].width,v[0].height));for(let t=0;t<6;t++)if(g){S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,v[t].width,v[t].height,_,x,v[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,w,v[t].width,v[t].height,0,_,x,v[t].data);for(let i=0;i0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&!1===Z(t)){const r=a?i:[i];s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0&&!1===Z(t)){const i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],s=t.width,r=t.height;let o=e.COLOR_BUFFER_BIT;const a=[],c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=l.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(let t=0;t{"use strict";n.d(t,{y:()=>he});var i=n(48651),s=n(21364),r=n(57938),o=n(85375);const a=new s.x,l=new r.p,c=new o.J,h=new i.B,d=[],u=[],p=new Float32Array(16),m=new Float32Array(9),f=new Float32Array(4);function g(e,t,n){const i=e[0];if(i<=0||i>0)return e;const s=t*n;let r=d[s];if(void 0===r&&(r=new Float32Array(s),d[s]=r),0!==t){i.toArray(r,0);for(let i=1,s=0;i!==t;++i)s+=n,e[i].toArray(r,s)}return r}function v(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n{"use strict";function i(e,t,n,i){let s={},r={},o=[];const a=n.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(e,t,n){const i=e.value;if(void 0===n[t]){if("number"==typeof i)n[t]=i;else{const e=Array.isArray(i)?i:[i],s=[];for(let t=0;t0){s=n%i;const e=i-s;0!==s&&e-o.boundary<0&&(n+=i-s,r.__offset=n)}n+=o.storage}s=n%i,s>0&&(n+=i-s);e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;ei})},9840:(e,t,n)=>{"use strict";n.d(t,{f:()=>r});var i=n(75544),s=n(19748);function r(e,t,n){const r=n.isWebGL2;return{convert:function(n,o=i.aCh){let a;const l=s.ep.getTransfer(o);if(n===i.ywz)return e.UNSIGNED_BYTE;if(n===i.k0A)return e.UNSIGNED_SHORT_4_4_4_4;if(n===i.irR)return e.UNSIGNED_SHORT_5_5_5_1;if(n===i.T95)return e.BYTE;if(n===i.iAb)return e.SHORT;if(n===i.LsT)return e.UNSIGNED_SHORT;if(n===i.Kz5)return e.INT;if(n===i.JQ4)return e.UNSIGNED_INT;if(n===i.VzW)return e.FLOAT;if(n===i.cLu)return r?e.HALF_FLOAT:(a=t.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(n===i.OTo)return e.ALPHA;if(n===i.wk1)return e.RGBA;if(n===i.Y8D)return e.LUMINANCE;if(n===i.cRx)return e.LUMINANCE_ALPHA;if(n===i.qkB)return e.DEPTH_COMPONENT;if(n===i.brP)return e.DEPTH_STENCIL;if(n===i.L_r)return a=t.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(n===i.hEm)return e.RED;if(n===i.D9w)return e.RED_INTEGER;if(n===i.av9)return e.RG;if(n===i.CtA)return e.RG_INTEGER;if(n===i.E2K)return e.RGBA_INTEGER;if(n===i.wuA||n===i.BFQ||n===i.v3W||n===i.ILR)if(l===i.j17){if(a=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(n===i.wuA)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===i.BFQ)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===i.v3W)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===i.ILR)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=t.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(n===i.wuA)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===i.BFQ)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===i.v3W)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===i.ILR)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===i._AM||n===i.vCx||n===i.eaV||n===i.CaW){if(a=t.get("WEBGL_compressed_texture_pvrtc"),null===a)return null;if(n===i._AM)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===i.vCx)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===i.eaV)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===i.CaW)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===i.fto)return a=t.get("WEBGL_compressed_texture_etc1"),null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===i.l0P||n===i.ekQ){if(a=t.get("WEBGL_compressed_texture_etc"),null===a)return null;if(n===i.l0P)return l===i.j17?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(n===i.ekQ)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(n===i.ptH||n===i.jZA||n===i.y2t||n===i.gi4||n===i.Djp||n===i.BG$||n===i.NYV||n===i.xJs||n===i.pKu||n===i.GG6||n===i.Gih||n===i.FUD||n===i.iiP||n===i.SvJ){if(a=t.get("WEBGL_compressed_texture_astc"),null===a)return null;if(n===i.ptH)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===i.jZA)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===i.y2t)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===i.gi4)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===i.Djp)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===i.BG$)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===i.NYV)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===i.xJs)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===i.pKu)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===i.GG6)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===i.Gih)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===i.FUD)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===i.iiP)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===i.SvJ)return l===i.j17?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===i.bsb||n===i.f2y||n===i.QO2){if(a=t.get("EXT_texture_compression_bptc"),null===a)return null;if(n===i.bsb)return l===i.j17?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===i.f2y)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===i.QO2)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===i.HdW||n===i.vuL||n===i.ZTh||n===i.lGU){if(a=t.get("EXT_texture_compression_rgtc"),null===a)return null;if(n===i.bsb)return a.COMPRESSED_RED_RGTC1_EXT;if(n===i.vuL)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===i.ZTh)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===i.lGU)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===i.wJv?r?e.UNSIGNED_INT_24_8:(a=t.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==e[n]?e[n]:null}}}},83084:(e,t,n)=>{"use strict";n.d(t,{N:()=>o});var i=n(19588),s=n(29187);const r={type:"move"};class o{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new s.Z,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new s.Z,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new i.P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new i.P),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new s.Z,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new i.P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new i.P),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(c&&e.hand){o=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),s=this._getHandJoint(c,i);null!==e&&(s.matrix.fromArray(e.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,s.jointRadius=e.radius),s.visible=null!==e}const i=c.joints["index-finger-tip"],s=c.joints["thumb-tip"],r=i.position.distanceTo(s.position),a=.02,l=.005;c.inputState.pinching&&r>a+l?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&r<=a-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==l&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),null!==s&&(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));null!==a&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==s&&(i=s),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(r)))}return null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==s),null!==c&&(c.visible=null!==o),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new s.Z;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}},53288:(e,t,n)=>{"use strict";n.d(t,{M:()=>m});var i=n(60531),s=n(19251),r=n(67440),o=n(19588),a=n(84538),l=n(71050),c=n(54871),h=n(46953),d=n(83084),u=n(38057),p=n(75544);class m extends s.p{constructor(e,t){super();const n=this;let s=null,m=1,f=null,g="local-floor",v=1,y=null,b=null,_=null,x=null,w=null,S=null;const M=t.getContextAttributes();let E=null,T=null;const C=[],A=[],P=new r.c;P.layers.enable(1),P.viewport=new a.L;const R=new r.c;R.layers.enable(2),R.viewport=new a.L;const L=[P,R],N=new i.H;N.layers.enable(1),N.layers.enable(2);let D=null,I=null;function O(e){const t=A.indexOf(e.inputSource);if(-1===t)return;const n=C[t];void 0!==n&&(n.update(e.inputSource,e.frame,y||f),n.dispatchEvent({type:e.type,data:e.inputSource}))}function U(){s.removeEventListener("select",O),s.removeEventListener("selectstart",O),s.removeEventListener("selectend",O),s.removeEventListener("squeeze",O),s.removeEventListener("squeezestart",O),s.removeEventListener("squeezeend",O),s.removeEventListener("end",U),s.removeEventListener("inputsourceschange",k);for(let e=0;e=0&&(A[i]=null,C[i].disconnect(n))}for(let t=0;t=A.length){A.push(n),i=e;break}if(null===A[e]){A[e]=n,i=e;break}}if(-1===i)break}const s=C[i];s&&s.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=C[e];return void 0===t&&(t=new d.N,C[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=C[e];return void 0===t&&(t=new d.N,C[e]=t),t.getGripSpace()},this.getHand=function(e){let t=C[e];return void 0===t&&(t=new d.N,C[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){m=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){g=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return y||f},this.setReferenceSpace=function(e){y=e},this.getBaseLayer=function(){return null!==x?x:w},this.getBinding=function(){return _},this.getFrame=function(){return S},this.getSession=function(){return s},this.setSession=async function(i){if(s=i,null!==s){if(E=e.getRenderTarget(),s.addEventListener("select",O),s.addEventListener("selectstart",O),s.addEventListener("selectend",O),s.addEventListener("squeeze",O),s.addEventListener("squeezestart",O),s.addEventListener("squeezeend",O),s.addEventListener("end",U),s.addEventListener("inputsourceschange",k),!0!==M.xrCompatible&&await t.makeXRCompatible(),void 0===s.renderState.layers||!1===e.capabilities.isWebGL2){const n={antialias:void 0!==s.renderState.layers||M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:m};w=new XRWebGLLayer(s,t,n),s.updateRenderState({baseLayer:w}),T=new h.d(w.framebufferWidth,w.framebufferHeight,{format:p.wk1,type:p.ywz,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil})}else{let n=null,i=null,r=null;M.depth&&(r=M.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=M.stencil?p.brP:p.qkB,i=M.stencil?p.wJv:p.JQ4);const o={colorFormat:t.RGBA8,depthFormat:r,scaleFactor:m};_=new XRWebGLBinding(s,t),x=_.createProjectionLayer(o),s.updateRenderState({layers:[x]}),T=new h.d(x.textureWidth,x.textureHeight,{format:p.wk1,type:p.ywz,depthTexture:new u.$(x.textureWidth,x.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0});e.properties.get(T).__ignoreDepthValues=x.ignoreDepthValues}T.isXRRenderTarget=!0,this.setFoveation(v),y=null,f=await s.requestReferenceSpace(g),$.setContext(s),$.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode};const V=new o.P,z=new o.P;function F(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===s)return;N.near=R.near=P.near=e.near,N.far=R.far=P.far=e.far,D===N.near&&I===N.far||(s.updateRenderState({depthNear:N.near,depthFar:N.far}),D=N.near,I=N.far);const t=e.parent,n=N.cameras;F(N,t);for(let e=0;e{"use strict";n.d(t,{x:()=>s});var i=n(25499);class s extends i.T{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}},48651:(e,t,n)=>{"use strict";n.d(t,{B:()=>r});var i=n(21364),s=n(75544);class r extends i.x{constructor(e,t,n,i,r,o,a,l,c,h){super(e=void 0!==e?e:[],t=void 0!==t?t:s.fY$,n,i,r,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}},85375:(e,t,n)=>{"use strict";n.d(t,{J:()=>r});var i=n(21364),s=n(75544);class r extends i.x{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=s.TyD,this.minFilter=s.TyD,this.wrapR=s.uWy,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}},57938:(e,t,n)=>{"use strict";n.d(t,{p:()=>r});var i=n(21364),s=n(75544);class r extends i.x{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=s.TyD,this.minFilter=s.TyD,this.wrapR=s.uWy,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}},38057:(e,t,n)=>{"use strict";n.d(t,{$:()=>r});var i=n(21364),s=n(75544);class r extends i.x{constructor(e,t,n,i,r,o,a,l,c,h){if((h=void 0!==h?h:s.qkB)!==s.qkB&&h!==s.brP)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&h===s.qkB&&(n=s.JQ4),void 0===n&&h===s.brP&&(n=s.wJv),super(null,i,r,o,a,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==a?a:s.TyD,this.minFilter=void 0!==l?l:s.TyD,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}},37136:(e,t,n)=>{"use strict";n.d(t,{H:()=>o});var i=n(80109),s=n(71050);let r=0;class o{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:r++}),this.uuid=s.DO(),this.data=e,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t{"use strict";n.d(t,{x:()=>d});var i=n(19251),s=n(75544),r=n(71050),o=n(40693),a=n(23130),l=n(37136),c=n(19564);let h=0;class d extends i.p{constructor(e=d.DEFAULT_IMAGE,t=d.DEFAULT_MAPPING,n=s.uWy,i=s.uWy,u=s.wem,p=s.D1R,m=s.wk1,f=s.ywz,g=d.DEFAULT_ANISOTROPY,v=s.aCh){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:h++}),this.uuid=r.DO(),this.name="",this.source=new l.H(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=u,this.minFilter=p,this.anisotropy=g,this.format=m,this.internalFormat=null,this.type=f,this.offset=new o.F(0,0),this.repeat=new o.F(1,1),this.center=new o.F(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new a.V,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,"string"==typeof v?this.colorSpace=v:((0,c.O4)("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=v===s.knz?s.KI_:s.aCh),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==s.xfE)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case s.rpg:e.x=e.x-Math.floor(e.x);break;case s.uWy:e.x=e.x<0?0:1;break;case s.OoA:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case s.rpg:e.y=e.y-Math.floor(e.y);break;case s.uWy:e.y=e.y<0?0:1;break;case s.OoA:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return(0,c.O4)("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===s.KI_?s.knz:s.rnI}set encoding(e){(0,c.O4)("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===s.knz?s.KI_:s.aCh}}d.DEFAULT_IMAGE=null,d.DEFAULT_MAPPING=s.xfE,d.DEFAULT_ANISOTROPY=1},19564:(e,t,n)=>{"use strict";function i(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}n.d(t,{H7:()=>i,O4:()=>a,O5:()=>r,c:()=>s});Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function s(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function r(){const e=s("canvas");return e.style.display="block",e}const o={};function a(e){e in o||(o[e]=!0,console.warn(e))}},338:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},90360:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},47227:e=>{"use strict";e.exports=JSON.parse('{"asset":{"type":"application/si-dpo-3d.document+json","version":"1.0","copyright":"(c) Smithsonian Institution, all rights reserved","generator":"Voyager"},"scene":0,"scenes":[{"nodes":[0,1],"setup":0}],"nodes":[{"translation":[0,0,15],"camera":0},{"name":"Lights","children":[2,3,4,5]},{"translation":[0,0,2],"rotation":[0.4829741,-0.1070728,0.1880998,0.8484633],"scale":[1,1,1],"name":"Key","light":0},{"rotation":[0.3546969,0.163893,-0.3861077,0.8356136],"scale":[1,1,1],"name":"Fill #1","light":1},{"translation":[0,0,1],"rotation":[0.9374013,-0.3018693,0.0532277,0.1652891],"name":"Fill #2","light":2},{"translation":[1,0,-1],"rotation":[0.373256,0.6426073,-0.5786063,0.3360813],"scale":[1,1,1],"name":"Rim","light":3}],"setups":[{"units":"cm","interface":{"visible":true,"logo":true,"menu":true,"tools":true},"viewer":{"shader":"Default","exposure":1,"gamma":2,"annotationsVisible":false},"reader":{"enabled":false,"position":"Overlay"},"navigation":{"type":"Orbit","enabled":true,"autoZoom":true,"lightsFollowCamera":true,"autoRotation":false,"orbit":{"orbit":[-24,-26,0],"offset":[0,0,150],"minOrbit":[-90,null,null],"maxOrbit":[90,null,null],"minOffset":[null,null,0.1],"maxOffset":[null,null,10000]}},"background":{"style":"RadialGradient","color0":[0.2,0.25,0.3],"color1":[0.01,0.03,0.05]},"floor":{"visible":false,"position":[0,-25,0],"size":50,"color":[0.6,0.75,0.8],"opacity":0.5,"receiveShadow":false},"grid":{"visible":false,"color":[0.5,0.7,0.8]},"tape":{"enabled":false,"startPosition":[0,0,0],"startDirection":[0,0,0],"endPosition":[0,0,0],"endDirection":[0,0,0]},"slicer":{"enabled":false,"axis":"X","inverted":false,"position":0.5}}],"cameras":[{"type":"perspective","perspective":{"yfov":52,"znear":0.1,"zfar":100000}}],"lights":[{"color":[1,0.95,0.9],"intensity":1,"type":"directional","shadowEnabled":true},{"color":[0.9,0.95,1],"intensity":0.7,"type":"directional","shadowEnabled":true},{"color":[0.8,0.85,1],"intensity":0.5,"type":"directional"},{"color":[0.85,0.9078313,1],"intensity":0.6,"type":"directional"}]}')}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};n(94860)})(); \ No newline at end of file From 697cf3daeebdeada0baafb6cc7ccca9c89432fdc Mon Sep 17 00:00:00 2001 From: qqmyers Date: Thu, 8 Aug 2024 15:24:49 -0400 Subject: [PATCH 4/5] Use stock script For pre-Dataverse 6.4 (which doesn't recognize the *.glb files, one can edit the Accept header in the voyager-explorer.min.js script to accept * in addition to text/plain (there is only one place this happens in their current script so easy to find). 6.4, in addition to adding the mimetype, changes the file download api to @Produce */* (making text/plain an OK request rather than a 406 error). --- previewers/betatest/js/voyager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/previewers/betatest/js/voyager.js b/previewers/betatest/js/voyager.js index 6c18301..cf0f02d 100644 --- a/previewers/betatest/js/voyager.js +++ b/previewers/betatest/js/voyager.js @@ -15,5 +15,5 @@ function writeContent(fileUrl, file, title, authors) { const fileName = fileUrl.substring(lastIndexOfChar + 1); console.log(fileUrl); $("voyager-explorer").attr("root", rootUrl).attr("model", fileName); - $.getScript("lib/voyager-explorer.min.v0.42.1.gdcc.js"); + $.getScript("https://3d-api.si.edu/resources/js/v0.43.0/voyager-explorer.min.js"); } \ No newline at end of file From 353e9c8d04db22c264f1fa1bd102dc5a42feea62 Mon Sep 17 00:00:00 2001 From: qqmyers Date: Mon, 12 Aug 2024 11:47:24 -0400 Subject: [PATCH 5/5] Tweak naming, keep pre-6.4 edited script --- previewers/betatest/js/voyager.js | 4 +++- ...n.v0.42.1.gdcc.js => voyager-explorer.v0.42.1.gdcc.min.js} | 0 2 files changed, 3 insertions(+), 1 deletion(-) rename previewers/betatest/lib/{voyager-explorer.min.v0.42.1.gdcc.js => voyager-explorer.v0.42.1.gdcc.min.js} (100%) diff --git a/previewers/betatest/js/voyager.js b/previewers/betatest/js/voyager.js index cf0f02d..452fc9a 100644 --- a/previewers/betatest/js/voyager.js +++ b/previewers/betatest/js/voyager.js @@ -15,5 +15,7 @@ function writeContent(fileUrl, file, title, authors) { const fileName = fileUrl.substring(lastIndexOfChar + 1); console.log(fileUrl); $("voyager-explorer").attr("root", rootUrl).attr("model", fileName); - $.getScript("https://3d-api.si.edu/resources/js/v0.43.0/voyager-explorer.min.js"); + //For Dataverse 6.4+, this can use the standard script: + //$.getScript("https://3d-api.si.edu/resources/js/v0.42.1/voyager-explorer.min.js"); + $.getScript("lib/voyager-explorer.v0.42.1.gdcc.min.js"); } \ No newline at end of file diff --git a/previewers/betatest/lib/voyager-explorer.min.v0.42.1.gdcc.js b/previewers/betatest/lib/voyager-explorer.v0.42.1.gdcc.min.js similarity index 100% rename from previewers/betatest/lib/voyager-explorer.min.v0.42.1.gdcc.js rename to previewers/betatest/lib/voyager-explorer.v0.42.1.gdcc.min.js