@avs/go 0.14.72017 → 0.14.72037
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avs-element-mixin.d.ts +2 -2
- package/dist/avs-element-mixin.d.ts.map +1 -1
- package/dist/avs-go-dataviz.d.ts +32 -43
- package/dist/avs-go-dataviz.d.ts.map +1 -1
- package/dist/avs-go-dataviz.js +41 -57
- package/dist/avs-go-dynamic-html.d.ts.map +1 -1
- package/dist/avs-go-dynamic-html.js +7 -2
- package/dist/avs-go-info.d.ts.map +1 -1
- package/dist/avs-go-info.js +6 -1
- package/dist/avs-go.min.js +7 -7
- package/dist/avs-renderer.d.ts +1 -1
- package/dist/avs-renderer.d.ts.map +1 -1
- package/dist/avs-renderer.js +4 -0
- package/dist/constants.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +3 -3
- package/dist/avs-go.min.js.LICENSE.txt +0 -61
package/dist/avs-go.min.js
CHANGED
|
@@ -18,7 +18,7 @@ var t,e;t=this,e=function(t){
|
|
|
18
18
|
* This product includes software developed at
|
|
19
19
|
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
20
20
|
*/
|
|
21
|
-
const e=t=>class extends t{_httpRequest(t,e,n,i){t||(this._dispatchErrorEvent("'url' property must point to an instance of AVS/Go server."),n?.());const r="0.14.
|
|
21
|
+
const e=t=>class extends t{_httpRequest(t,e,n,i){t||(this._dispatchErrorEvent("'url' property must point to an instance of AVS/Go server."),n?.());const r="0.14.72037".split("."),a=[parseInt(r[0]),parseInt(r[1]),parseInt(r[2])],s={source:this.localName,model:i,version:a};fetch(t,{method:i?"POST":"GET",headers:{"Content-Type":"application/json"},body:i?JSON.stringify(s):void 0}).then((t=>t.json())).then((t=>{t.error?(this._processServerError(t.error),n?.()):e?.(t)})).catch((t=>{this._dispatchErrorEvent(t),n?.()}))}_processServerError(t){if(!t)return;const e=JSON.parse(decodeURIComponent(t.replace(/\+/g,"%20")));let n="An error occurred on the AVS/Go server";for(const t in e)if(e.hasOwnProperty(t)){""!=n&&(n+="\n "),n+=t+": ";const i=e[t];i===Object(i)?n+=JSON.stringify(i):n+=e[t]}this._dispatchErrorEvent(n)}_dispatchErrorEvent(t){this.dispatchEvent(new CustomEvent("avs-error",{bubbles:!0,composed:!0,detail:t}))}},n=globalThis,i=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),a=new WeakMap;
|
|
22
22
|
/**
|
|
23
23
|
* @license
|
|
24
24
|
* Copyright 2018-2026 Advanced Visual Systems Inc.
|
|
@@ -115,7 +115,7 @@ function fd(){let t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAn
|
|
|
115
115
|
*
|
|
116
116
|
* This product includes software developed at
|
|
117
117
|
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
118
|
-
*/class om extends HTMLElement{connectedCallback(){this.webGLRenderer=new sm({alpha:!0})}}customElements.define("avs-renderer",om);
|
|
118
|
+
*/class om extends HTMLElement{constructor(){super(...arguments),this.webGLRenderer=void 0}connectedCallback(){this.webGLRenderer=new sm({alpha:!0})}}customElements.define("avs-renderer",om);
|
|
119
119
|
// @license Licensed by Advanced Visual Systems Inc. to You under the Apache License, Version 2.0.
|
|
120
120
|
var lm=0,cm=1,hm=0,dm=1,um=1,pm=2,mm=3,fm=4;const gm=new Ci;class vm extends Tr{constructor(){super(),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){gm.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,gm),this.matrixWorldNeedsUpdate=!0}toJSON(t){const e=super.toJSON(t);return"{}"!==JSON.stringify(this.internalData)&&(e.object.internalData=this.internalData),e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),e}}const _m=new Ci,ym=new Ci;class xm extends Wo{constructor(t,e){super(t,e),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){ym.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,ym),this.matrixWorldNeedsUpdate=!0}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),e}raycast(t,e){const n=this.geometry.attributes,i=n.position.array;let r,a,s,o,l,c,h=.5;void 0===this.material.vertexSizes&&(h=this.material.size/2);for(let d=0,u=i.length/3;d<u;d++)_m.fromArray(i,3*d),_m.applyMatrix4(this.matrixWorld),_m.project(t.camera),r=(_m.x+1)/2*t.landscapeWidth,a=(1-(_m.y+1)/2)*t.landscapeHeight,this.material.vertexSizes&&(h=n.vsize.array[d]/2),s=r-h,o=r+h,l=a-h,c=a+h,t.x>=s&&t.x<=o&&t.y>=l&&t.y<=c&&e.push({distance:null,distanceToRay:null,point:null,index:d,face:null,object:this})}}const bm=new Ci;class Sm extends Fo{constructor(t,e){super(t,e),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){bm.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,bm),this.matrixWorldNeedsUpdate=!0}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),e}}const Mm=new Ki,wm=new Ki,Em=new Ki,Tm=[],Am=new Ss,Cm=new Ci;class Rm extends Ss{constructor(t,e){super(t,e),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){Cm.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,Cm),this.matrixWorldNeedsUpdate=!0}raycast(t,e){if(Am.geometry=this.geometry,Am.material=this.material,void 0===Am.material||void 0===Am.geometry)return;if(!Am.material.glyphs)return super.raycast(t,e);const n=this.matrixWorld,i=Am.geometry.attributes.glyphOffset.array,r=i.length/3;let a,s,o;for(let l=0;l<r;l++){if(a=3*l,Am.material.vertexGlyphScales?(s=Am.geometry.attributes.glyphScale.array,Mm.makeScale(s[a],s[a+1],s[a+2])):Mm.makeScale(Am.material.glyphScale.x,Am.material.glyphScale.y,Am.material.glyphScale.z),Am.material.vertexGlyphOrientations&&(o=Am.geometry.attributes.glyphOrientation.array,Em.set(o[a],o[a+3],o[a+6],0,o[a+1],o[a+4],o[a+7],0,o[a+2],o[a+5],o[a+8],0,0,0,0,1),Mm.multiply(Em)),Mm.setPosition(i[a],i[a+1],i[a+2]),wm.multiplyMatrices(n,Mm),Am.matrixWorld=wm,Am.raycast(t,Tm),Tm.length>0){const t=Tm[0];t.faceIndex=l,t.object=this,e.push(t)}Tm.length=0}}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),e}}class Im extends Ch{constructor(t,e=Math.PI){super(t,e)}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),16777215===this.color.getHex()&&(e.object.color=void 0),this.intensity===Math.PI&&(e.object.intensity=void 0),e.object.shadow=void 0,e}}class Pm extends Ph{constructor(t,e=Math.PI){super(t,e)}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),16777215===this.color.getHex()&&(e.object.color=void 0),this.intensity===Math.PI&&(e.object.intensity=void 0),e.object.shadow=void 0,e}}class Lm extends Lh{constructor(t,e=Math.PI){super(t,e)}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),16777215===this.color.getHex()&&(e.object.color=void 0),this.intensity===Math.PI&&(e.object.intensity=void 0),e}}class Dm extends Rh{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.keepAspectRatio=!1,this.origLeft=t,this.origRight=e,this.origTop=n,this.origBottom=i}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),1===this.zoom&&(e.object.zoom=void 0),-1===this.left&&(e.object.left=void 0),1===this.right&&(e.object.right=void 0),1===this.top&&(e.object.top=void 0),-1===this.bottom&&(e.object.bottom=void 0),.1===this.near&&(e.object.near=void 0),2e3===this.far&&(e.object.far=void 0),this.keepAspectRatio&&(e.object.keepAspectRatio=!0),e}}class Nm extends wh{toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),50===this.fov&&(e.object.fov=void 0),1===this.zoom&&(e.object.zoom=void 0),.1===this.near&&(e.object.near=void 0),2e3===this.far&&(e.object.far=void 0),10===this.focus&&(e.object.focus=void 0),1===this.aspect&&(e.object.aspect=void 0),35===this.filmGauge&&(e.object.filmGauge=void 0),0===this.filmOffset&&(e.object.filmOffset=void 0),e}}class Om extends Fr{toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new Ki)&&(e.object.matrix=void 0),e}}class Um extends wc{constructor(t){super(),Object.defineProperties(this,{pickState:{get:function(){return this.uniforms.pickState.value},set:function(t){this.uniforms.pickState.value=t}},startCell:{get:function(){return this.uniforms.startCell.value},set:function(t){this.uniforms.startCell.value=t}},glyphs:{get:function(){return this.defines.GLYPH},set:function(t){this.defines.GLYPH=t}},glyphScale:{get:function(){return this.uniforms.uGlyphScale.value},set:function(t){this.uniforms.uGlyphScale.value=t}},glyphScaleFactorX:{get:function(){return this.uniforms.glyphScaleFactorX.value},set:function(t){this.uniforms.glyphScaleFactorX.value=t}},glyphScaleFactorY:{get:function(){return this.uniforms.glyphScaleFactorY.value},set:function(t){this.uniforms.glyphScaleFactorY.value=t}},glyphScaleFactorZ:{get:function(){return this.uniforms.glyphScaleFactorZ.value},set:function(t){this.uniforms.glyphScaleFactorZ.value=t}},vertexGlyphScales:{get:function(){return this.defines.USE_GLYPH_SCALE},set:function(t){this.defines.USE_GLYPH_SCALE=t}},glyphOrientation:{get:function(){return this.uniforms.uGlyphOrientation.value},set:function(t){this.uniforms.uGlyphOrientation.value=t}},vertexGlyphOrientations:{get:function(){return this.defines.USE_GLYPH_ORIENTATION},set:function(t){this.defines.USE_GLYPH_ORIENTATION=t}},opacityFactor:{get:function(){return this.uniforms.opacityFactor.value},set:function(t){this.uniforms.opacityFactor.value=t}}}),this.color=new Dr(16777215),this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}toJSON(t){const e=super.toJSON(t);return 3===this.depthFunc&&(e.depthFunc=void 0),!0===this.depthTest&&(e.depthTest=void 0),!0===this.depthWrite&&(e.depthWrite=void 0),!1===this.stencilWrite&&(e.stencilWrite=void 0),255===this.stencilWriteMask&&(e.stencilWriteMask=void 0),519===this.stencilFunc&&(e.stencilFunc=void 0),0===this.stencilRef&&(e.stencilRef=void 0),255===this.stencilFuncMask&&(e.stencilFuncMask=void 0),this.stencilFail===Wn&&(e.stencilFail=void 0),this.stencilZFail===Wn&&(e.stencilZFail=void 0),this.stencilZPass===Wn&&(e.stencilZPass=void 0),this.vertexGlyphScales&&(e.vertexGlyphScales=!0),this.vertexGlyphOrientations&&(e.vertexGlyphOrientations=!0),e.uniforms=void 0,e.fragmentShader=void 0,e.vertexShader=void 0,e}equals(t){return t.color.getHex()===this.color.getHex()&&t.opacity===this.opacity&&t.transparent===this.transparent&&t.side===this.side&&t.vertexColors===this.vertexColors}}const Fm={base:{pickState:{value:new Float32Array(1)},startCell:{value:0},uGlyphScale:{value:new Ci(1,1,1)},glyphScaleFactorX:{value:1},glyphScaleFactorY:{value:1},glyphScaleFactorZ:{value:1},uGlyphOrientation:{value:new Pi},opacityFactor:{value:1}},line:{linePattern:{value:65535},resolution:{value:new Ti(1,1)}},mesh:{stipple:{value:0},stippleColor:{value:new Dr(0)},stipplePattern:{value:new Float32Array(64)},textureBlending:{value:1}}},zm="uniform vec3 diffuse;\nuniform float opacity;\nuniform float opacityFactor;\nuniform float linePattern;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#ifdef USE_PATTERN\nvarying float vPattern;\n#endif\nvarying float vDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tfloat pattern;\n#ifdef USE_PATTERN\n\tpattern = floor( vPattern );\n#else\n\tpattern = linePattern;\n#endif\n\tfloat shift = pow( 2.0, floor( mod( vDistance, 16.0 ) ) );\n\tif( mod( floor( pattern / shift ), 2.0 ) < 0.5 ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t}\n}",km=zm,Bm=zm,Gm={points:{uniforms:Mc.merge([_d.points,_d.fog,Fm.base]),vertexShader:"attribute float vsize;\nattribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float size;\nuniform float pickState[ 1 ];\nuniform float startCell;\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <color_vertex>\n\t#include <begin_vertex>\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n#endif\n\ttransformed += glyphOffset;\n#endif\n\t#include <project_vertex>\n#ifdef USE_SIZE\n\tgl_PointSize = vsize;\n#else\n\tgl_PointSize = size;\n#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",fragmentShader:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float opacityFactor;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t}\n}"},line:{uniforms:Mc.merge([_d.common,_d.fog,Fm.base,Fm.line]),vertexShader:"attribute vec3 otherPosition;\nattribute float pattern;\nattribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float pickState[ 1 ];\nuniform float startCell;\nuniform vec2 resolution;\n#ifdef USE_PATTERN\nvarying float vPattern;\n#endif\nvarying float vDistance;\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <color_vertex>\n\tvec3 transformed = vec3( position );\n\tvec3 otherTransformed = vec3( otherPosition );\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n\totherTransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n\totherTransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n\totherTransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n\totherTransformed = glyphOrientation * otherTransformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n\totherTransformed = uGlyphOrientation * otherTransformed;\n#endif\n\ttransformed += glyphOffset;\n\totherTransformed += glyphOffset;\n#endif\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\tvec2 ndcPos1 = gl_Position.xy / gl_Position.w;\n\tvec4 other_Position = projectionMatrix * modelViewMatrix * vec4( otherTransformed, 1.0 );\n\tvec2 ndcPos2 = other_Position.xy / other_Position.w;\n\tfloat aspect = resolution.x / resolution.y;\n\tvec2 dir = ndcPos2 - ndcPos1;\n\tdir.x *= aspect;\n\tbool end = false;\n\tif ( dir.y < -EPSILON ) {\n\t\tend = true;\n\t}\n\telse if ( dir.y > EPSILON ) {\n\t\tend = false;\n\t}\n\telse if ( dir.x < -EPSILON ) {\n\t\tend = true;\n\t}\n\tvDistance = end ? 0.0 : length( dir * resolution ) / 2.0;\n#ifdef USE_PATTERN\n\tvPattern = pattern + 0.5;\n#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",fragmentShader:km},thick:{uniforms:Mc.merge([_d.common,_d.fog,Fm.base,Fm.line,{linewidth:{value:1}}]),vertexShader:"attribute vec3 instanceStart;\nattribute vec3 instanceEnd;\nattribute vec3 instanceColorStart;\nattribute vec3 instanceColorEnd;\nattribute float instancePattern;\nattribute float instanceLinewidthStart;\nattribute float instanceLinewidthEnd;\nattribute float cellCount;\nuniform float pickState[ 1 ];\nuniform float startCell;\nuniform float linewidth;\nuniform vec2 resolution;\n#ifdef USE_PATTERN\nvarying float vPattern;\n#endif\nvarying float vDistance;\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n#ifdef USE_COLOR\n\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart.xyz : instanceColorEnd.xyz;\n#endif\n#ifdef USE_PATTERN\n\tvPattern = instancePattern + 0.5;\n#endif\n\tfloat widthFactor, avgWidthFactor;\n#ifdef USE_LINEWIDTH\n\twidthFactor = ( position.y < 0.5 ) ? instanceLinewidthStart : instanceLinewidthEnd;\n\tavgWidthFactor = ( instanceLinewidthStart + instanceLinewidthEnd ) / 2.0;\n#else\n\twidthFactor = avgWidthFactor = linewidth;\n#endif\n\tfloat aspect = resolution.x / resolution.y;\n\tvec4 localStart = vec4( instanceStart, 1.0 );\n\tvec4 localEnd = vec4( instanceEnd, 1.0 );\n\tvec4 start = modelViewMatrix * localStart;\n\tvec4 end = modelViewMatrix * localEnd;\n\tvec4 clipStart = projectionMatrix * start;\n\tvec4 clipEnd = projectionMatrix * end;\n\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n#ifdef LINEWIDTH_SCALE\n\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\tif ( perspective ) {\n\t\tvec2 xyStart = localStart.xy;\n\t\tvec2 xyEnd = localEnd.xy;\n\t\tvec2 scaleDir = xyEnd - xyStart;\n\t\tscaleDir = normalize( scaleDir );\n\t\tvec2 scaleOffset = vec2( scaleDir.y, -scaleDir.x );\n\t\tscaleOffset.y /= aspect;\n\t\tif ( position.x < 0.5 ) scaleOffset *= -1.0;\n\t\tscaleOffset *= ( widthFactor * 0.5 );\n\t\tvec4 startEnd = ( position.y < 0.5 ) ? localStart : localEnd;\n\t\tvec4 scaleClip = vec4( startEnd );\n\t\tscaleClip.xy += scaleOffset;\n\t\tvec4 scalePosition = projectionMatrix * modelViewMatrix * scaleClip;\n\t\tvec4 scalePosition2 = projectionMatrix * modelViewMatrix * startEnd;\n\t\twidthFactor = avgWidthFactor = length( scalePosition2.xy - scalePosition.xy ) * resolution.y * 2.0;\n\t} else {\n\t\tvec4 localScale = ( position.y < 0.5 ) ? localStart : localEnd;\n\t\tlocalScale.y += widthFactor;\n\t\tvec4 clipScale = projectionMatrix * modelViewMatrix * localScale;\n\t\twidthFactor = avgWidthFactor = length( clipScale.xy - clip.xy ) * resolution.y / 2.0;\n\t}\n#endif\n\tif ( widthFactor < 1.0 ) {\n\t\twidthFactor = 1.0;\n\t}\n\tif ( avgWidthFactor < 1.0 ) {\n\t\tavgWidthFactor = 1.0;\n\t}\n\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\tvec2 dirOrig = dir;\n\tdir.x *= aspect;\n\tdir = normalize( dir );\n\tvec2 offset = vec2( dir.y, -dir.x );\n\tdir.x /= aspect;\n\toffset.x /= aspect;\n\tif ( position.x < 0.5 ) offset *= -1.0;\n\toffset += ( position.y < 0.5 ) ? -dir * 0.3 : dir * 0.3;\n\toffset *= widthFactor;\n\tdir *= widthFactor;\n\toffset /= resolution.y;\n\tdir /= resolution.y;\n\toffset *= clip.w;\n\tclip.xy += offset;\n\tif ( clip.z > -1.0 ) {\n\t\tclip.z -= 5.0e-4;\n\t\tif ( clip.z < -1.0 ) clip.z = -1.0;\n\t}\n\tgl_Position = clip;\n\tvDistance = ( position.y < 0.5 ) ? 0.0 : ( length( dirOrig * resolution ) + 2.0 * length( dir * resolution ) ) / avgWidthFactor / 2.0;\n\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",fragmentShader:Bm},basic:{uniforms:Mc.merge([_d.common,_d.fog,Fm.base,Fm.mesh]),vertexShader:"attribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float pickState[ 1 ];\nuniform float startCell;\nvarying vec3 vPickColor;\n#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n#endif\n\ttransformed += glyphOffset;\n#endif\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",fragmentShader:"uniform float stipple;\nuniform vec3 stippleColor;\nuniform vec4 stipplePattern[ 16 ];\nuniform vec3 diffuse;\nuniform float opacity;\nuniform float opacityFactor;\nuniform float textureBlending;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tif ( stipple > 0.5 ) {\n\t\tvec2 coord = floor( mod( gl_FragCoord.xy, 32.0 ) );\n\t\tint index = int( floor( coord.x / 64.0 ) + ( coord.y / 2.0 ) );\n\t\tint comp = int( floor( coord.x / 16.0 ) + mod( coord.y , 2.0 ) * 2.0 );\n\t\tfor ( int i = 0; i < 16; i ++ ) {\n\t\t\tif ( i == index ) {\n\t\t\t\tfloat shift = pow( 2.0, floor( mod( gl_FragCoord.x, 16.0 ) ) );\n\t\t\t\tfloat shortPattern;\n\t\t\t\tif ( comp == 0 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].x;\n\t\t\t\t} else if ( comp == 1 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].y;\n\t\t\t\t} else if ( comp == 2 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].z;\n\t\t\t\t} else {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].w;\n\t\t\t\t}\n\t\t\t\tif ( mod( floor( shortPattern / shift ), 2.0 ) > 0.5 ) {\n\t\t\t\t\tdiffuseColor = vec4( stippleColor, opacity );\n\t\t\t\t} else if ( stipple < 1.5 ) {\n\t\t\t\t\tdiscard;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tif ( textureBlending > 1.5 ) {\n\t\tvec3 temp = mix( diffuseColor.rgb, sampledDiffuseColor.rgb, sampledDiffuseColor.a );\n\t\tdiffuseColor = vec4( temp, diffuseColor.a );\n\t} else if ( textureBlending < 0.5 ) {\n\t\tdiffuseColor = sampledDiffuseColor;\n\t} else {\n\t\tdiffuseColor *= sampledDiffuseColor;\n\t}\n#endif\n\t#include <alphatest_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\t}\n}"},phong:{uniforms:Mc.merge([_d.common,_d.fog,_d.lights,Fm.base,Fm.mesh,{ambientIntensity:{value:.31},diffuseIntensity:{value:.7},emissive:{value:new Dr(0)},specular:{value:new Dr(2039583)},shininess:{value:63.8386159788056}}]),vertexShader:"attribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float pickState[ 1 ];\nuniform float startCell;\nvarying vec3 vPickColor;\n#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n#endif\n\ttransformed += glyphOffset;\n#endif\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",fragmentShader:"uniform float ambientIntensity;\nuniform float diffuseIntensity;\nuniform float stipple;\nuniform vec3 stippleColor;\nuniform vec4 stipplePattern[ 16 ];\nuniform float textureBlending;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\nuniform float opacityFactor;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\tif ( stipple > 0.5 ) {\n\t\tvec2 coord = floor( mod( gl_FragCoord.xy, 32.0 ) );\n\t\tint index = int( floor( coord.x / 64.0 ) + ( coord.y / 2.0 ) );\n\t\tint comp = int( floor( coord.x / 16.0 ) + mod( coord.y , 2.0 ) * 2.0 );\n\t\tfor ( int i = 0; i < 16; i ++ ) {\n\t\t\tif ( i == index ) {\n\t\t\t\tfloat shift = pow( 2.0, floor( mod( gl_FragCoord.x, 16.0 ) ) );\n\t\t\t\tfloat shortPattern;\n\t\t\t\tif ( comp == 0 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].x;\n\t\t\t\t} else if ( comp == 1 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].y;\n\t\t\t\t} else if ( comp == 2 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].z;\n\t\t\t\t} else {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].w;\n\t\t\t\t}\n\t\t\t\tif ( mod( floor( shortPattern / shift ), 2.0 ) > 0.5 ) {\n\t\t\t\t\tdiffuseColor = vec4( stippleColor, opacity );\n\t\t\t\t} else if ( stipple < 1.5 ) {\n\t\t\t\t\tdiscard;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tif ( textureBlending > 1.5 ) {\n\t\tvec3 temp = mix( diffuseColor.rgb, sampledDiffuseColor.rgb, sampledDiffuseColor.a );\n\t\tdiffuseColor = vec4( temp, diffuseColor.a );\n\t} else if ( textureBlending < 0.5 ) {\n\t\tdiffuseColor = sampledDiffuseColor;\n\t} else {\n\t\tdiffuseColor *= sampledDiffuseColor;\n\t}\n#endif\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\tvec3 outgoingLight = ( reflectedLight.directDiffuse * diffuseIntensity ) + ( reflectedLight.indirectDiffuse * ambientIntensity ) + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\t}\n}"}};class Vm extends Um{constructor(t){super({uniforms:Mc.clone(Gm.points.uniforms),vertexShader:Gm.points.vertexShader,fragmentShader:Gm.points.fragmentShader}),this.isPointsMaterial=!0,Object.defineProperties(this,{vertexSizes:{get:function(){return this.defines.USE_SIZE},set:function(t){this.defines.USE_SIZE=t}}}),this.map=null,this.size=1,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.size=t.size,this}toJSON(t){const e=super.toJSON(t);return e.type="PointsMaterial",this.vertexSizes&&(e.vertexSizes=!0),e}equals(t){return!1!==super.equals(t)&&!!t.isPointsMaterial}}class Hm extends Um{constructor(t){super({uniforms:Mc.clone(Gm.basic.uniforms),vertexShader:Gm.basic.vertexShader,fragmentShader:Gm.basic.fragmentShader}),this.isMeshBasicMaterial=!0,Object.defineProperties(this,{stipple:{get:function(){return this.uniforms.stipple.value},set:function(t){this.uniforms.stipple.value=t}},stippleColor:{get:function(){return this.uniforms.stippleColor.value},set:function(t){this.uniforms.stippleColor.value=t}},stipplePattern:{get:function(){return this.uniforms.stipplePattern.value},set:function(t){this.uniforms.stipplePattern.value=t}},textureBlending:{get:function(){return this.uniforms.textureBlending.value},set:function(t){this.uniforms.textureBlending.value=t}}}),this.map=null,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this}toJSON(t){const e=super.toJSON(t);return e.type="MeshBasicMaterial",0!==this.stipple&&(e.stipple=this.stipple),0!==this.stippleColor.getHex()&&(e.stippleColor=this.stippleColor.getHex()),JSON.stringify(this.stipplePattern)!==JSON.stringify(new Float32Array(64))&&(e.stipplePattern=Array.prototype.slice.call(this.stipplePattern)),1!==this.textureBlending&&(e.textureBlending=this.textureBlending),e}equals(t){return!1!==super.equals(t)&&!(!t.isMeshBasicMaterial&&!t.isMeshPhongMaterial)}}class Wm extends Hm{constructor(t){super({uniforms:Mc.clone(Gm.phong.uniforms),vertexShader:Gm.phong.vertexShader,fragmentShader:Gm.phong.fragmentShader}),this.isMeshPhongMaterial=!0,this.isMeshBasicMaterial=!1,Object.defineProperties(this,{ambientIntensity:{get:function(){return this.uniforms.ambientIntensity.value},set:function(t){this.uniforms.ambientIntensity.value=t}},diffuseIntensity:{get:function(){return this.uniforms.diffuseIntensity.value},set:function(t){this.uniforms.diffuseIntensity.value=t}}}),this.specular=new Dr(4737096),this.shininess=63.8386159788056,this.emissive=new Dr(0),this.emissiveIntensity=1,this.lights=!0,this.setValues(t)}copy(t){return super.copy(t),this.specular.copy(t.specular),this.shininess=t.shininess,this.flatShading=t.flatShading,this}toJSON(t){const e=super.toJSON(t);return e.type="MeshPhongMaterial",.31!==this.ambientIntensity&&(e.ambientIntensity=this.ambientIntensity),.7!==this.diffuseIntensity&&(e.diffuseIntensity=this.diffuseIntensity),4737096===this.specular.getHex()&&(e.specular=void 0),63.8386159788056===this.shininess&&(e.shininess=void 0),e}equals(t){return!1!==super.equals(t)&&!!t.isMeshPhongMaterial&&t.ambientIntensity===this.ambientIntensity&&t.diffuseIntensity===this.diffuseIntensity&&t.specular.getHex()===this.specular.getHex()&&t.shininess===this.shininess}}class jm extends Um{constructor(t){super({uniforms:Mc.clone(Gm.line.uniforms),vertexShader:Gm.line.vertexShader,fragmentShader:Gm.line.fragmentShader}),this.isLineBasicMaterial=!0,Object.defineProperties(this,{pattern:{get:function(){return this.uniforms.linePattern.value},set:function(t){this.uniforms.linePattern.value=t}},vertexPatterns:{get:function(){return this.defines.USE_PATTERN},set:function(t){this.defines.USE_PATTERN=t}},resolution:{get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value=t}}}),this.setValues(t)}toJSON(t){const e=super.toJSON(t);return e.type="LineMaterial",65535!==this.pattern&&(e.pattern=this.pattern),this.vertexPatterns&&(e.vertexPatterns=!0),e}equals(t){return!1!==super.equals(t)&&!!t.isLineBasicMaterial}}class Xm extends jm{constructor(t){super({uniforms:Mc.clone(Gm.thick.uniforms),vertexShader:Gm.thick.vertexShader,fragmentShader:Gm.thick.fragmentShader}),this.isThickLineMaterial=!0,Object.defineProperties(this,{linewidth:{get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},vertexLinewidths:{get:function(){return this.defines.USE_LINEWIDTH},set:function(t){this.defines.USE_LINEWIDTH=t}},linewidthScale:{get:function(){return this.defines.LINEWIDTH_SCALE},set:function(t){this.defines.LINEWIDTH_SCALE=t}}}),this.setValues(t)}toJSON(t){const e=super.toJSON(t);return e.type="ThickLineMaterial",this.vertexLinewidths&&(e.vertexLinewidths=!0),this.linewidthScale&&(e.linewidthScale=!0),e}equals(t){return!1!==super.equals(t)&&!!t.isThickLineMaterial&&t.vertexLinewidths===this.vertexLinewidths}}Uh.createMaterialFromType=function(t){return new{PointsMaterial:Vm,MeshPhongMaterial:Wm,MeshBasicMaterial:Hm,LineMaterial:jm,ThickLineMaterial:Xm}[t]};class qm extends Uh{parse(t){const e=super.parse(t);if(void 0!==t.glyphs&&(e.glyphs=t.glyphs),void 0!==t.vertexGlyphScales&&(e.vertexGlyphScales=t.vertexGlyphScales),void 0!==t.glyphScale&&e.glyphScale.fromArray(t.glyphScale),void 0!==t.vertexGlyphOrientations&&(e.vertexGlyphOrientations=t.vertexGlyphOrientations),void 0!==t.glyphOrientation&&e.glyphOrientation.fromArray(t.glyphOrientation),void 0!==t.vertexSizes&&(e.vertexSizes=t.vertexSizes),void 0!==t.pattern&&(e.pattern=t.pattern),void 0!==t.vertexPatterns&&(e.vertexPatterns=t.vertexPatterns),void 0!==t.vertexLinewidths&&(e.vertexLinewidths=t.vertexLinewidths),void 0!==t.linewidthScale&&(e.linewidthScale=t.linewidthScale),void 0!==t.stipple&&(e.stipple=t.stipple),void 0!==t.stippleColor&&void 0!==e.stippleColor&&e.stippleColor.setHex(t.stippleColor),void 0!==t.stipplePattern&&(e.stipplePattern=t.stipplePattern),void 0!==t.textureBlending&&(e.textureBlending=t.textureBlending),void 0!==t.ambientIntensity&&(e.ambientIntensity=t.ambientIntensity),void 0!==t.diffuseIntensity&&(e.diffuseIntensity=t.diffuseIntensity),void 0!==t.clippingPlanes){e.clippingPlanes=[];for(let n=0,i=t.clippingPlanes.length;n<i;n++){const i=t.clippingPlanes[n],r=new Js(new Ci(i.normal[0],i.normal[1],i.normal[2]),i.constant);e.clippingPlanes.push(r)}}return e.origTransparent=e.transparent,e}}class Ym{constructor(t){this.bufferGeometryLoader=t}parse(t){const e=this.bufferGeometryLoader.parse(t),n=e.attributes.position;if(void 0!==n){const t=new ya(n.array.length,3);for(let e=0,i=n.array.length/6;e<i;e++)t.array[6*e+0]=n.array[6*e+3],t.array[6*e+1]=n.array[6*e+4],t.array[6*e+2]=n.array[6*e+5],t.array[6*e+3]=n.array[6*e+0],t.array[6*e+4]=n.array[6*e+1],t.array[6*e+5]=n.array[6*e+2];e.setAttribute("otherPosition",t)}return e}}const Zm=new Kr,$m=new Ci;class Jm extends zh{constructor(){super(),this.isThickLineSegmentsBufferGeometry=!0,this.type="ThickLineSegmentsBufferGeometry",this.setAttribute("position",new ya([0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,1,1,0],3))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new ld(e,6,1);return this.setAttribute("instanceStart",new Na(n,3,0)),this.setAttribute("instanceEnd",new Na(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new ld(e,6,1);return this.setAttribute("instanceColorStart",new Na(n,3,0)),this.setAttribute("instanceColorEnd",new Na(n,3,3)),this}setPatterns(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new ld(e,2,1);return this.setAttribute("instancePattern",new Na(n,1,0)),this}setLinewidths(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new ld(e,2,1);return this.setAttribute("instanceLinewidthStart",new Na(n,1,0)),this.setAttribute("instanceLinewidthEnd",new Na(n,1,1)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Kr);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),Zm.setFromBufferAttribute(e),this.boundingBox.union(Zm))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ma),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let r=0,a=t.count;r<a;r++)$m.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared($m)),$m.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared($m));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("AVS.Three.ThickLineSegmentsBufferGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}applyMatrix(t){return console.warn("AVS.Three.ThickLineSegmentsBufferGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}class Km{parse(t){const e=new Jm,n=t.data.attributes;return void 0!==n.position&&e.setPositions(n.position.array),void 0!==n.color&&e.setColors(n.color.array),void 0!==n.pattern&&e.setPatterns(n.pattern.array),void 0!==n.linewidth&&e.setLinewidths(n.linewidth.array),e}}const Qm=new Ki,tf=new cs,ef=new Ma;class nf extends Rm{constructor(t,e){super(t,e),this.isThickLineSegments=!0,this.type="ThickLineSegments"}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ef.copy(n.boundingSphere),ef.applyMatrix4(i),ef.radius+=r,!1===t.ray.intersectsSphere(ef))return;Qm.copy(i).invert(),tf.copy(t.ray).applyMatrix4(Qm);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new Ci,c=new Ci,h=new Ci,d=new Ci,u=n.attributes.instanceStart;for(let n=Math.max(0,a.start),i=Math.min(u.count,a.start+a.count)-1;n<i;n+=2){if(l.fromBufferAttribute(u,n),c.fromBufferAttribute(u,n+1),tf.distanceSqToSegment(l,c,d,h)>o)continue;d.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(d);i<t.near||i>t.far||e.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}class rf{constructor(){this.uuid=Ei.generateUUID(),this.transparent=!1,this.opacity=1,this.opacityFactor=1}dispose(){}}class af extends Er{constructor(){super(),this.isBillboardText=!0,this.type="BillboardText",this.text="Label",this.fontSize=16,this.fontStyle="normal",this.fontWeight="normal",this.textDecoration="",this.fontFamily="sans-serif",this.color=new Dr(0),this.textAlign="",this.transform="",this.transformOrigin="",this.material=new rf,this.div=document.createElement("div"),this.div.style.position="absolute",this.div.style.whiteSpace="nowrap",this.div.style.userSelect="none",this.scene=null,this.scaleFactor=1,this.left=0,this.top=0,this.updateStyle()}addToScene(t){null===this.scene&&(this.scene=t,t.labels.push(this),t.landscapeDiv.appendChild(this.div),this.updateStyle())}updateStyle(){this.div.innerHTML=this.text,this.div.style.fontStyle=this.fontStyle,this.div.style.fontWeight=this.fontWeight,this.div.style.textDecoration=this.textDecoration,this.div.style.color="#"+this.color.getHexString(),this.div.style.transform=this.transform,this.div.style.transformOrigin=this.transformOrigin,this.material.transparent?this.div.style.opacity=this.material.opacity*this.material.opacityFactor:this.div.style.opacity=1,this.div.style.visibility=this.visible?"visible":"hidden",void 0!==this.div.firstChild.style&&(this.div.firstChild.style.float="left"),/\s/.test(this.fontFamily)?this.div.style.fontFamily="'"+this.fontFamily+"'":this.div.style.fontFamily=this.fontFamily,this.textScale||(this.div.style.fontSize=this.fontSize+"px")}updatePosition(){this.updateMatrixWorld();const t=(new Ci).setFromMatrixPosition(this.matrixWorld);if(t.project(this.scene.camera),this.left=(t.x+1)/2*this.scene.landscapeWidth,this.top=(1-(t.y+1)/2)*this.scene.landscapeHeight,this.moveText(),this.textScale){const t=new Ci(0,1,0).multiplyScalar(this.fontSize).add(this.position);t.applyMatrix4(this.parent.matrixWorld),t.project(this.scene.camera);const e=(1-(t.y+1)/2)*this.scene.landscapeHeight,n=Math.abs(e-this.top);this.div.style.fontSize=n+"px"}this.material.transparent?this.div.style.opacity=this.material.opacity*this.material.opacityFactor:this.div.style.opacity=1,this.div.style.visibility=this.visible?"visible":"hidden"}moveText(){this.div.style.left=Math.floor((this.panOffsetX??0)+this.left)+"px",this.div.style.top=Math.floor((this.panOffsetY??0)+this.top)+"px"}}class sf extends Gh{parse(t,e,n,i,r,a,s){const o=this.parseGeometries(t.geometries);a=Object.assign(a??{},o);const l=this.parseImages(t.images,(function(){void 0!==e&&e(d)}));n=Object.assign(n??{},l);const c=this.parseTextures(t.textures,n);i=Object.assign(i??{},c);const h=this.parseMaterials(t.materials,i);r=Object.assign(r??{},h);const d=this.parseObject(t.object,a,r,i);if(void 0!==s&&(s.add(d),d.saveVisible=d.visible,d.visible=!1),void 0!==e){let t=!1;for(const e in l)if(l[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(d)}return d}parseGeometries(t,e){const n={};if(void 0!==t){const e=new kh,i=new Ym(e),r=new Km;for(let a=0,s=t.length;a<s;a++){let s;const o=t[a];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=e.parse(o);break;case"LinePatternBufferGeometry":s=i.parse(o);break;case"ThickLineBufferGeometry":s=r.parse(o);break;case"SphereGeometry":s=dc.fromJSON(o);break;default:console.warn(`AVS.Three.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),!0===s.isBufferGeometry&&void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(t,e){const n={};if(void 0!==t){const i=new qm;i.setTextures(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];n[r.uuid]=i.parse(r)}}return n}parseObject(t,e,n,i){let r,a,s;function o(t){return void 0===e[t]&&console.warn("AVS.Three.ObjectLoader: Undefined geometry",t),e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("AVS.Three.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("AVS.Three.ObjectLoader: Undefined material",t),n[t]}}function c(t){return void 0===i[t]&&console.warn("AVS.Three.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":r=new Om,void 0!==t.background&&(Number.isInteger(t.background)?r.background=new Dr(t.background):r.background=c(t.background)),void 0!==t.environment&&(r.environment=c(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new Ur(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new Or(t.fog.color,t.fog.density))),void 0!==t.backgroundBlurriness&&(r.backgroundBlurriness=t.backgroundBlurriness);break;case"PerspectiveCamera":r=new Nm(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new Dm(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.view&&(r.view=Object.assign({},t.view)),void 0!==t.keepAspectRatio&&(r.keepAspectRatio=t.keepAspectRatio);break;case"AmbientLight":r=new Lm(t.color,t.intensity);break;case"DirectionalLight":r=new Pm(t.color,t.intensity);break;case"PointLight":r=new Im(t.color,t.intensity,t.distance,t.decay);break;case"Mesh":case"Quads":a=o(t.geometry),s=l(t.material),r=new Rm(a,s),r.cellType="Quads"===t.type?fm:mm,r.frustumCulled=void 0===s.glyphs;break;case"LineSegments":r=new Sm(o(t.geometry),l(t.material)),r.cellType=pm,r.frustumCulled=void 0===r.material.glyphs;break;case"ThickLineSegments":r=new nf(o(t.geometry),l(t.material)),r.cellType=fm,r.frustumCulled=void 0===r.material.glyphs;break;case"PointCloud":case"Points":r=new xm(o(t.geometry),l(t.material)),r.cellType=um,r.frustumCulled=void 0===r.material.glyphs;break;case"Group":r=new vm;break;case"BillboardText":r=new af,void 0!==t.text&&(r.text=t.text),void 0!==t.fontSize&&(r.fontSize=t.fontSize),void 0!==t.fontStyle&&(r.fontStyle=t.fontStyle),void 0!==t.fontWeight&&(r.fontWeight=t.fontWeight),void 0!==t.fontFamily&&(r.fontFamily=t.fontFamily),void 0!==t.textDecoration&&(r.textDecoration=t.textDecoration),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.transform&&(r.transform=t.transform),void 0!==t.transformOrigin&&(r.transformOrigin=t.transformOrigin),void 0!==t.textScale&&(r.textScale=t.textScale),void 0!==t.width&&(r.width=t.width),void 0!==t.height&&(r.height=t.height);break;default:r=new Er}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(r.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),r.internalData={},void 0!==t.internalData&&(r.internalData=t.internalData),void 0!==t.children){const a=t.children;for(let t=0;t<a.length;t++)r.add(this.parseObject(a[t],e,n,i))}return r}}class of{constructor(t){var e=t;this.getID=function(){return e},this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.outline="none",this.container.style.overflow="hidden",this.container.style.width="100%",this.container.style.height="100%",this.container.id="avsthreeDiv",this.domElement=this.container,this.scenes=[],this.currentScene=null,this.renderNextFrame=!1,this.objectLoader=new sf,this.startCell=1,this.raycaster=new hd,this.raycaster.params.Line.threshold=.001,this.validPick=!1,this.pickType=hm,this.pickDepth=cm,this.pickRayX=0,this.pickRayY=0,this.pickRectangleLeft=0,this.pickRectangleTop=0,this.pickRectangleRight=1,this.pickRectangleBottom=1,this.selectionListeners=[],this.intersects=[],this.highlightList=[],this.updateHighlight=!1,this.highlightColor=new Dr(16711680),this.updatePicking=!1,this.pickState=new Float32Array(1),this.resolution=new Ti,this.loading=!1,this.firstChunk=!1,this.animator=null,this.animatedGlyphs=[],this.enableAnimatedGlyphs=!1,this.visibleAnimatedGlyphs=!1,this.displayCanvas=!1,this.animate()}setWebGLRenderer(t){this.renderer=t,this.renderer.autoClear=!1,this.renderer.localClippingEnabled=!0,this.renderer.sortObjects=!1}updateSize(){var t=this.container.clientWidth,e=this.container.clientHeight;if(t!==this.width||e!==this.height){this.width=t,this.height=e,this.updateHighlight=!0,this.updatePicking=!0,this.validPick=!1;for(var n=0;n<this.scenes.length;n++)this.updateSceneSize(this.scenes[n])}}updateSceneSize(t){if(t.windowX=Math.floor(t.windowFractionX*this.width),t.windowWidth=Math.floor(t.windowFractionWidth*this.width),t.windowY=Math.floor(t.windowFractionY*this.height),t.windowHeight=Math.floor(t.windowFractionHeight*this.height),t.windowTop=this.height-t.windowHeight-t.windowY,t.windowDiv.style.left=t.windowX+"px",t.windowDiv.style.width=t.windowWidth+"px",t.windowDiv.style.top=t.windowTop+"px",t.windowDiv.style.height=t.windowHeight+"px",t.panScene||(t.landscapeWidth=t.windowWidth,t.landscapeHeight=t.windowHeight),t.landscapeDiv.style.width=t.landscapeWidth+"px",t.landscapeDiv.style.height=t.landscapeHeight+"px",t.landscapeDiv.style.left=(t.baseLeft??0)+(t.panOffsetX??0)+"px",t.landscapeDiv.style.top=(t.baseTop??0)+(t.panOffsetY??0)+"px",t.landscapeGrid&&this.sizeLandscapeGrid(t),t.rectCanvas&&(t.rectCanvas.width=t.windowWidth,t.rectCanvas.height=t.windowHeight),t.camera.isOrthographicCamera&&t.camera.keepAspectRatio){var e=t.landscapeWidth/t.internalData.width,n=t.landscapeHeight/t.internalData.height,i=t.internalData.width/t.internalData.height;t.landscapeWidth,t.landscapeHeight,i<1||(t.camera.left=t.camera.origLeft*e/n,t.camera.right=t.camera.origRight*e/n),t.camera.updateProjectionMatrix()}}sizeLandscapeGrid(t){for(var e=[],n=[],i=Math.floor(t.landscapeHeight/t.landscapeRows),r=0,a=0;a<t.landscapeRows;a++){var s=a==t.landscapeRows-1?t.landscapeHeight-r:i;e.push(r),n.push(s),r+=s}for(var o=[],l=[],c=Math.floor(t.landscapeWidth/t.landscapeColumns),h=0,d=0;d<t.landscapeColumns;d++){var u=d==t.landscapeColumns-1?t.landscapeWidth-h:c;o.push(h),l.push(u),h+=u}for(a=0;a<t.landscapeRows;a++)for(d=0;d<t.landscapeColumns;d++){var p=t.landscapeGrid[a][d];p.left=o[d],p.top=e[a];var m=!1;p.width===l[d]&&p.height===n[a]||(p.width=l[d],p.height=n[a],m=!0),this.isGridItemVisible(p)?p.initialized&&!m||(p.initialized||this.initializeGridItem(p),this.sizeGridItem(p)):p.initialized&&this.disposeGridItem(p)}}sizeGridItem(t){t.initialized&&(t.canvas.style.left=t.left+"px",t.canvas.style.top=t.top+"px",t.canvas.style.width=t.width+"px",t.canvas.style.height=t.height+"px",t.highlightCanvas.style.left=t.left+"px",t.highlightCanvas.style.top=t.top+"px",t.highlightCanvas.style.width=t.width+"px",t.highlightCanvas.style.height=t.height+"px",t.pixelX=Math.floor(t.left*window.devicePixelRatio),t.pixelY=Math.floor(t.top*window.devicePixelRatio),t.pixelWidth=Math.floor(t.width*window.devicePixelRatio),t.pixelHeight=Math.floor(t.height*window.devicePixelRatio),t.canvas.width=t.pixelWidth,t.canvas.height=t.pixelHeight,t.highlightCanvas.width=t.pixelWidth,t.highlightCanvas.height=t.pixelHeight,t.renderTarget.setSize(t.pixelWidth,t.pixelHeight),t.pixelBuffer=new Uint8Array(4*t.pixelWidth*t.pixelHeight),t.pickingRenderTarget.setSize(t.pixelWidth,t.pixelHeight),t.pickingPixelBuffer=new Uint8Array(4*t.pixelWidth*t.pixelHeight))}clearGeometry(){for(;this.container.lastChild;)this.container.removeChild(this.container.lastChild);this.panInteractor&&this.panInteractor.clear();for(let t=0;t<this.scenes.length;t++)this.scenes[t].traverse((function(t){t.material&&(t.material.map&&t.material.map.dispose(),t.material.dispose()),t.geometry&&t.geometry.dispose()}));this.scenes=[],this.currentScene=null,this.startCell=1,null!==this.animator&&this.animator.clear(),this.animatedGlyphs=[]}setPickDepth(t){void 0===t&&(t=cm),this.pickDepth!==t&&(this.pickDepth=t)}setPickRay(t,e){if(t<0||e<0||t>this.width||e>this.height)return this.validPick=!1,void console.error("AVS.Three.Viewer: pick ray coordinates out of range.");this.pickType=hm,this.pickRayX=t,this.pickRayY=e,this.validPick=!0}setPickRectangle(t,e,n,i){if(t<0||e<0||n>this.width||i>this.height)return this.validPick=!1,void console.error("AVS.Three.Viewer: pick rectangle coordinates out of range.");this.pickType=dm,this.pickRectangleLeft=t,this.pickRectangleTop=e,this.pickRectangleRight=n,this.pickRectangleBottom=i,this.validPick=!0}interactorUpdate(t){t===this.transformInteractor&&void 0!==this.zoomRectangleInteractor&&t.object===this.zoomRectangleInteractor.object&&(this.zoomRectangleInteractor.scale.copy(t.object.scale),this.zoomRectangleInteractor.position.copy(t.object.position)),t===this.zoomRectangleInteractor&&void 0!==this.transformInteractor&&t.object===this.transformInteractor.object&&(this.transformInteractor.scale.copy(t.object.scale),this.transformInteractor.position.copy(t.object.position)),this.updatePicking=!0,this.renderNextFrame=!0,void 0!==this.stats&&this.stats.update()}panInteractorUpdate(){for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid)for(var n=0;n<e.landscapeRows;n++)for(var i=0;i<e.landscapeColumns;i++){var r=e.landscapeGrid[n][i];this.isGridItemVisible(r)?r.initialized||(this.initializeGridItem(r),this.sizeGridItem(r),this.renderGridItem(r,!0),this.updatePicking=!0):r.initialized&&this.disposeGridItem(r)}}}addInteractor(t){if(t.isTransformInteractor)this.transformInteractor=t,t.addEventListener("change",this.interactorUpdate.bind(this,t));else if(t.isZoomRectangleInteractor)this.zoomRectangleInteractor=t,t.addEventListener("change",this.interactorUpdate.bind(this,t));else{if(!t.isPanInteractor)return;this.panInteractor=t,t.addEventListener("change",this.panInteractorUpdate.bind(this))}t.domElement=this.domElement}removeInteractor(t){t.isTransformInteractor?(t.removeEventListener("change",this.interactorUpdate.bind(this,this.transformInteractor)),this.transformInteractor=void 0):t.isZoomRectangleInteractor?(t.removeEventListener("change",this.interactorUpdate.bind(this,this.zoomRectangleInteractor)),this.zoomRectangleInteractor=void 0):t.isPanInteractor&&(this.panInteractor=void 0)}setAnimator(t){this.animator=t,t.addEventListener("change",this.interactorUpdate.bind(this))}addStats(){void 0===this.stats&&(this.stats=new Stats,this.container.appendChild(this.stats.dom))}addGeometry(t){t.updateMatrixWorld(),void 0!==t.internalData.background?this.container.style.backgroundColor="#"+t.internalData.background.toString(16).padStart(6,"0"):this.container.style.backgroundColor="transparent",this.processGeometry(t);for(var e=0;e<this.scenes.length;e++){var n=this.scenes[e];n.parent&&n.parent.remove(n)}}processGeometry(t){if(t.isScene){for(var e=0;e<t.children.length;e++){var n=t.children[e];if(n.isPerspectiveCamera||n.isOrthographicCamera){t.camera=n,t.remove(n);break}}null==t.camera&&null!==t.background&&(t.camera=new Rh),void 0!==t.camera&&this.addScene(t)}this.attachInteractors(t),this.addLabels(t),this.createPickingInfo(t),this.addMaterialReferences(t),t.internalData.animatedGlyphs&&this.animatedGlyphs.push(t);var i=t.children,r=i.length;for(e=0;e<r;)this.processGeometry(i[e]),i.length<r?r=i.length:e++}addScene(t,e=!1){this.scenes.push(t),this.currentScene=t,e||(this.currentRealScene=t),t.labels=[],this.calculateSceneFractions(t);var n=document.createElement("div");n.style.position="absolute",n.style.overflow="hidden",n.id=t.name+"-Window";var i=document.createElement("div");i.style.position="absolute",i.style.overflow="hidden",i.id=t.name+"-Landscape",n.appendChild(i),t.landscapeDiv=i,t.windowDiv=n,this.container.appendChild(n),this.updateSceneSize(t),t.startCell=this.startCell,t.highlightScene=new Fr,t.highlightScene.add(new Tr);for(var r=0;r<t.children.length;r++)t.children[r].isLight&&t.highlightScene.add(t.children[r].clone())}calculateSceneFractions(t){t.windowFractionX=t.internalData.x?Math.max(0,t.internalData.x/this.width):0,t.windowFractionWidth=t.internalData.width?Math.min(1,t.internalData.width/this.width):1,t.windowFractionY=t.internalData.y?Math.max(0,t.internalData.y/this.height):0,t.windowFractionHeight=t.internalData.height?Math.min(1,t.internalData.height/this.height):1}createLandscapeGrid(t){void 0===t.landscapeRows&&(t.landscapeRows=1),void 0===t.landscapeColumns&&(t.landscapeColumns=1),t.landscapeGrid=[];for(var e=0;e<t.landscapeRows;e++){t.landscapeGrid.push([]);for(var n=0;n<t.landscapeColumns;n++){var i={};i.container=t.landscapeDiv,i.scene=t,i.name=t.name+"-Landscape-Grid-Row"+e+"-Col"+n,i.initialized=!1,t.landscapeGrid[e].push(i)}}this.sizeLandscapeGrid(t)}isGridItemVisible(t){var e=t.scene,n=(e.baseLeft??0)+(e.panOffsetX??0)+t.left,i=n+t.width,r=(e.baseTop??0)+(e.panOffsetY??0)+t.top,a=r+t.height;return!(i<0||n>e.windowWidth||a<0||r>e.windowHeight)}initializeGridItem(t){var e=document.createElement("canvas");e.style.position="absolute",e.id=t.name,t.container.insertBefore(e,t.container.firstChild),t.canvas=e,t.ctx=e.getContext("2d"),this.displayCanvas&&(e.style.backgroundColor="rgba("+255*Math.random()+","+255*Math.random()+","+255*Math.random()+",0.1)");var n=document.createElement("canvas");n.style.position="absolute",n.id=t.name+"-Highlight",t.container.appendChild(n),t.highlightCanvas=n,t.highlightCtx=n.getContext("2d"),t.renderTarget=new Zi,t.renderTarget.texture.colorSpace=Bn,t.pickingRenderTarget=new Zi,t.initialized=!0}disposeGridItem(t){t.container.removeChild(t.canvas),t.canvas=null,t.ctx=null,t.container.removeChild(t.highlightCanvas),t.highlightCanvas=null,t.highlightCtx=null,t.renderTarget=null,t.pickingRenderTarget=null,t.initialized=!1}attachInteractors(t){if(t.internalData.attachTransformInteractor&&this.transformInteractor&&this.transformInteractor.setObjectScene(t,this.currentScene),t.internalData.attachZoomRectangleInteractor&&this.zoomRectangleInteractor&&this.zoomRectangleInteractor.setObjectScene(t,this.currentScene),t.internalData.attachPanInteractor&&this.panInteractor){var e=this.currentRealScene,n=t.parent;n.matrix.copy(t.parent.matrixWorld),n.matrixAutoUpdate=!1,n.isScene=!0,n.autoUpdate=!0,n.overrideMaterial=null,n.internalData.is3D=!1,n.internalData.pickable=this.isObjectPickable(t.parent),n.name=t.name,n.panScene=!0,e.origCamera||(e.origCamera=e.camera.clone(),e.internalData.origWidth=e.internalData.width,e.internalData.origHeight=e.internalData.height),n.camera=e.origCamera.clone();for(var i=n.camera.right-n.camera.left,r=n.camera.top-n.camera.bottom,a=0;a<e.children.length;a++)e.children[a].isLight&&n.add(e.children[a].clone());var s=new Ci;s.set(-t.internalData.xSize/2,-t.internalData.ySize/2,0),s.applyMatrix4(n.matrix);var o=new Ci;o.set(t.internalData.xSize/2,t.internalData.ySize/2,0),o.applyMatrix4(n.matrix);var l=e.internalData.origWidth,c=e.internalData.origHeight,h=Math.floor((s.x-n.camera.left)/i*l),d=Math.floor((1-(o.x-n.camera.left)/i)*l),u=Math.floor((s.y-n.camera.bottom)/r*c),p=Math.floor((1-(o.y-n.camera.bottom)/r)*c);this.panInteractor.leftLimit=(l-this.width)/2,this.panInteractor.rightLimit=-this.panInteractor.leftLimit,this.panInteractor.topLimit=(c-this.height)/2,this.panInteractor.bottomLimit=-this.panInteractor.topLimit,n.baseLeft=this.panInteractor.rightLimit-h,n.baseTop=this.panInteractor.bottomLimit-p,n.landscapeWidth=l,n.landscapeHeight=c,n.landscapeRows=Math.ceil(c/this.height),n.landscapeColumns=Math.ceil(l/this.width),n.centerWidth=l-h-d,n.centerHeight=c-u-p,n.zoomOffsetLeft=2*h+n.baseLeft,n.zoomOffsetTop=2*p+n.baseTop,"center"===t.internalData.attachPanInteractor?(n.internalData.x=h,n.internalData.width=this.width-h-d,n.internalData.y=u,n.internalData.height=this.height-u-p,e.internalData.x=n.internalData.x,e.internalData.width=n.internalData.width,e.internalData.y=n.internalData.y,e.internalData.height=n.internalData.height,e.camera.left=s.x,e.camera.right=o.x,e.camera.bottom=s.y,e.camera.top=o.y,this.calculateSceneFractions(e),this.updateSceneSize(e)):"bottom"===t.internalData.attachPanInteractor?(n.landscapeHeight=this.height,n.landscapeRows=1,n.camera.top=n.camera.bottom+r*this.height/c,n.internalData.x=h,n.internalData.width=this.width-h-d,n.internalData.y=0,n.internalData.height=this.height-p,n.baseTop=-p):"top"===t.internalData.attachPanInteractor?(n.landscapeHeight=this.height,n.landscapeRows=1,n.camera.bottom=n.camera.top-r*this.height/c,n.internalData.x=h,n.internalData.width=this.width-h-d,n.internalData.y=u,n.internalData.height=this.height-u,n.baseTop=0):"left"===t.internalData.attachPanInteractor?(n.landscapeWidth=this.width,n.landscapeColumns=1,n.camera.right=n.camera.left+i*this.width/l,n.internalData.x=0,n.internalData.width=this.width-d,n.internalData.y=u,n.internalData.height=this.height-u-p,n.baseLeft=0):"right"===t.internalData.attachPanInteractor&&(n.landscapeWidth=this.width,n.landscapeColumns=1,n.camera.left=n.camera.right-i*this.width/l,n.internalData.x=h,n.internalData.width=this.width-h,n.internalData.y=u,n.internalData.height=this.height-u-p,n.baseLeft=-h),this.addScene(n,!0),n.parent&&n.parent.remove(n),"center"===t.internalData.attachPanInteractor?this.panInteractor.object=n:"bottom"===t.internalData.attachPanInteractor?this.panInteractor.linkObjectsBottom.push(n):"top"===t.internalData.attachPanInteractor?this.panInteractor.linkObjectsTop.push(n):"left"===t.internalData.attachPanInteractor?this.panInteractor.linkObjectsLeft.push(n):"right"===t.internalData.attachPanInteractor&&this.panInteractor.linkObjectsRight.push(n),this.panInteractor.restorePanOffset(n),this.panInteractor.update()}else if(t.internalData.attachPanInteractorStatic&&this.panInteractor){var m=this;t.traverseAncestors((function(e){"bottom"===e.internalData.attachPanInteractor?(m.panInteractor.linkObjectsBottomStatic.push(t),t.linkBottom=e):"top"===e.internalData.attachPanInteractor?(m.panInteractor.linkObjectsTopStatic.push(t),t.linkTop=e):"left"===e.internalData.attachPanInteractor?(m.panInteractor.linkObjectsLeftStatic.push(t),t.linkLeft=e):"right"===e.internalData.attachPanInteractor&&(m.panInteractor.linkObjectsRightStatic.push(t),t.linkRight=e)}))}}createPickingInfo(t){if(void 0!==t.geometry&&void 0!==t.material){if(void 0===t.geometry.attributes.cellCount){var e,n;if(t.material.glyphs){var i=t.geometry.attributes.glyphOffset.array.length/3;n=i;for(var r=new Float32Array(i),a=0;a<i;a++)r[a]=a;e=new ks(r,1)}else if(t.isThickLineSegments){for(n=(s=t.geometry.attributes.instanceStart.array.length/3)/2,r=new Float32Array(n),a=0;a<n;a++)r[a]=a;e=new ks(r,1)}else{var s,o=1;for(t.isPoints?o=1:t.isLineSegments?o=2:t.isMesh&&(o=3),n=(s=t.geometry.attributes.position.array.length/3)/o,e=new ya(s,1),a=0;a<n;a++)for(var l=0;l<o;l++)e.array[a*o+l]=a}t.geometry.setAttribute("cellCount",e),t.geometry.nCells=n}t.nCells=t.geometry.nCells,t.startCell=this.startCell,t.onBeforeRender=function(t,e,n,i,r,a){r.uniforms.startCell.value=this.startCell,r.uniformsNeedUpdate=!0},this.startCell+=t.nCells,this.currentScene.landscapeGrid||this.createLandscapeGrid(this.currentScene),!this.pickingRenderTarget2&&this.startCell>16777215&&(this.pickingRenderTarget2=new Zi(this.pixelWidth,this.pixelHeight),this.pickingPixelBuffer2=new Uint8Array(4*this.pixelWidth*this.pixelHeight)),this.updatePicking=!0}}addLabels(t){t.isBillboardText&&t.addToScene(this.currentScene)}addMaterialReferences(t){void 0!==t.material&&(t.material.pickState=this.pickState,void 0!==t.material.isLineBasicMaterial&&(t.material.resolution=this.resolution))}loadGeometryAsJson(t,e,n,i){var r=this;this.objectLoader.parse(t,(function(t){r.clearGeometry(),r.updateSize(),r.addGeometry(t),r.renderNextFrame=!0,e&&e()}),n,i)}runAnimation(){if(null!==this.animator){this.animator.clear();for(var t=0;t<this.scenes.length;t++)this.animator.attach(this.scenes[t]);this.animator.hasAnimations()&&this.animator.play()}}animate(t){requestAnimationFrame(this.animate.bind(this)),this.visibleAnimatedGlyphs&&this.updateAnimatedGlyphs(this.enableAnimatedGlyphs?t:0),this.renderNextFrame&&(this.renderNextFrame=!1,this.render()),this.pickDepth===cm&&this.updatePicking&&(this.updatePicking=!1,this.pickRender())}setVisibleAnimatedGlyphs(t){this.visibleAnimatedGlyphs=t;for(let e=0;e<this.animatedGlyphs.length;e++)this.animatedGlyphs[e].traverse((function(e){e.visible=t}));this.renderNextFrame=!0}setEnableAnimatedGlyphs(t){this.enableAnimatedGlyphs=t}updateAnimatedGlyphs(t){const e=new Ci,n=new Ci,i=new Ci,r=new Ci,a=new Ci,s=new Pi,o=new Dr;for(let l=0;l<this.animatedGlyphs.length;l++){const c=this.animatedGlyphs[l];void 0===c.animatedGlyphsInitialized&&(c.animatedGlyphsInfo=JSON.parse(c.internalData.animatedGlyphs));const h=c.animatedGlyphsInfo.colorPalette,d=c.animatedGlyphsInfo.coordinates,u=c.animatedGlyphsInfo.segmentStartCoordIndex,p=c.animatedGlyphsInfo.segmentEndCoordIndex,m=c.animatedGlyphsInfo.segmentSpacing,f=c.animatedGlyphsInfo.segmentSpeed,g=c.animatedGlyphsInfo.segmentSurfaceColorIndex;if(void 0===c.animatedGlyphsInitialized){let t=0;for(let i=0;i<u.length;i++){if(m[i]<=0||0===f[i])continue;const r=u[i],a=p[i],s=m[i];let o=0;for(let t=r;t<a;t++)e.set(d[3*t],d[3*t+1],d[3*t+2]),n.set(d[3*t+3],d[3*t+4],d[3*t+5]),o+=e.distanceTo(n);t+=Math.ceil(o/s)}c.traverse((function(e){let n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");n.dispose();const r=new zh;r.setAttribute("position",i),r.setAttribute("glyphOffset",new ks(new Float32Array(3*t),3)),r.setAttribute("glyphOrientation",new ks(new Float32Array(9*t),9)),e.isMesh&&e.material.vertexColors&&r.setAttribute("color",new ks(new Float32Array(3*t),3)),e.geometry=r}})),c.animatedGlyphsInitialized=!0}const v=[],_=[],y=[];let x=0;for(let l=0;l<u.length;l++){if(m[l]<=0||0===f[l])continue;let c=g[l];(c<0||c>h.length)&&(c=0),o.set(h[c]);const b=f[l]>0?1:-1,S=m[l],M=b<0?p[l]-1:u[l],w=b<0?u[l]-1:p[l],E=S/Math.abs(f[l]);let T=S*(t%(1e3*E)/(1e3*E));for(let t=M;t!=w;t+=b){e.set(d[3*t],d[3*t+1],d[3*t+2]),n.set(d[3*t+3],d[3*t+4],d[3*t+5]);const l=e.distanceTo(n);i.subVectors(n,e).multiplyScalar(b).normalize(),r.copy(i).multiplyScalar(S),a.copy(i).multiplyScalar(T).add(b<0?n:e);const c=Math.atan2(-i.x,i.y);for(s.makeRotation(c);T<l;)v.push(a.x),v.push(a.y),v.push(a.z),_.push(s.elements[0]),_.push(s.elements[1]),_.push(s.elements[2]),_.push(s.elements[3]),_.push(s.elements[4]),_.push(s.elements[5]),_.push(s.elements[6]),_.push(s.elements[7]),_.push(s.elements[8]),y.push(o.r),y.push(o.g),y.push(o.b),a.add(r),T+=S,x++;T-=l}}c.traverse((function(t){const e=t.geometry;if(void 0!==e){const n=e.getAttribute("glyphOffset");n.set(v,0),n.needsUpdate=!0;const i=e.getAttribute("glyphOrientation");if(i.set(_,0),i.needsUpdate=!0,t.material.vertexColors){const t=e.getAttribute("color");t.set(y,0),t.needsUpdate=!0}e.instanceCount=x}})),this.renderNextFrame=!0}}loadGeometryAsEvents(t,e,n,i){var r=this,a=0,s=-1,o=0;function l(t){if(o--,t.layers.set(1),t.visible=t.saveVisible,s>0&&0==o)return r.render(),r.loading=!1,r.firstChunk=!1,void(e&&e())}function c(t){if("Group"===t.type){var e=r.objectLoader.parse(t);null!==r.curGroup&&r.curGroup.add(e),"SceneRoot"===e.name&&(void 0!==e.internalData.background?r.container.style.backgroundColor="#"+e.internalData.background.toString(16).padStart(6,"0"):r.container.style.backgroundColor="transparent"),e.updateMatrixWorld(!0),r.attachInteractors(e),r.curGroup=e}else if("FinishGroup"===t.type)null!==r.curGroup.parent&&(r.curGroup=r.curGroup.parent);else if("Geometry"===t.type){o++;var n=r.objectLoader.parse(t,l,r.images,r.textures,r.materials,r.geometries,r.curGroup);a++,r.addLabels(n),r.createPickingInfo(n),r.addMaterialReferences(n)}else if("Layout"===t.type){for(var i=r.objectLoader.parse(t),s=0;s<i.children.length;s++){var c=i.children[s];if(c.isPerspectiveCamera||c.isOrthographicCamera){i.camera=c,i.remove(c);break}}null==i.camera&&null!==i.background&&(i.camera=new Rh),void 0!==i.camera&&r.addScene(i),r.curGroup=i}else console.log("ERROR: unknown type: "+t.type)}if(void 0!==this.chunkId&&this.chunkId===t.chunkId||(this.clearGeometry(),this.curGroup=null,this.images=[],this.textures=[],this.materials=[],this.geometries=[],this.firstChunk=!0,this.chunkId=t.chunkId),this.loading=!0,this.updateSize(),void 0!==t&&void 0!==t.events&&0!==t.events.length){for(var h=0;h<t.events.length;h++)c(t.events[h]);!0===t.moreChunks?this.render():(s=a-1,0==o&&(this.render(),this.loading=!1,e&&e())),this.firstChunk=!1}else console.error("AVS.Three.Viewer.loadGeometryAsEvents: Can't get events")}highlightRender(){if(void 0!==this.renderer)for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid){for(var n=0;n<e.landscapeRows;n++)for(var i=0;i<e.landscapeColumns;i++){var r=e.landscapeGrid[n][i];r.initialized&&(this.resolution.x=r.pixelWidth,this.resolution.y=r.pixelHeight,this.renderer.setSize(r.pixelWidth,r.pixelHeight),this.renderer.setClearColor(0,0),this.renderer.clear(),e.camera.setViewOffset(e.landscapeWidth,e.landscapeHeight,r.left,r.top,r.width,r.height),this.renderer.render(e.highlightScene,e.camera),r.highlightCtx.clearRect(0,0,r.pixelWidth,r.pixelHeight),r.highlightCtx.drawImage(this.renderer.domElement,0,0))}e.camera.clearViewOffset()}}else console.error("AVS.Three.Viewer: WebGLRenderer not set.")}pickRender(){if(void 0!==this.renderer){for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid){e.traverse((function(t){void 0!==t.material&&(t.material.transparent=!1)}));for(var n=0;n<e.landscapeRows;n++)for(var i=0;i<e.landscapeColumns;i++){var r=e.landscapeGrid[n][i];r.initialized&&(this.resolution.x=r.pixelWidth,this.resolution.y=r.pixelHeight,this.renderer.setRenderTarget(r.pickingRenderTarget),this.pickState[0]=1,this.renderer.setClearColor(0,0),this.renderer.clear(),e.camera.setViewOffset(e.landscapeWidth,e.landscapeHeight,r.left,r.top,r.width,r.height),this.renderer.render(e,e.camera),this.renderer.readRenderTargetPixels(r.pickingRenderTarget,0,0,r.pixelWidth,r.pixelHeight,r.pickingPixelBuffer),r.pickingRenderTarget2&&(this.renderer.setRenderTarget(r.pickingRenderTarget2),this.pickState[0]=2,this.renderer.clear(),this.renderer.render(e,e.camera),this.renderer.readRenderTargetPixels(r.pickingRenderTarget2,0,0,r.pixelWidth,r.pixelHeight,r.pickingPixelBuffer2)))}e.camera.clearViewOffset(),e.traverse((function(t){void 0!==t.material&&(t.material.transparent=t.material.origTransparent)}))}}this.pickState[0]=0,this.renderer.setRenderTarget(null)}else console.error("AVS.Three.Viewer: WebGLRenderer not set.")}render(t){if(void 0!==this.renderer){if(null!==this.domElement.offsetParent){this.updateSize();for(var e=this.loading,n=t||!e,i=0;i<this.scenes.length;i++){var r=this.scenes[i];if(r.landscapeGrid){if(!n){r.camera.layers.set(1);for(var a=0;a<r.children.length;a++)r.children[a].isLight&&r.children[a].layers.set(1)}for(var s=0;s<r.landscapeRows;s++)for(var o=0;o<r.landscapeColumns;o++){var l=r.landscapeGrid[s][o];this.renderGridItem(l,n)}n||(r.camera.layers.set(0),r.traverse((function(t){t.layers.set(0)})))}for(a=0;a<r.labels.length;a++)r.labels[a].updatePosition()}this.updateHighlight&&(this.highlightRender(),this.updateHighlight=!1)}}else console.error("AVS.Three.Viewer: WebGLRenderer not set.")}renderGridItem(t,e){if(t.initialized){var n=t.scene;if(this.resolution.x=t.pixelWidth,this.resolution.y=t.pixelHeight,e?this.renderer.setSize(t.pixelWidth,t.pixelHeight):this.renderer.setRenderTarget(t.renderTarget),(e||this.firstChunk)&&(n.internalData.background?this.renderer.setClearColor(n.internalData.background,1):this.renderer.setClearColor(0,0),this.renderer.clear()),n.camera.setViewOffset(n.landscapeWidth,n.landscapeHeight,t.left,t.top,t.width,t.height),this.renderer.render(n,n.camera),e)t.ctx.clearRect(0,0,t.pixelWidth,t.pixelHeight),t.ctx.drawImage(this.renderer.domElement,0,0);else{this.renderer.readRenderTargetPixels(t.renderTarget,0,0,t.pixelWidth,t.pixelHeight,t.pixelBuffer);for(var i,r,a=t.ctx.createImageData(t.pixelWidth,t.pixelHeight),s=4*t.pixelWidth,o=0;o<t.pixelBuffer.length;o++)i=Math.floor(o/s),r=o%s,a.data[(t.pixelHeight-i-1)*s+r]=t.pixelBuffer[o];t.ctx.putImageData(a,0,0),this.renderer.setRenderTarget(null)}n.camera.clearViewOffset()}}addSelectionListener(t){void 0!==t&&this.selectionListeners.push(t)}concatObjectsFromCellNums(t,e,n,i){if(void 0!==n&&0!==n.length&&0!==n[0]){for(void 0===i&&(i=e.startCell,n.sort((function(t,e){return t-e})));void 0!==e.nCells&&n[0]>=i&&n[0]<i+e.nCells;)if(e.material.glyphs||e.isThickLineSegments?t.push({object:e,index:n[0]-i}):e.isMesh?t.push({object:e,faceIndex:n[0]-i}):t.push({object:e,index:(e.isLineSegments?2:1)*(n[0]-i)}),n.splice(0,1),0===n.length)return;void 0!==e.nCells&&(i+=e.nCells);for(var r=0;r<e.children.length&&void 0!==(i=this.concatObjectsFromCellNums(t,e.children[r],n,i));r++);return i}}pick(){if(!1!==this.validPick){this.intersects=[];for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid)if(this.pickType===dm){var n=Math.max(this.pickRectangleLeft,e.windowX),i=Math.max(this.pickRectangleTop,e.windowTop),r=Math.min(this.pickRectangleRight,e.windowX+e.windowWidth),a=Math.min(this.pickRectangleBottom,e.windowTop+e.windowHeight);n-=e.windowX,i-=e.windowTop,r-=e.windowX,a-=e.windowTop,n-=(e.panOffsetX??0)+(e.baseLeft??0),r-=(e.panOffsetX??0)+(e.baseLeft??0),i-=(e.panOffsetY??0)+(e.baseTop??0),a-=(e.panOffsetY??0)+(e.baseTop??0);for(var s=[],o=n;o<r;o++)for(var l=i;l<a;l++)if(this.pickDepth===lm){var c=o/e.landscapeWidth*2-1,h=(e.landscapeHeight-l-1)/e.landscapeHeight*2-1;this.raycaster.setFromCamera(new Ti(c,h),e.camera),this.raycaster.landscapeWidth=e.landscapeWidth,this.raycaster.landscapeHeight=e.landscapeHeight,this.raycaster.x=o,this.raycaster.y=l;var d=this.raycaster.intersectObjects(e.children,!0);this.intersects=this.intersects.concat(d)}else for(var u=0;u<e.landscapeRows;u++)for(var p=0;p<e.landscapeColumns;p++)if((_=e.landscapeGrid[u][p]).initialized&&!(o<_.left||o>_.left+_.width||l<_.top||l>_.top+_.height)){var m=Math.floor(o*window.devicePixelRatio),f=Math.floor(l*window.devicePixelRatio),g=4*(m-_.pixelX+(_.pixelHeight-(f-_.pixelY)-1)*_.pixelWidth),v=255*_.pickingPixelBuffer[g]*255+255*_.pickingPixelBuffer[g+1]+_.pickingPixelBuffer[g+2];_.pickingPixelBuffer2&&(v+=255*_.pickingPixelBuffer2[g]*255*255*255*255+255*_.pickingPixelBuffer2[g+1]*255*255*255+255*_.pickingPixelBuffer2[g+2]*255*255),v>0&&-1===s.indexOf(v)&&s.push(v)}this.pickDepth===cm&&this.concatObjectsFromCellNums(this.intersects,e,s)}else{if(this.pickRayX<e.windowX||this.pickRayX>e.windowX+e.windowWidth||this.pickRayY<e.windowTop||this.pickRayY>e.windowTop+e.windowHeight)continue;if(o=this.pickRayX-e.windowX,l=this.pickRayY-e.windowTop,o-=(e.panOffsetX??0)+(e.baseLeft??0),l-=(e.panOffsetY??0)+(e.baseTop??0),this.pickDepth===lm)c=o/e.landscapeWidth*2-1,h=(e.landscapeHeight-l-1)/e.landscapeHeight*2-1,this.raycaster.setFromCamera(new Ti(c,h),e.camera),this.raycaster.landscapeWidth=e.landscapeWidth,this.raycaster.landscapeHeight=e.landscapeHeight,this.raycaster.x=o,this.raycaster.y=l,d=this.raycaster.intersectObjects(e.children,!0),this.intersects=this.intersects.concat(d);else for(u=0;u<e.landscapeRows;u++)for(p=0;p<e.landscapeColumns;p++){var _;(_=e.landscapeGrid[u][p]).initialized&&!(o<_.left||o>_.left+_.width||l<_.top||l>_.top+_.height)&&(m=Math.floor(o*window.devicePixelRatio),f=Math.floor(l*window.devicePixelRatio),g=4*(m-_.pixelX+(_.pixelHeight-(f-_.pixelY)-1)*_.pixelWidth),v=255*_.pickingPixelBuffer[g]*255+255*_.pickingPixelBuffer[g+1]+_.pickingPixelBuffer[g+2],_.pickingPixelBuffer2&&(v+=255*_.pickingPixelBuffer2[g]*255*255*255*255+255*_.pickingPixelBuffer2[g+1]*255*255*255+255*_.pickingPixelBuffer2[g+2]*255*255),this.concatObjectsFromCellNums(this.intersects,e,[v]))}}}for(t=0;t<this.selectionListeners.length;t++)this.selectionListeners[t]()}else console.error("AVS.Three.Viewer: invalid pick ray or rectangle.")}isObjectPickable(t){return void 0!==t.internalData.pickable?t.internalData.pickable:null===t.parent||this.isObjectPickable(t.parent)}getPickedCells(){for(var t=[],e=0;e<this.intersects.length;e++){var n=this.intersects[e].object;if(this.isObjectPickable(n)){for(var i=this.intersects[e].faceIndex??this.intersects[e].index,r=!1,a=0;a<t.length;a++)if(n===t[a].object){r=!0;for(var s=!1,o=0;o<t[a].indices.length;o++)if(i===t[a].indices[o]){s=!0;break}s||t[a].indices.push(i);break}r||t.push({object:n,indices:[i]})}}return t}getPickedCellSets(){for(var t=[],e=0;e<this.intersects.length;e++){var n=this.intersects[e].object;if(this.isObjectPickable(n)){for(var i=!1,r=0;r<t.length;r++)if(t[r].object===n){i=!0;break}i||t.push({object:n})}}return t}getPickedSceneNodes(){for(var t=[],e=0;e<this.intersects.length;e++){var n=this.intersects[e].object;if(this.isObjectPickable(n)){for(var i=n.parent,r=!1,a=0;a<t.length;a++)if(t[a].object===i){r=!0;break}r||t.push({object:i})}}return t}getSelectionInfo(t){for(var e=[],n=0;n<t.length;n++){var i=t[n].object,r=t[n].indices;if(void 0!==r)for(var a=0;a<r.length;a++)e.push(s(i,{},r[a]));else e.push(s(i,{}))}function s(t,e,n){for(var i in t.userData)void 0===e[i]&&(void 0!==n&&Array.isArray(t.userData[i])?e[i]=decodeURIComponent(t.userData[i][t.isLineSegments&&!t.material.glyphs?n/2:n]):e[i]=decodeURIComponent(t.userData[i]));return t.parent?s(t.parent,e):e}return e}highlightObjects(t,e){for(var n=!1,i=0;i<this.highlightList.length;i++)void 0!==(s=this.highlightList[i]).saveMaterial&&(s.material=s.saveMaterial,s.saveMaterial=void 0,n=!0),void 0!==s.saveGeometry&&(s.geometry=s.saveGeometry,s.saveGeometry=void 0,n=!0);for(i=0;i<this.scenes.length;i++){var r=this.scenes[i].highlightScene.children[0].children;r.length>0&&(r.length=0,this.updateHighlight=!0)}this.highlightList.length=0;var a=this;for(i=0;i<t.length;i++){var s;o(s=t[i].object,t[i].indices)}function o(t,i){if(t.isMesh||t.isLineSegments||t.isPoints){a.highlightList.push(t);var r,s=t.material.clone();if(s.opacity=1,void 0!==i){var l=t.geometry;if(s.vertexColors=!0,s.color=new Dr(16777215),t.isThickLineSegments){var c;if(r=new zh,l.attributes.instancedColorStart,void 0===oldColorStart){c=new ld(new Float32Array(l.attributes.instanceStart.array.length),6,1);for(var h=0,d=0;d<c.array.length/3;d++)c.array[h++]=t.material.color.r,c.array[h++]=t.material.color.g,c.array[h++]=t.material.color.b}else c=oldColorStart.data.clone();h=null;var u=null;for(d=0;d<i.length;d++){h=6*Math.floor(i[d]/6),u=2;for(var p=0;p<u;p++)c.array[h++]=a.highlightColor.r,c.array[h++]=a.highlightColor.g,c.array[h++]=a.highlightColor.b}for(var m in r.setAttribute("instancedColorStart",new Na(c,3,0)),r.setAttribute("instancedColorEnd",new Na(c,3,3)),l.attributes)"instancedColorStart"!==m&&"instancedColorEnd"!==m&&r.setAttribute(m,l.attributes[m])}else{r=t.material.glyphs?new zh:new Pa;var f=l.attributes.color,g=null;if(void 0===f)for(g=t.material.glyphs?new ks(new Float32Array(l.attributes.offset.array.length),3):new ya(l.attributes.position.array.length,3),h=0,d=0;d<g.array.length/3;d++)g.array[h++]=t.material.color.r,g.array[h++]=t.material.color.g,g.array[h++]=t.material.color.b;else g=f.clone();for(h=null,u=null,d=0;d<i.length;d++)for(t.material.glyphs||t.cellType===um?(h=3*i[d],u=1):t.cellType===pm?(h=3*i[d],u=2):t.cellType===mm?(h=9*i[d],u=3):(h=18*Math.floor(i[d]/2),u=6),p=0;p<u;p++)g.array[h++]=a.highlightColor.r,g.array[h++]=a.highlightColor.g,g.array[h++]=a.highlightColor.b;for(var m in r.setAttribute("color",g),l.attributes)"color"!==m&&r.setAttribute(m,l.attributes[m])}}else s.vertexColors=!1,s.color=a.highlightColor,r=t.geometry;var v=a.getObjectScene(t);if(void 0!==v.internalData.is3D&&!1===v.internalData.is3D&&void 0!==e&&!0===e){var _=t.clone();_.material=s,_.geometry=r,_.matrixAutoUpdate=!1,_.matrix.copy(t.matrixWorld),v.highlightScene.children[0].add(_),a.updateHighlight=!0}else t.saveMaterial=t.material,t.material=s,t.saveGeometry=t.geometry,t.geometry=r,n=!0}for(var y=0;y<t.children.length;y++)o(t.children[y])}n?this.render(!0):this.updateHighlight&&(this.highlightRender(),this.updateHighlight=!1)}getObjectScene(t){return t.isScene?t:this.getObjectScene(t.parent)}}const lf={type:"change"},cf={type:"start"},hf={type:"end"};class df extends mi{constructor(t){super(),this.isTransformInteractor=!0,this.domElement=t,this.domElement.style.touchAction="none",this.object=new Er,this.scene=null,this.enabled=!0,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.enablePan=!0,this.keyPanSpeed=7,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.touches={ONE:St,TWO:wt},this.quaternion=this.object.quaternion.clone(),this.position=this.object.position.clone(),this.scale=this.object.scale.clone(),this.clientOnly=!1,this.fullReset=!1,this.quaternion0=this.object.quaternion.clone(),this.position0=this.object.position.clone(),this.scale0=this.object.scale.clone(),this._domElementKeyEvents=null,this.listenToKeyEvents=function(t){t.addEventListener("keydown",F),this._domElementKeyEvents=t},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",F),this._domElementKeyEvents=null},this.setObjectScene=function(t,n){e.object=t,e.scene=n,this.fullReset||t.internalData.transformFullReset?(e.quaternion.copy(e.object.quaternion),e.scale.copy(e.object.scale),e.position.copy(e.object.position),e.quaternion0.copy(e.object.quaternion),e.scale0.copy(e.object.scale),e.position0.copy(e.object.position),this.fullReset=!1):e.clientOnly&&(e.object.quaternion.copy(e.quaternion),e.object.scale.copy(e.scale),e.object.position.copy(e.position)),t.internalData.transformWheelActions&&(r=JSON.parse(t.internalData.transformWheelActions)),t.internalData.transformTriggers&&(a=JSON.parse(t.internalData.transformTriggers))},this.reset=function(){e.quaternion.copy(e.quaternion0),e.scale.copy(e.scale0),e.position.copy(e.position0),e.object.quaternion.copy(e.quaternion0),e.object.scale.copy(e.scale0),e.object.position.copy(e.position0),e.dispatchEvent(lf),i=n.NONE},this.zoomIn=function(){b(1/f(),0,0)&&e.dispatchEvent(lf)},this.zoomOut=function(){b(f(),0,0)&&e.dispatchEvent(lf)},this.panTo=function(t,n,i){var r=e.object.parent.matrixWorld,a=1/r.elements[0],s=1/r.elements[5],o=1/r.elements[10],l=r.elements[12]*a,c=r.elements[13]*s,h=r.elements[14]*o;t*=e.object.scale.x,n*=e.object.scale.y,i*=e.object.scale.z,t+=l,n+=c,i+=h,e.object.position.set(e.position0.x-t,e.position0.y-n,e.position0.z-i),e.position.copy(e.object.position),e.dispatchEvent(lf)},this.dispose=function(){e.domElement.removeEventListener("contextmenu",z),e.domElement.removeEventListener("pointerdown",D),e.domElement.removeEventListener("pointercancel",O),e.domElement.removeEventListener("wheel",U),e.domElement.removeEventListener("pointermove",N),e.domElement.removeEventListener("pointerup",O),null!==e._domElementKeyEvents&&(e._domElementKeyEvents.removeEventListener("keydown",F),e._domElementKeyEvents=null)};const e=this,n={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=n.NONE,r=[{modifiers:0,param:"ZOOM_AT_POINTER"}],a=[{buttons:1,modifiers:0,param:"ROTATE"},{buttons:2,modifiers:0,param:"SCALE"},{buttons:4,modifiers:0,param:"TRANSLATE"}];const s=new Ti,o=new Ti,l=new Ti,c=new Ti,h=new Ti,d=new Ti,u=new Ti,p=[],m={};function f(){return Math.pow(.95,e.zoomSpeed)}function g(t){return 2*(t-e.scene.windowDiv.getBoundingClientRect().left)/e.scene.windowWidth-1}function v(t){return 1-2*(t-e.scene.windowDiv.getBoundingClientRect().top)/e.scene.windowHeight}const _=function(){const t=new Ki,n=new Ci,i=new Ci,r=new Ci,a=new Ki,l=new Ci;let c,h;const d=new Ai;return function(){return null!==e.object&&null!==e.object.parent&&(t.multiplyMatrices(e.scene.camera.matrixWorldInverse,e.object.parent.matrixWorld),n.set(0,0,0),i.set(s.x,s.y,1),r.set(o.x,o.y,1),a.copy(t).invert(),n.applyMatrix4(a),i.applyMatrix4(a),r.applyMatrix4(a),i.sub(n).normalize(),r.sub(n).normalize(),void 0!==e.scene.internalData.is3D&&!1===e.scene.internalData.is3D?(l.set(0,0,1),c=i.x*r.y-i.y*r.x,c<0&&(l.negate(),c=-c)):(l.crossVectors(i,r),c=l.length()),!(c<1e-5||(h=Math.abs(c)<1?2*Math.sin(c):Math.PI,i.dot(r)<0&&(h+=.5*Math.PI),d.setFromAxisAngle(l.normalize(),h),e.object.quaternion.premultiply(d),e.quaternion.copy(e.object.quaternion),0)))}}(),y=function(){const t=new Ki,n=new qi,i=new Ci,r=new Ki,a=new qi,s=new qi,o=new Ci,h=new Ci,d=new Ci;return function(){return null!==e.object&&null!==e.object.parent&&(t.multiplyMatrices(e.scene.camera.matrixWorldInverse,e.object.parent.matrixWorld),t.premultiply(e.scene.camera.projectionMatrix),n.set(0,0,0,1).applyMatrix4(t),i.set(n.x/n.w,n.y/n.w,n.z/n.w),r.copy(t).invert(),a.set(l.x,l.y,i.z,1),s.set(c.x,c.y,i.z,1),a.applyMatrix4(r),s.applyMatrix4(r),o.set(a.x/a.w,a.y/a.w,a.z/a.w),h.set(s.x/s.w,s.y/s.w,s.z/s.w),d.subVectors(h,o),e.object.position.add(d),e.position.copy(e.object.position),!0)}}();function x(t){return null!==e.object&&(e.object.scale.multiplyScalar(t),e.scale.copy(e.object.scale),!0)}const b=function(){const t=new Ki,n=new Ki,i=new qi,r=new qi,a=new Ci,s=new Ci;return function(o,l,c){return null!==e.object&&null!==e.object.parent&&(t.multiplyMatrices(e.scene.camera.matrixWorldInverse,e.object.parent.matrixWorld),t.premultiply(e.scene.camera.projectionMatrix),i.set(0,0,0,1).applyMatrix4(t),n.copy(t).invert(),r.set(l,c,i.z/i.w,1).applyMatrix4(n),a.set(r.x/r.w,r.y/r.w,r.z/r.w),a.sub(e.object.position),s.copy(a).multiplyScalar(o).add(a.negate()),e.object.scale.multiplyScalar(o),e.object.position.sub(s),e.scale.copy(e.object.scale),e.position.copy(e.object.position),!0)}}();function S(t){s.set(g(t.clientX),v(t.clientY))}function M(t){h.set(t.clientX,t.clientY)}function w(t){l.set(g(t.clientX),v(t.clientY))}function E(t){x(t.deltaY>0?f():1/f())&&e.dispatchEvent(lf)}function T(t){const n=t.deltaY>0?f():1/f();b(n,g(t.clientX),v(t.clientY))&&e.dispatchEvent(lf)}function A(){if(1===p.length)s.set(g(p[0].clientX),v(p[0].clientY));else{const t=.5*(p[0].clientX+p[1].clientX),e=.5*(p[0].clientY+p[1].clientY);s.set(g(t),v(e))}}function C(){if(1===p.length)l.set(g(p[0].clientX),v(p[0].clientY));else{const t=.5*(p[0].clientX+p[1].clientX),e=.5*(p[0].clientY+p[1].clientY);l.set(g(t),v(e))}}function R(){const t=Math.abs(p[0].clientX-p[1].clientX),e=Math.abs(p[0].clientY-p[1].clientY),n=Math.sqrt(t*t+e*e);h.set(0,n)}function I(t){if(1==p.length)o.set(g(t.clientX),v(t.clientY));else{const e=B(t),n=.5*(t.clientX+e.x),i=.5*(t.clientY+e.y);o.set(g(n),v(i))}_()&&e.dispatchEvent(lf),s.copy(o)}function P(t){if(1===p.length)c.set(g(t.clientX),v(t.clientY));else{const e=B(t),n=.5*(t.clientX+e.x),i=.5*(t.clientY+e.y);c.set(g(n),v(i))}y()&&e.dispatchEvent(lf),l.copy(c)}function L(t){const n=B(t),i=t.clientX-n.x,r=t.clientY-n.y,a=Math.sqrt(i*i+r*r);d.set(0,a),u.set(0,Math.pow(d.y/h.y,e.zoomSpeed)),x(u.y)&&e.dispatchEvent(lf),h.copy(d)}function D(t){!1!==e.enabled&&(0===p.length&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",N),e.domElement.addEventListener("pointerup",O)),function(t){p.push(t)}(t),"touch"===t.pointerType?function(t){switch(k(t),p.length){case 1:switch(e.touches.ONE){case St:if(!1===e.enableRotate)return;A(),i=n.TOUCH_ROTATE;break;case Mt:if(!1===e.enablePan)return;C(),i=n.TOUCH_PAN;break;default:i=n.NONE}break;case 2:switch(e.touches.TWO){case wt:if(!1===e.enableZoom&&!1===e.enablePan)return;e.enableZoom&&R(),e.enablePan&&C(),i=n.TOUCH_DOLLY_PAN;break;case Et:if(!1===e.enableZoom&&!1===e.enableRotate)return;e.enableZoom&&R(),e.enableRotate&&A(),i=n.TOUCH_DOLLY_ROTATE;break;default:i=n.NONE}break;default:i=n.NONE}i!==n.NONE&&e.dispatchEvent(cf)}(t):function(t){t.preventDefault();var r=0;r+=t.shiftKey?1:0,r+=t.ctrlKey?2:0,r+=t.metaKey?4:0;let s=0;switch(t.button){case 0:s=1;break;case 1:s=2;break;case 2:s=4}for(var o=0,l=a.length;o<l;o++)if(r===a[o].modifiers&&s&a[o].buttons){switch(a[o].param){case 0:case"ROTATE":if(!1===e.enableRotate)continue;S(t),i=n.ROTATE,e.domElement.ownerDocument.body.style.cursor="move";break;case 1:case"SCALE":if(!1===e.enableZoom)continue;M(t),i=n.DOLLY,e.domElement.ownerDocument.body.style.cursor="ne-resize";break;case 2:case"TRANSLATE":if(!1===e.enablePan)continue;w(t),i=n.PAN,e.domElement.ownerDocument.body.style.cursor="move";break;default:i=n.NONE}i!==n.NONE&&e.dispatchEvent(cf);break}}(t))}function N(t){!1!==e.enabled&&("touch"===t.pointerType?function(t){switch(k(t),i){case n.TOUCH_ROTATE:if(!1===e.enableRotate)return;I(t);break;case n.TOUCH_PAN:if(!1===e.enablePan)return;P(t);break;case n.TOUCH_DOLLY_PAN:if(!1===e.enableZoom&&!1===e.enablePan)return;!function(t){e.enableZoom&&L(t),e.enablePan&&P(t)}(t);break;case n.TOUCH_DOLLY_ROTATE:if(!1===e.enableZoom&&!1===e.enableRotate)return;!function(t){e.enableZoom&&L(t),e.enableRotate&&I(t)}(t);break;default:i=n.NONE}}(t):function(t){if(!1!==e.enabled)switch(t.preventDefault(),i){case n.ROTATE:if(!1===e.enableRotate)return;!function(t){o.set(g(t.clientX),v(t.clientY)),_()&&e.dispatchEvent(lf),s.copy(o)}(t);break;case n.DOLLY:if(!1===e.enableZoom)return;!function(t){d.set(t.clientX,t.clientY),u.subVectors(d,h),x((Math.abs(u.x)>Math.abs(u.y)?-u.x:u.y)>0?f():1/f())&&e.dispatchEvent(lf),h.copy(d)}(t);break;case n.PAN:if(!1===e.enablePan)return;!function(t){c.set(g(t.clientX),v(t.clientY)),y()&&e.dispatchEvent(lf),l.copy(c)}(t)}}(t))}function O(t){!function(t){delete m[t.pointerId];for(let e=0;e<p.length;e++)if(p[e].pointerId==t.pointerId)return void p.splice(e,1)}(t),0===p.length&&(e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",N),e.domElement.removeEventListener("pointerup",O)),e.domElement.ownerDocument.body.style.cursor="default",e.dispatchEvent(hf),i=n.NONE}function U(t){if(!1!==e.enabled&&!1!==e.enableZoom&&i===n.NONE){var a=0;a+=t.shiftKey?1:0,a+=t.ctrlKey?2:0,a+=t.metaKey?4:0;for(var s=0,o=r.length;s<o;s++)if(a===r[s].modifiers){switch(t.preventDefault(),r[s].param){case 0:case"ZOOM":e.dispatchEvent(cf),E(t),e.dispatchEvent(hf);break;case 1:case"ZOOM_AT_POINTER":e.dispatchEvent(cf),T(t),e.dispatchEvent(hf)}return}}}function F(t){!1!==e.enabled&&!1!==e.enablePan&&function(t){let n=!1;switch(l.set(0,0),c.set(0,0),t.code){case e.keys.UP:c.y=e.keyPanSpeed/(e.scene.windowHeight/2),n=!0;break;case e.keys.BOTTOM:c.y=-e.keyPanSpeed/(e.scene.windowHeight/2),n=!0;break;case e.keys.LEFT:c.x=-e.keyPanSpeed/(e.scene.windowWidth/2),n=!0;break;case e.keys.RIGHT:c.x=e.keyPanSpeed/(e.scene.windowWidth/2),n=!0}let i=!1;n&&(i=y(),t.preventDefault()),i&&e.dispatchEvent(lf)}(t)}function z(t){!1!==e.enabled&&t.preventDefault()}function k(t){let e=m[t.pointerId];void 0===e&&(e=new Ti,m[t.pointerId]=e),e.set(t.clientX,t.clientY)}function B(t){const e=t.pointerId===p[0].pointerId?p[1]:p[0];return m[e.pointerId]}e.domElement.addEventListener("contextmenu",z),e.domElement.addEventListener("pointerdown",D),e.domElement.addEventListener("pointercancel",O),e.domElement.addEventListener("wheel",U,{passive:!1}),e.listenToKeyEvents(window)}}const uf={type:"change"},pf={type:"zoom"},mf={type:"zoomEnd"},ff={type:"start"},gf={type:"end"};class vf extends mi{constructor(t){super(),void 0===t&&console.warn('AVS.Three.PanInteractor: The first parameter "domElement" is now mandatory.'),t===document&&console.error('AVS.Three.PanInteractor: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.isPanInteractor=!0,this.domElement=t,this.domElement.style.touchAction="none",this.object=new Er,this.linkObjectsBottom=[],this.linkObjectsTop=[],this.linkObjectsLeft=[],this.linkObjectsRight=[],this.linkObjectsBottomStatic=[],this.linkObjectsTopStatic=[],this.linkObjectsLeftStatic=[],this.linkObjectsRightStatic=[],this.leftLimit=0,this.rightLimit=0,this.topLimit=0,this.bottomLimit=0,this.domElement=t,this.enabled=!0,this.enableZoom=!0,this.zoomSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.enableKeys=!0,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:bt.PAN,MIDDLE:bt.NONE,RIGHT:bt.NONE},this.touches={ONE:Mt,TWO:wt},this._domElementKeyEvents=null,this.listenToKeyEvents=function(t){t.addEventListener("keydown",L),this._domElementKeyEvents=t},this.saveState=function(){a.copy(r),l.copy(o)},this.reset=function(){o.equals(l)?(r.copy(a),e.update()):(o.copy(l),p.set(-1,-1),r.copy(a),T()),i=n.NONE},this.update=function(t=!0){if(void 0!==e.object&&void 0!==e.object.landscapeDiv){r.x>e.leftLimit?r.x=e.leftLimit:r.x<e.rightLimit&&(r.x=e.rightLimit),r.y<e.bottomLimit?r.y=e.bottomLimit:r.y>e.topLimit&&(r.y=e.topLimit),e.object.panOffsetX=r.x,e.object.panOffsetY=r.y,e.object.landscapeDiv.style.left=e.object.baseLeft+r.x+"px",e.object.landscapeDiv.style.top=e.object.baseTop+r.y+"px";for(let t=0,n=e.linkObjectsBottom.length;t<n;t++){const n=e.linkObjectsBottom[t];n.panOffsetX=r.x,n.landscapeDiv.style.left=n.baseLeft+r.x+"px"}for(let t=0,n=e.linkObjectsBottomStatic.length;t<n;t++)e.linkObjectsBottomStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetX=-r.x,t.moveText())}));for(let t=0,n=e.linkObjectsTop.length;t<n;t++){const n=e.linkObjectsTop[t];n.panOffsetX=r.x,n.landscapeDiv.style.left=n.baseLeft+r.x+"px"}for(let t=0,n=e.linkObjectsTopStatic.length;t<n;t++)e.linkObjectsTopStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetX=-r.x,t.moveText())}));for(let t=0,n=e.linkObjectsLeft.length;t<n;t++){const n=e.linkObjectsLeft[t];n.panOffsetY=r.y,n.landscapeDiv.style.top=n.baseTop+r.y+"px"}for(let t=0,n=e.linkObjectsLeftStatic.length;t<n;t++)e.linkObjectsLeftStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetY=-r.y,t.moveText())}));for(let t=0,n=e.linkObjectsRight.length;t<n;t++){const n=e.linkObjectsRight[t];n.panOffsetY=r.y,n.landscapeDiv.style.top=n.baseTop+r.y+"px"}for(let t=0,n=e.linkObjectsRightStatic.length;t<n;t++)e.linkObjectsRightStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetY=-r.y,t.moveText())}));t&&(uf.detail={widthZoomLevel:o.x,heightZoomLevel:o.y,panX:-r.x,panY:-r.y},e.dispatchEvent(uf)),p.set(-1,-1)}},this.restorePanOffset=function(t){p.x<0||(r.x=p.x-t.zoomOffsetLeft-Math.floor(t.centerWidth*m.x),r.y=p.y-t.zoomOffsetTop-Math.floor(t.centerHeight*m.y),e.update(!1))},this.clear=function(){this.linkObjectsBottom=[],this.linkObjectsTop=[],this.linkObjectsLeft=[],this.linkObjectsRight=[],this.linkObjectsBottomStatic=[],this.linkObjectsTopStatic=[],this.linkObjectsLeftStatic=[],this.linkObjectsRightStatic=[]},this.setWidthZoomLevel=function(t){t<100||(o.x,o.x=t,o.x>c&&(o.x=c),o.x)},this.setHeightZoomLevel=function(t){t<100||(o.y,o.y=t,o.y>c&&(o.y=c),o.y)},this.setMaximumZoomLevel=function(t){t<100||(c=t,(o.x>c||o.y>c)&&(o.x>c&&(o.x=c),o.y>c&&(o.y=c)))},this.dispose=function(){e.domElement.removeEventListener("contextmenu",D),e.domElement.removeEventListener("pointerdown",A),e.domElement.removeEventListener("pointercancel",I),e.domElement.removeEventListener("wheel",P),e.domElement.removeEventListener("pointermove",C),e.domElement.removeEventListener("pointerup",R),null!==e._domElementKeyEvents&&e._domElementKeyEvents.removeEventListener("keydown",L)};const e=this,n={NONE:-1,PAN:2,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5};let i=n.NONE;const r=new Ci,a=r.clone(),s=new Ti,o=new Ti(100,100),l=o.clone();let c=1e6;const h=new Ti,d=new Ti,u=new Ti,p=new Ti(-1,-1),m=new Ti,f=new Ti,g=new Ti,v=new Ti,_=[],y={};let x;function b(){return Math.pow(.95,e.zoomSpeed)}function S(){let t=!1;return o.x<100||o.y<100?(o.y<o.x?(o.x=100*o.x/o.y,o.y=100):(o.y=100*o.y/o.x,o.x=100),t=!0):(o.x>c||o.y>c)&&(o.y>o.x?(o.x=c*o.x/o.y,o.y=c):(o.y=c*o.y/o.x,o.x=c),t=!0),t}function M(t,e){var n;n=t,r.x+=n,function(t){r.y+=t}(e)}function w(t){o.multiplyScalar(t)}function E(t,n){if(!o.equals(s)){const i=e.domElement.getBoundingClientRect();p.x=Math.round(t-i.left),p.y=Math.round(n-i.top),p.x<e.object.windowX?p.x=e.object.windowX:p.x>e.object.windowX+e.object.windowWidth&&(p.x=e.object.windowX+e.object.windowWidth),p.y<e.object.windowTop?p.y=e.object.windowTop:p.y>e.object.windowTop+e.object.windowHeight&&(p.y=e.object.windowTop+e.object.windowHeight),m.x=(p.x-e.object.panOffsetX-e.object.zoomOffsetLeft)/e.object.centerWidth,m.y=(p.y-e.object.panOffsetY-e.object.zoomOffsetTop)/e.object.centerHeight,T()}}function T(){mf.detail={widthZoomLevel:o.x,heightZoomLevel:o.y},e.dispatchEvent(mf),s.copy(o)}function A(t){!1!==e.enabled&&(0===_.length&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",C),e.domElement.addEventListener("pointerup",R)),function(t){_.push(t)}(t),"touch"===t.pointerType?function(t){switch(O(t),_.length){case 1:if(e.touches.ONE===Mt){if(!1===e.enablePan)return;h.set(_[0].clientX,_[0].clientY),i=n.TOUCH_PAN}else i=n.NONE;break;case 2:if(e.touches.TWO===wt){if(!1===e.enableZoom)return;!function(){const t=_[0].clientX-_[1].clientX,e=_[0].clientY-_[1].clientY,n=Math.sqrt(t*t+e*e);f.set(0,n)}(),i=n.TOUCH_DOLLY_PAN}else i=n.NONE;break;default:i=n.NONE}i!==n.NONE&&e.dispatchEvent(ff)}(t):function(t){let r;switch(t.preventDefault(),t.button){case 0:r=e.mouseButtons.LEFT;break;case 1:r=e.mouseButtons.MIDDLE;break;case 2:r=e.mouseButtons.RIGHT;break;default:r=-1}if(r===bt.PAN){if(!1===e.enablePan)return;!function(t){h.set(t.clientX,t.clientY)}(t),i=n.PAN,e.domElement.ownerDocument.body.style.cursor="move"}else i=n.NONE;i!==n.NONE&&e.dispatchEvent(ff)}(t))}function C(t){!1!==e.enabled&&("touch"===t.pointerType?function(t){switch(O(t),i){case n.TOUCH_PAN:if(!1===e.enablePan)return;!function(t){d.set(t.clientX,t.clientY),u.subVectors(d,h).multiplyScalar(e.panSpeed),M(u.x,u.y),h.copy(d)}(t),e.update();break;case n.TOUCH_DOLLY_PAN:if(!1===e.enableZoom)return;!function(t){clearTimeout(x);const n=function(t){const e=t.pointerId===_[0].pointerId?_[1]:_[0];return y[e.pointerId]}(t),i=t.clientX-n.x,r=t.clientY-n.y,a=Math.sqrt(i*i+r*r);g.set(0,a),v.set(0,Math.pow(g.y/f.y,e.zoomSpeed)),w(v.y),f.copy(g);const s=.5*(t.clientX+n.x),o=.5*(t.clientY+n.y);S()?E(s,o):x=setTimeout(E,300,s,o)}(t);break;default:i=n.NONE}}(t):function(t){if(!1!==e.enabled&&(t.preventDefault(),i===n.PAN)){if(!1===e.enablePan)return;!function(t){d.set(t.clientX,t.clientY),u.subVectors(d,h).multiplyScalar(e.panSpeed),M(u.x,u.y),h.copy(d),e.update()}(t)}}(t))}function R(t){N(t),0===_.length&&(e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",C),e.domElement.removeEventListener("pointerup",R)),e.domElement.ownerDocument.body.style.cursor="default",e.dispatchEvent(gf),i=n.NONE}function I(t){N(t)}function P(t){!1!==e.enabled&&!1!==e.enableZoom&&i===n.NONE&&(t.preventDefault(),e.dispatchEvent(ff),function(t){var n;clearTimeout(x),t.deltaY<0?(n=b(),o.divideScalar(n)):t.deltaY>0&&w(b());const i=S();pf.detail={widthZoomLevel:o.x,heightZoomLevel:o.y,clientX:t.clientX,clientY:t.clientY},e.dispatchEvent(pf),i?E(t.clientX,t.clientY):x=setTimeout(E,300,t.clientX,t.clientY)}(t),e.dispatchEvent(gf))}function L(t){!1!==e.enabled&&!1!==e.enablePan&&function(t){let n=!1;switch(t.code){case e.keys.UP:M(0,e.keyPanSpeed),n=!0;break;case e.keys.BOTTOM:M(0,-e.keyPanSpeed),n=!0;break;case e.keys.LEFT:M(e.keyPanSpeed,0),n=!0;break;case e.keys.RIGHT:M(-e.keyPanSpeed,0),n=!0}n&&(t.preventDefault(),e.update())}(t)}function D(t){!1!==e.enabled&&t.preventDefault()}function N(t){delete y[t.pointerId];for(let e=0;e<_.length;e++)if(_[e].pointerId==t.pointerId)return void _.splice(e,1)}function O(t){let e=y[t.pointerId];void 0===e&&(e=new Ti,y[t.pointerId]=e),e.set(t.clientX,t.clientY)}e.domElement.addEventListener("contextmenu",D),e.domElement.addEventListener("pointerdown",A),e.domElement.addEventListener("pointercancel",I),e.domElement.addEventListener("wheel",P,{passive:!1}),e.listenToKeyEvents(window)}}const _f={type:"change"},yf={type:"start"},xf={type:"end"};class bf extends mi{constructor(t){super(),void 0===t&&console.warn('AVS.Three.ZoomRectangleInteractor: The first parameter "domElement" is now mandatory.'),t===document&&console.error('AVS.Three.ZoomRectangleInteractor: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.isZoomRectangleInteractor=!0,this.domElement=t,this.domElement.style.touchAction="none",this.object=new Er,this.scene=null,this.enabled=!0,this.position=this.object.position.clone(),this.scale=this.object.scale.clone(),this.clientOnly=!1,this.fullReset=!1,this.scale0=this.object.scale.clone(),this.position0=this.object.position.clone(),this.setObjectScene=function(t,n){switch(e.object=t,e.scene=n,this.fullReset||t.internalData.zoomRectangleFullReset?(e.scale.copy(e.object.scale),e.position.copy(e.object.position),e.scale0.copy(e.object.scale),e.position0.copy(e.object.position),this.fullReset=!1):e.clientOnly&&(e.object.scale.copy(e.scale),e.object.position.copy(e.position)),t.internalData.zoomRectangleTriggers&&(s=JSON.parse(t.internalData.zoomRectangleTriggers)),i=t.internalData.zoomInMaxLimit,r=t.internalData.zoomOutMaxLimit,c=void 0!==t.internalData.zoomRectangleColor?"#"+t.internalData.zoomRectangleColor.toString(16).padStart(6,"0"):null,h=t.internalData.zoomRectangleWidth?t.internalData.zoomRectangleWidth:null,t.internalData.zoomRectanglePattern){case 0:d=[];break;case 1:d=[4,4];break;case 2:d=[1,3];break;case 3:d=[5,1,1,1];break;default:d=null}const a=document.createElement("canvas");a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.id=e.scene.name+"RectCanvas",a.width=e.scene.windowWidth,a.height=e.scene.windowHeight,e.scene.windowDiv.appendChild(a),e.scene.rectCanvas=a,e.scene.rectCtx=a.getContext("2d")},this.reset=function(){e.scale.copy(e.scale0),e.position.copy(e.position0),e.object.scale.copy(e.scale0),e.object.position.copy(e.position0),e.dispatchEvent(_f),a=n.NONE},this.dispose=function(){e.domElement.removeEventListener("contextmenu",w),e.domElement.removeEventListener("pointerdown",x),e.domElement.removeEventListener("pointercancel",M),e.domElement.removeEventListener("pointermove",b),e.domElement.removeEventListener("pointerup",S)};const e=this,n={NONE:-1,ZOOM_IN:0,ZOOM_OUT:1};let i,r,a=n.NONE,s=[{buttons:1,modifiers:0,param:"ZOOM_IN"},{buttons:1,modifiers:1,param:"ZOOM_OUT"}],o=0;const l=[];let c=null,h=null,d=null;const u=new Ti,p=new Ti,m=[],f={};function g(t){return Math.max(0,Math.min(t.clientX-e.scene.windowDiv.getBoundingClientRect().left,e.scene.windowWidth))}function v(t){return Math.max(0,Math.min(t.clientY-e.scene.windowDiv.getBoundingClientRect().top,e.scene.windowHeight))}const _=function(){const t=new Ki,s=new Ki,o=new qi,l=new qi,c=new Ci,h=new qi,d=new Ci;return function(u,p,m,f){const g=e.scene.windowWidth/(p-u),v=e.scene.windowHeight/(f-m);t.multiplyMatrices(e.scene.camera.matrixWorldInverse,e.object.parent.matrixWorld),t.premultiply(e.scene.camera.projectionMatrix),o.set(0,0,0,1).applyMatrix4(t),s.copy(t).invert();let _=1;if(a===n.ZOOM_IN){if(_=v<g?v:g,void 0!==i){const t=Math.max(Math.max(e.object.scale.x,e.object.scale.y),e.object.scale.z);_*t>i&&(_=i/t)}const t=(u+p)/e.scene.windowWidth-1,n=1-(m+f)/e.scene.windowHeight;l.set(t,n,o.z/o.w,1).applyMatrix4(s),c.set(l.x/l.w,l.y/l.w,l.z/l.w),h.set(0,0,o.z/o.w,1).applyMatrix4(s),d.set(h.x/h.w,h.y/h.w,h.z/h.w),c.sub(e.object.position),d.sub(e.object.position),c.multiplyScalar(_).sub(d),e.object.position.sub(c)}else if(a===n.ZOOM_OUT){if(_=v>g?1/v:1/g,void 0!==r){const t=Math.max(Math.max(e.object.scale.x,e.object.scale.y),e.object.scale.z);_*t<1/r&&(_=1/r/t)}l.set(0,0,o.z/o.w,1).applyMatrix4(s),c.set(l.x/l.w,l.y/l.w,l.z/l.w),c.sub(e.object.position),d.copy(c),c.multiplyScalar(_).sub(d),e.object.position.sub(c)}return e.object.scale.multiplyScalar(_),!0}}();function y(t){u.set(g(t),v(t));const n=window.getComputedStyle(e.scene.rectCanvas);let i="#ff0000";const r=n.getPropertyValue("--avs-drag-rectangle-stroke-style").trim();null!==c?i=c:null!==r&&r.length>0&&(i=r),e.scene.rectCtx.strokeStyle=i;let a=1;const s=n.getPropertyValue("--avs-drag-rectangle-line-width").trim();null!==h?a=h:null!==s&&s.length>0&&(a=s),e.scene.rectCtx.lineWidth=a;let p=l;const m=n.getPropertyValue("--avs-drag-rectangle-line-dash").trim();null!==d?p=d:null!==m&&m.length>0&&(p=JSON.parse(m)),e.scene.rectCtx.setLineDash(p),o=1}function x(t){!1!==e.enabled&&(0===m.length&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",b),e.domElement.addEventListener("pointerup",S)),function(t){m.push(t)}(t),function(t){let i=0;i+=t.shiftKey?1:0,i+=t.ctrlKey?2:0,i+=t.metaKey?4:0;let r=0;switch(t.button){case 0:r=1;break;case 1:r=2;break;case 2:r=4}for(let o=0,l=s.length;o<l;o++)if(i===s[o].modifiers&&r&s[o].buttons){switch(s[o].param){case 1:case"ZOOM_IN":y(t),a=n.ZOOM_IN,e.domElement.ownerDocument.body.style.cursor="zoom-in";break;case 2:case"ZOOM_OUT":y(t),a=n.ZOOM_OUT,e.domElement.ownerDocument.body.style.cursor="zoom-out";break;default:a=n.NONE}a!==n.NONE&&e.dispatchEvent(yf);break}}(t))}function b(t){!1!==e.enabled&&function(t){!1!==e.enabled&&function(t){if(o<1)return;if(p.set(g(t),v(t)),e.scene.rectCtx.clearRect(0,0,e.scene.windowWidth,e.scene.windowHeight),1==o){const t=Math.abs(u.x-p.x),e=Math.abs(u.y-p.y);if(t*t+e*e<25)return;o=2}const n=Math.min(u.x,p.x),i=Math.max(u.x,p.x),r=Math.min(u.y,p.y),a=Math.max(u.y,p.y);e.scene.rectCtx.strokeRect(n+.5,r+.5,i-n,a-r)}(t)}(t)}function S(t){!1!==e.enabled&&(function(t){(function(t){if(o<2)return;p.set(g(t),v(t)),e.scene.rectCtx.clearRect(0,0,e.scene.windowWidth,e.scene.windowHeight);const n=Math.min(u.x,p.x),i=Math.max(u.x,p.x),r=Math.min(u.y,p.y),a=Math.max(u.y,p.y);_(n,i,r,a)&&(e.scale.copy(e.object.scale),e.position.copy(e.object.position),e.dispatchEvent(_f)),o=0})(t),e.domElement.ownerDocument.body.style.cursor="default",e.dispatchEvent(xf),a=n.NONE}(t),E(t),0===m.length&&(e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",b),e.domElement.removeEventListener("pointerup",S)))}function M(t){E(t)}function w(t){!1!==e.enabled&&t.preventDefault()}function E(t){delete f[t.pointerId];for(let e=0;e<m.length;e++)if(m[e].pointerId==t.pointerId)return void m.splice(e,1)}e.domElement.addEventListener("contextmenu",w),e.domElement.addEventListener("pointerdown",x),e.domElement.addEventListener("pointercancel",M)}}const Sf={type:"change"},Mf={type:"start"},wf={type:"end"};class Ef extends mi{constructor(t){super(),this.hasStyleAnimations=!1,this.hasObjectAnimations=!1,this.createAnimationLibrary(),this.animating=0,this.mixers=[]}createAnimationLibrary(){const t=[0,2],e=new Yc(".material.opacityFactor",t,[0,1]),n=new Xc(".material.transparent",t,[!0,!1]);this.fadeInClip=new Qc("fade-in",-1,[e,n]),this.fadeInClip.setOnChildren=!0;const i=new Yc(".material.opacityFactor",t,[1,0]),r=new Xc(".material.transparent",t,[!0,!0]);this.fadeOutClip=new Qc("fade-out",-1,[i,r]),this.fadeOutClip.setOnChildren=!0;const a=new Yc(".scaleFactorX",t,[0,1]);this.growXClip=new Qc("grow-x",-1,[a]);const s=new Yc(".scaleFactorY",t,[0,1]);this.growYClip=new Qc("grow-y",-1,[s]);const o=new Yc(".scaleFactorZ",t,[0,1]);this.growZClip=new Qc("grow-z",-1,[o]);const l=new Yc(".material.glyphScaleFactorX",t,[0,1]);this.growXGlyphClip=new Qc("grow-x-glyph",-1,[l]),this.growXGlyphClip.setOnChildren=!0;const c=new Yc(".material.glyphScaleFactorY",t,[0,1]);this.growYGlyphClip=new Qc("grow-y-glyph",-1,[c]),this.growYGlyphClip.setOnChildren=!0;const h=new Yc(".material.glyphScaleFactorZ",t,[0,1]);this.growZGlyphClip=new Qc("grow-z-glyph",-1,[h]),this.growZGlyphClip.setOnChildren=!0;const d=new Xc(".visible",t,[!1,!0]);this.enterAfterClip=new Qc("enter-after",-1,[d]),this.enterAfterClip.setOnChildren=!0}setStyleMap(t){if(this.hasStyleAnimations=!1,void 0===t)return;const e=["scene","sceneTitle","chart","chartTitle","axis","legend","legendTitle","glyph","transform"];this.styleAnimationClips={},this.transformAnimations=void 0;for(let n=0,i=e.length;n<i;n++){const i=e[n];void 0!==t[i]&&(i.startsWith("transform")?this.transformAnimations=JSON.parse(t[i]):this.styleAnimationClips[i]=this.fillStyleClipsArray(t[i].split(","),"glyph"===i))}}fillStyleClipsArray(t,e){const n=[];for(let i=0,r=t.length;i<r;i++){const r=t[i].trim();"fade-in"===r?(n.push(this.fadeInClip),this.hasStyleAnimations=!0):"fade-out"===r?(n.push(this.fadeOutClip),this.hasStyleAnimations=!0):"grow-x"===r?(n.push(e?this.growXGlyphClip:this.growXClip),this.hasStyleAnimations=!0):"grow-y"===r?(n.push(e?this.growYGlyphClip:this.growYClip),this.hasStyleAnimations=!0):"grow-z"===r?(n.push(e?this.growZGlyphClip:this.growZClip),this.hasStyleAnimations=!0):"enter-after"===r&&(n.push(this.enterAfterClip),this.hasStyleAnimations=!0)}return n}fillObjectClipsArray(t,e){const n=[];return!!(1&t)&&(n.push(this.fadeInClip),this.hasObjectAnimations=!0),!!(2&t)&&(n.push(this.fadeOutClip),this.hasObjectAnimations=!0),!!(4&t)&&(n.push(e?this.growXGlyphClip:this.growXClip),this.hasObjectAnimations=!0),!!(8&t)&&(n.push(e?this.growYGlyphClip:this.growYClip),this.hasObjectAnimations=!0),!!(16&t)&&(n.push(e?this.growZGlyphClip:this.growZClip),this.hasObjectAnimations=!0),!!(32&t)&&(n.push(this.enterAfterClip),this.hasObjectAnimations=!0),n}hasAnimations(){return this.hasStyleAnimations||this.hasObjectAnimations||this.transformAnimations}clear(){this.mixers=[],this.hasObjectAnimations=!1}attach(t){const e=this,n=this.createMixers.bind(this);this.createMixers(t,this.styleAnimationClips.scene),t.traverse((function(t){if(t.internalData.animations){const i=e.fillObjectClipsArray(t.internalData.animations,"GLYPH"===t.internalData.visualizationGroup);n(t,i)}if(t.internalData.attachTransformInteractor&&e.transformAnimations){const i=new Ci,r=new Ai,a=new lr,s=new Ci;t.matrix.decompose(i,r,s);const o=[],l=[],c=[],h=[];let d=!1;for(let t=0,n=e.transformAnimations.length;t<n;t++){const n=e.transformAnimations[t];void 0===n.time&&(console.error("AVS.Three.Animator: Missing time value from transform animation index "+t),d=!0),o.push(n.time/1e3),void 0!==n.position&&i.set(n.position[0],n.position[1],n.position[2]),l.push(i.x),l.push(i.y),l.push(i.z),void 0!==n.scale&&s.set(n.scale/100,n.scale/100,n.scale/100),h.push(s.x),h.push(s.y),h.push(s.z),void 0!==n.rotation&&(a.set(n.rotation[0]*Math.PI/180,n.rotation[1]*Math.PI/180,n.rotation[2]*Math.PI/180,n.rotation[3]),r.setFromEuler(a)),c.push(r.x),c.push(r.y),c.push(r.z),c.push(r.w)}if(!d){const e=new Kc(".position",o,l),i=new $c(".quaternion",o,c),r=new Kc(".scale",o,h),a=new Qc("transform",-1,[e,i,r]);n(t,[a])}}"SCENE_TITLE"===t.internalData.visualizationGroup&&n(t,e.styleAnimationClips.sceneTitle),"CHART"===t.internalData.visualizationGroup&&n(t,e.styleAnimationClips.chart),"CHART_TITLE"===t.internalData.visualizationGroup&&n(t,e.styleAnimationClips.chartTitle),"AXIS"===t.internalData.visualizationGroup&&n(t,e.styleAnimationClips.axis),"LEGEND"===t.internalData.visualizationGroup&&n(t,e.styleAnimationClips.legend),"LEGEND_TITLE"===t.internalData.visualizationGroup&&n(t,e.styleAnimationClips.legendTitle),"GLYPH"===t.internalData.visualizationGroup&&n(t,e.styleAnimationClips.glyph)}))}createMixers(t,e){if(void 0!==e)for(let n=0,i=e.length;n<i;n++){let i;if(e[n].setOnChildren?t.traverse((function(t){t.material&&(void 0===i&&(i=new rd),i.add(t))})):i=t,void 0!==i){const t=new od(i);t.clip=e[n],this.mixers.push(t)}}}play(){this.mixers.length<=0&&(this.dispatchEvent(Mf),this.dispatchEvent(Sf),this.dispatchEvent(wf)),this.animating=0,this.finishedFunc=this.animationFinished.bind(this);for(let t=0,e=this.mixers.length;t<e;t++){const e=this.mixers[t];e.addEventListener("finished",this.finishedFunc);const n=e.clipAction(e.clip);e.action=n,n.repetitions=1,n.clampWhenFinished=!0,n.play(),this.animating++}this.dispatchEvent(Mf),this.timer=new Yh,this.animate()}animationFinished(t){t.target.removeEventListener("finished",this.finishedFunc),this.animating--}animate(){if(this.animating<=0)return void this.dispatchEvent(wf);requestAnimationFrame(this.animate.bind(this)),this.timer.update();const t=this.timer.getDelta();for(let e=0,n=this.mixers.length;e<n;e++)this.mixers[e].action.isRunning()&&this.mixers[e].update(t);this.dispatchEvent(Sf)}}
|
|
121
121
|
/**
|
|
@@ -335,7 +335,7 @@ var Af=function(t,e,n,i){var r,a=arguments.length,s=a<3?e:null===i?i=Object.getO
|
|
|
335
335
|
<div id="spinner"></div>
|
|
336
336
|
</div>
|
|
337
337
|
<div id="tooltip"></div>
|
|
338
|
-
`}_rectangleStyle(){this.rectCtx.setLineDash([3]),this.rectCtx.strokeStyle="#ff0000"}_assembleModel(t){if(!this.sceneName)return void this._dispatchErrorEvent("'scene-name' property must be set to the name of the scene registered in the library map on the AVS/Go server.");if(!this.width||!this.height)return;const e={sceneProperties:{name:this.sceneName}};if(this.sceneUserProperties){let t;try{t=JSON.parse(this.sceneUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'scene-user-properties'. "+t.message)}e.sceneProperties.userProperties=t}const n={width:this.width,height:this.height,name:this.rendererName,type:this.renderer};if(this.rendererUserProperties){let t;try{t=JSON.parse(this.rendererUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'renderer-user-properties'. "+t.message)}n.userProperties=t}e.rendererProperties=n,this.transformInteractor&&(this.transformMatrix=this.transformInteractor.object.matrix.elements.slice()),this.transformMatrix&&!this.transformClientOnly&&(n.transformMatrix=this.transformMatrix),t&&(this.transformClientOnly&&this.transformInteractor?this.transformInteractor.fullReset=t:n.fullReset=!0),this.panEnable&&(n.panProperties={widthZoomLevel:Math.min(this.panWidthZoomLevel,this.panMaximumZoomLevel),heightZoomLevel:Math.min(this.panHeightZoomLevel,this.panMaximumZoomLevel)}),n.themeName=this.themeName;var i=window.getComputedStyle(this,null),r=i.getPropertyValue("background-color").trim(),a=i.getPropertyValue("color").trim(),s=i.getPropertyValue("font-family").trim().replace(/['"]+/g,"");if(n.cssProperties={sceneBackgroundType:"Solid",sceneBackgroundColor:r,sceneLineColor:a,sceneTextColor:a,sceneFontFamily:s,sceneSurfaceColor:a},this._applyCustomCssProperties(n.cssProperties,i,{sceneBackgroundType:"--avs-scene-background-type",sceneBackgroundColor:"--avs-scene-background-color",sceneBackgroundStartColor:"--avs-scene-background-start-color",sceneBackgroundEndColor:"--avs-scene-background-end-color",sceneBackgroundGradientStyle:"--avs-scene-background-gradient-style",sceneBackgroundGradientInterpolation:"--avs-scene-background-gradient-interpolation",sceneBackgroundGradientColorRepeat:"--avs-scene-background-gradient-color-repeat",sceneHighlightColor:"--avs-scene-highlight-color",sceneSurfaceColor:"--avs-scene-surface-color",scenePointColor:"--avs-scene-point-color",sceneLineColor:"--avs-scene-line-color",sceneLineWidth:"--avs-scene-line-width",sceneTextColor:"--avs-scene-text-color",sceneTextRotation:"--avs-scene-text-rotation",sceneFontFamily:"--avs-scene-font-family",sceneFontStyle:"--avs-scene-font-style",sceneFontWeight:"--avs-scene-font-weight",sceneFontSize:"--avs-scene-font-size",sceneTitleTextColor:"--avs-scene-title-text-color",sceneTitleTextRotation:"--avs-scene-title-text-rotation",sceneTitleFontFamily:"--avs-scene-title-font-family",sceneTitleFontStyle:"--avs-scene-title-font-style",sceneTitleFontWeight:"--avs-scene-title-font-weight",sceneTitleFontSize:"--avs-scene-title-font-size",chartBackgroundType:"--avs-chart-background-type",chartBackgroundColor:"--avs-chart-background-color",chartBackgroundStartColor:"--avs-chart-background-start-color",chartBackgroundEndColor:"--avs-chart-background-end-color",chartBackgroundGradientStyle:"--avs-chart-background-gradient-style",chartBackgroundGradientInterpolation:"--avs-chart-background-gradient-interpolation",chartBackgroundGradientColorRepeat:"--avs-chart-background-gradient-color-repeat",chartHighlightColor:"--avs-chart-highlight-color",chartSurfaceColor:"--avs-chart-surface-color",chartPointColor:"--avs-chart-point-color",chartLineColor:"--avs-chart-line-color",chartLineWidth:"--avs-chart-line-width",chartLinePattern:"--avs-chart-line-pattern",chartTextColor:"--avs-chart-text-color",chartTextRotation:"--avs-chart-text-rotation",chartFontFamily:"--avs-chart-font-family",chartFontStyle:"--avs-chart-font-style",chartFontWeight:"--avs-chart-font-weight",chartFontSize:"--avs-chart-font-size",chartTitleTextColor:"--avs-chart-title-text-color",chartTitleTextRotation:"--avs-chart-title-text-rotation",chartTitleFontFamily:"--avs-chart-title-font-family",chartTitleFontStyle:"--avs-chart-title-font-style",chartTitleFontWeight:"--avs-chart-title-font-weight",chartTitleFontSize:"--avs-chart-title-font-size",axisLineColor:"--avs-axis-line-color",axisLineWidth:"--avs-axis-line-width",axisTextColor:"--avs-axis-text-color",axisTextRotation:"--avs-axis-text-rotation",axisFontFamily:"--avs-axis-font-family",axisFontStyle:"--avs-axis-font-style",axisFontWeight:"--avs-axis-font-weight",axisFontSize:"--avs-axis-font-size",axisAxleColor:"--avs-axis-axle-color",axisAxleWidth:"--avs-axis-axle-width",axisMajorTickMarkColor:"--avs-axis-major-tick-mark-color",axisMajorTickMarkWidth:"--avs-axis-major-tick-mark-width",axisMajorTickLineColor:"--avs-axis-major-tick-line-color",axisMajorTickLineWidth:"--avs-axis-major-tick-line-width",axisMajorTickLineStyle:"--avs-axis-major-tick-line-style",axisMajorUnlabeledTickMarkColor:"--avs-axis-major-unlabeled-tick-mark-color",axisMajorUnlabeledTickMarkWidth:"--avs-axis-major-unlabeled-tick-mark-width",axisMajorUnlabeledTickLineColor:"--avs-axis-major-unlabeled-tick-line-color",axisMajorUnlabeledTickLineWidth:"--avs-axis-major-unlabeled-tick-line-width",axisMajorUnlabeledTickLineStyle:"--avs-axis-major-unlabeled-tick-line-style",axisMinorTickMarkColor:"--avs-axis-minor-tick-mark-color",axisMinorTickMarkWidth:"--avs-axis-minor-tick-mark-width",axisMinorTickLineColor:"--avs-axis-minor-tick-line-color",axisMinorTickLineWidth:"--avs-axis-minor-tick-line-width",axisMinorTickLineStyle:"--avs-axis-minor-tick-line-style",axisTitleTextColor:"--avs-axis-title-text-color",axisTitleTextRotation:"--avs-axis-title-text-rotation",axisTitleFontFamily:"--avs-axis-title-font-family",axisTitleFontStyle:"--avs-axis-title-font-style",axisTitleFontWeight:"--avs-axis-title-font-weight",axisTitleFontSize:"--avs-axis-title-font-size",axisUnitTextColor:"--avs-axis-unit-text-color",axisUnitTextRotation:"--avs-axis-unit-text-rotation",axisUnitFontFamily:"--avs-axis-unit-font-family",axisUnitFontStyle:"--avs-axis-unit-font-style",axisUnitFontWeight:"--avs-axis-unit-font-weight",axisUnitFontSize:"--avs-axis-unit-font-size",axisLabelTextColor:"--avs-axis-label-text-color",axisLabelTextRotation:"--avs-axis-label-text-rotation",axisLabelFontFamily:"--avs-axis-label-font-family",axisLabelFontStyle:"--avs-axis-label-font-style",axisLabelFontWeight:"--avs-axis-label-font-weight",axisLabelFontSize:"--avs-axis-label-font-size",legendBackgroundColor:"--avs-legend-background-color",legendTextColor:"--avs-legend-text-color",legendTextRotation:"--avs-legend-text-rotation",legendFontFamily:"--avs-legend-font-family",legendFontStyle:"--avs-legend-font-style",legendFontWeight:"--avs-legend-font-weight",legendFontSize:"--avs-legend-font-size",legendPointColor:"--avs-legend-point-color",legendTitleTextColor:"--avs-legend-title-text-color",legendTitleTextRotation:"--avs-legend-title-text-rotation",legendTitleFontFamily:"--avs-legend-title-font-family",legendTitleFontStyle:"--avs-legend-title-font-style",legendTitleFontWeight:"--avs-legend-title-font-weight",legendTitleFontSize:"--avs-legend-title-font-size"}),this.dataSourceName&&(e.dataSourceProperties={name:this.dataSourceName},this.dataSourceUserProperties)){let t;try{t=JSON.parse(this.dataSourceUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. "+t.message)}e.dataSourceProperties.userProperties=t}return this.threeViewer&&this.streamEnable&&(n.streamProperties={chunkSizeFirst:this.streamChunkSizeFirst,chunkSize:this.streamChunkSize}),e}_applyCustomCssProperties(t,e,n){for(var i in n)if(n.hasOwnProperty(i)){var r=e.getPropertyValue(n[i]).trim();r.length>0&&(t[i]=r)}}_onResize(t){this.width=Math.round(t.width),this.height=Math.round(t.height),this.rectCanvas&&(this.rectCanvas.width=this.width,this.rectCanvas.height=this.height),!this.urlLoadJsonFile&&!this.manualUpdate&&this.resizeThreshold>0&&(!this.lowResizeWidth||this.width<this.lowResizeWidth||this.width>this.highResizeWidth||this.height<this.lowResizeHeight||this.height>this.highResizeHeight)?(this._updateResizeLimits(),this.updateViewer()):this.threeViewer&&this.threeViewer.render(!0)}_updateResizeLimits(){this.lowResizeWidth=(100-this.resizeThreshold)/100*this.width,this.highResizeWidth=(100+this.resizeThreshold)/100*this.width,this.lowResizeHeight=(100-this.resizeThreshold)/100*this.height,this.highResizeHeight=(100+this.resizeThreshold)/100*this.height}showSpinner(){var t=window.getComputedStyle(this,null).getPropertyValue("--avs-spinner").trim().replace(/['"]+/g,"");t.length>0?fetch(t).then((t=>{if(t.ok)return t.text()})).then((t=>{this.renderRoot.querySelector("#spinner").innerHTML=t})).catch((t=>{this.renderRoot.querySelector("#spinner").innerHTML=Tf})):this.renderRoot.querySelector("#spinner").innerHTML=Tf,this.renderRoot.querySelector("#spinner").style.display="block"}hideSpinner(){this.renderRoot.querySelector("#spinner").style.display="none"}startSpinner(){this.renderRoot.querySelector("#spinner").className="spin"}stopSpinner(){this.renderRoot.querySelector("#spinner").className=""}updated(t){if(!["IMAGE","SVG","THREEJS"].includes(this.renderer))return void this._dispatchErrorEvent("'renderer' property must be 'IMAGE', 'SVG' or 'THREEJS'.");if(t.has("renderer")&&this._rendererChanged(this.renderer,t.renderer),t.has("transformEnable")&&this._transformEnableChanged(this.transformEnable,t.transformEnable),t.has("transformClientOnly")&&this._transformClientOnlyChanged(this.transformClientOnly,t.transformClientOnly),t.has("transformRotateDisable")&&this._transformRotateDisableChanged(this.transformRotateDisable,t.transformRotateDisable),t.has("transformZoomDisable")&&this._transformZoomDisableChanged(this.transformZoomDisable,t.transformZoomDisable),t.has("transformPanDisable")&&this._transformPanDisableChanged(this.transformPanDisable,t.transformPanDisable),t.has("animatedGlyphsVisible")&&this._animatedGlyphsVisibleChanged(this.animatedGlyphsVisible,t.animatedGlyphsVisible),t.has("animatedGlyphsEnable")&&this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable,t.animatedGlyphsEnable),(t.has("transformTwistAngle")||t.has("transformTiltAngle")||t.has("transformScale"))&&this._transformValueChanged(),t.has("animatedGlyphsEnable")&&this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable,t.animatedGlyphsEnable),t.has("zoomRectangleEnable")&&this._zoomRectangleEnableChanged(this.zoomRectangleEnable,t.zoomRectangleEnable),t.has("panEnable")&&this._panEnableChanged(this.panEnable,t.panEnable),t.has("panZoomEnable")&&this._panZoomEnableChanged(this.panZoomEnable,t.panZoomEnable),t.has("panWidthZoomLevel")&&this._panWidthZoomLevelChanged(this.panWidthZoomLevel,t.panWidthZoomLevel),t.has("panHeightZoomLevel")&&this._panHeightZoomLevelChanged(this.panHeightZoomLevel,t.panHeightZoomLevel),t.has("panMaximumZoomLevel")&&this._panMaximumZoomLevelChanged(this.panMaximumZoomLevel,t.panMaximumZoomLevel),t.has("trackEnable")&&this._trackEnableChanged(this.trackEnable,t.trackEnable),t.has("displayCanvas")&&this._displayCanvasChanged(this.displayCanvas,t.displayCanvas),t.has("motionCaptureControlsEnable")&&this._motionCaptureControlsEnableChanged(this.motionCaptureControlsEnable,t.motionCaptureControlsEnable),t.has("motionCapture")&&this._motionCaptureValueChanged(this.motionCapture,t.motionCapture),!this.url)return;let e=!1;this.manualUpdate?this.forceUpdate&&(e=!0):(this.forceUpdate||t.has("url")||t.has("renderer")||t.has("urlLoadJsonFile")||t.has("sceneName")||t.has("sceneUserProperties")||t.has("dataSourceName")||t.has("dataSourceUserProperties")||t.has("rendererName")||t.has("rendererUserProperties")||t.has("streamEnable")||this.panEnable&&t.has("panWidthZoomLevel")||this.panEnable&&t.has("panHeightZoomLevel"))&&(e=!0),e&&(this.forceUpdate=!1,this.urlLoadJsonFile?(this.chunkFile=0,this.showSpinner(),this.startSpinner(),this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this))):(this.model=this._assembleModel(),this.model&&(this.showSpinner(),this.startSpinner(),this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this),this.model))))}_handleHttpError(){this.hideSpinner()}updateViewer(){this.forceUpdate=!0,this.requestUpdate()}clear(){if(this.threeViewer)this.threeViewer.clearGeometry(),this.threeViewer.render();else if("SVG"===this.renderer)for(var t=this.svgDiv;t.firstChild;)t.removeChild(t.firstChild);else this.sceneImage.src="data:,";this.showSpinner()}_handleHttpResponse(t){if(t){if(t.selectionInfo&&this._dispatchPickEvents(t.selectionInfo),t.sceneInfo){this.dispatchEvent(new CustomEvent("avs-scene-info",{detail:t.sceneInfo}));const s=this.renderRoot.querySelector("#motionCapture"),o=this.renderRoot.querySelector("#zoomOverlay"),l=this.renderRoot.querySelector("#tooltip"),c=this.renderRoot.querySelector("#motionCaptureTooltip");if(t.sceneInfo.backgroundColor){var e=t.sceneInfo.backgroundColor.match(/[0-9.]+/gi),n=this.getInheritedBackgroundCol(this).trim().match(/[0-9.]+/gi),i=Number(e[0])*Number(e[3]),r=Number(e[1])*Number(e[3]),a=Number(e[2])*Number(e[3]);0==Number(e[3])&&(i+=n[0]*(1-Number(e[3])),r+=n[1]*(1-Number(e[3])),a+=n[2]*(1-Number(e[3]))),s.style.color="var(--avs-motion-capture-color, rgb("+i+", "+r+", "+a+"))",o.style.color="var(--avs-zoom-overlay-color, rgb("+i+","+r+","+a+"))",l.style.color="var(--avs-tooltip-color, rgb("+i+","+r+","+a+"))",c.style.color="var(--avs-tooltip-color, rgb("+i+","+r+","+a+"))"}t.sceneInfo.color&&(e=t.sceneInfo.color.match(/[0-9.]+/gi),s.style.background="var(--avs-motion-capture-background, rgba("+e[0]+","+e[1]+","+e[2]+",0.75))",o.style.background="var(--avs-zoom-overlay-background, rgba("+e[0]+","+e[1]+","+e[2]+",0.75))",l.style.background="var(--avs-tooltip-background, rgb("+e[0]+","+e[1]+","+e[2]+"))",c.style.background="var(--avs-tooltip-background, rgb("+e[0]+","+e[1]+","+e[2]+"))"),t.sceneInfo.fontFamily&&(s.style.fontFamily="var(--avs-motion-capture-font-family, "+t.sceneInfo.fontFamily+")",o.style.fontFamily="var(--avs-zoom-overlay-font-family, "+t.sceneInfo.fontFamily+")",l.style.fontFamily="var(--avs-tooltip-font-family, "+t.sceneInfo.fontFamily+")",c.style.fontFamily="var(--avs-tooltip-font-family, "+t.sceneInfo.fontFamily+")")}if(t.image)this.sceneImage.src=t.image,t.imagemap?(this.sceneImageMap.innerHTML=decodeURIComponent(t.imagemap.replace(/\+/g,"%20")),this.imageMapData=Array.from(this.sceneImageMap.querySelectorAll("area")).map((t=>({shape:t.getAttribute("shape"),coords:t.getAttribute("coords").split(",").map(Number),seriesIndex:t.getAttribute("series-index"),itemIndex:t.getAttribute("item-index"),componentInfo:t.getAttribute("component-info")})))):(this.sceneImageMap.innerHTML="",this.imageMapData=void 0),this.urlLoadJsonFile||this._dispatchSceneData(t),this._handleLoadComplete();else if(t.svg)this.svgDiv.innerHTML=decodeURIComponent(t.svg.replace(/\+/g,"%20")),this.urlLoadJsonFile||this._dispatchSceneData(t),this._handleLoadComplete();else if(t.threejs)if(this.urlLoadJsonFile||this._dispatchSceneData(t),t.threejs.chunkId){if(this.threeViewer.loadGeometryAsEvents(t.threejs,this._handleLoadComplete.bind(this)),t.threejs.moreChunks)if(this.urlLoadJsonFile){this.chunkFile++;const t=this.url.substring(0,this.url.lastIndexOf("."))||this.url,e=this.url.split(".").pop();this._httpRequest(t+"-"+this.chunkFile+"."+e,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this))}else this.model.rendererProperties.streamProperties.chunkId=t.threejs.chunkId,this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this),this.model)}else this.threeViewer.loadGeometryAsJson(t.threejs,this._handleLoadComplete.bind(this));else this._dispatchErrorEvent("No image, SVG, or ThreeJS found in response."),this._handleLoadComplete()}}getInheritedBackgroundCol(t){var e=this.getDefaultBackground(),n=window.getComputedStyle(t).backgroundColor;return n!=e?n:t.parentElement?this.getInheritedBackgroundCol(t.parentElement):e}getDefaultBackground(){var t=document.createElement("div");document.head.appendChild(t);var e=window.getComputedStyle(t).backgroundColor;return document.head.removeChild(t),e}_handleLoadComplete(){this.hideSpinner(),this.stopSpinner(),this.dispatchEvent(new CustomEvent("avs-load-complete"))}_dispatchSceneData(t){this.dispatchEvent(new CustomEvent("avs-scene-data",{detail:t}))}_handleTap(t,e,n){const i=this._getAdjustedCoords(t,e),r={type:"TAP",x:i.x,y:i.y,level:this.tapLevel,depth:this.tapDepth,highlight:this.tapHighlightEnable,highlightColor:this.tapHighlightColor,highlightLayer:this.tapHighlightLayerEnable};this._processPick(r,this.tapProcessEventOnClient,n)}_handleTrack(t,e,n,i,r){var a=this._getAdjustedRectangleCoords(e,n,i,r);switch(t){case"start":break;case"track":this.rectCtx.clearRect(0,0,this.width,this.height),this._rectangleStyle(),this.rectCtx.strokeRect(a.left,a.top,a.right-a.left,a.bottom-a.top);break;case"end":this.rectCtx.clearRect(0,0,this.width,this.height);const t={type:"TRACK",left:a.left,right:a.right,top:a.top,bottom:a.bottom,level:this.trackLevel,depth:this.trackDepth,highlight:this.trackHighlightEnable,highlightColor:this.trackHighlightColor,highlightLayer:this.trackHighlightLayerEnable};this._processPick(t,this.trackProcessEventOnClient)}}_handlePointerDown(t){this.pointerDownX=t.clientX,this.pointerDownY=t.clientY,this.pointerDown=!0,this.tapEnable&&1&t.buttons&&(this.tapping=!0),this.trackEnable&&2&t.buttons&&(this.tracking=1)}_handlePointerMove(t){if(this.tracking>=1){if(1===this.tracking){var e=Math.abs(t.clientX-this.pointerDownX),n=Math.abs(t.clientY-this.pointerDownY);e*e+n*n>=5&&(this.tracking=2,this._handleTrack("start",t.clientX,t.clientY,t.clientX-this.pointerDownX,t.clientY-this.pointerDownY))}2===this.tracking&&this._handleTrack("track",t.clientX,t.clientY,t.clientX-this.pointerDownX,t.clientY-this.pointerDownY)}if(this.hoverEnable){var i=this._getAdjustedCoords(t.clientX,t.clientY);const e={type:"HOVER",x:i.x,y:i.y};this.pointerDown?(e.selected=[],this._dispatchPickEvents(e)):(void 0!==this.hoverLevel&&(e.level=this.hoverLevel),void 0!==this.hoverDepth&&(e.depth=this.hoverDepth),this.hoverHighlightEnable&&(e.highlight=!0),void 0!==this.hoverHighlightColor&&(e.highlightColor=this.hoverHighlightColor),this.hoverHighlightLayerEnable&&(e.highlightLayer=!0),this._processPick(e,!0,t.target))}this._resetTimer()}_handlePointerUp(t){if(this.pointerDown=!1,this.tapping){this.tapping=!1;var e=Math.abs(t.clientX-this.pointerDownX),n=Math.abs(t.clientY-this.pointerDownY);e*e+n*n<25&&this._handleTap(t.clientX,t.clientY,t.currentTarget)}this.tracking>1&&(this.tracking=0,this._handleTrack("end",t.clientX,t.clientY,t.clientX-this.pointerDownX,t.clientY-this.pointerDownY))}_getAdjustedCoords(t,e){var n=this.renderRoot.querySelector("#dataVizDiv").getBoundingClientRect(),i=Math.round(t-n.left),r=Math.round(e-n.top);return{x:Math.max(0,Math.min(i,this.width)),y:Math.max(0,Math.min(r,this.height))}}_getAdjustedRectangleCoords(t,e,n,i){var r=this.renderRoot.querySelector("#dataVizDiv").getBoundingClientRect(),a=Math.round(t-r.left),s=Math.round(e-r.top),o=Math.max(0,Math.min(a,this.width)),l=Math.max(0,Math.min(s,this.height)),c=Math.max(0,Math.min(a-n,this.width)),h=Math.max(0,Math.min(s-i,this.height));return{left:Math.min(c,o),right:Math.max(c,o),top:Math.min(h,l),bottom:Math.max(h,l)}}_processPick(t,e,n){if(e)if(this.threeViewer){this.threeViewer.setPickDepth("ALL"===t.depth?lm:cm),"TRACK"===t.type?this.threeViewer.setPickRectangle(t.left,t.top,t.right,t.bottom):this.threeViewer.setPickRay(t.x,t.y),this.threeViewer.pick();var i={};i="CELL"===t.level?this.threeViewer.getPickedCells():"CELL_SET"===t.level?this.threeViewer.getPickedCellSets():this.threeViewer.getPickedSceneNodes(),t.selected=this.threeViewer.getSelectionInfo(i),this._dispatchPickEvents(t),t.highlight&&(this.threeViewer.highlightColor.set(t.highlightColor),this.threeViewer.highlightObjects(i,t.highlightLayer))}else if("SVG"===this.renderer){if(t.selected=[],"TRACK"!==t.type&&("polygon"===n.nodeName||"circle"===n.nodeName)){const e={};for(var r=null,a=n.parentElement;null!==a&&null===(r=a.getAttribute("series-index"));)a=a.parentElement;null!==r&&(e.seriesIndex=parseInt(r));var s=null;for(a=n.parentElement;null!==a&&null===(s=a.getAttribute("item-index"));)a=a.parentElement;null!==s&&(e.itemIndex=parseInt(s));var o=null;for(a=n.parentElement;null!==a&&null===(o=a.getAttribute("component-info"));)a=a.parentElement;null!==o&&(e.componentInfo=decodeURIComponent(o)),t.selected.push(e)}if(this._dispatchPickEvents(t),t.highlight){void 0===this.highlightSvg&&(this.highlightSvg=[]);for(var l=0;l<this.highlightSvg.length;l++)this.highlightSvg[l].setAttribute("fill",this.highlightSvg[l].getAttribute("saveFill"));this.highlightSvg.length=0,"TRACK"===t.type||"polygon"!==n.nodeName&&"circle"!==n.nodeName||(this.highlightSvg.push(n),n.setAttribute("saveFill",n.getAttribute("fill")),n.setAttribute("fill",t.highlightColor))}}else{if(t.selected=[],"TRACK"!==t.type&&void 0!==this.imageMapData)for(l=0;l<this.imageMapData.length;l++){var c=this.imageMapData[l];if(console.log(t.x+" "+t.y),"poly"===c.shape&&this._pointInPoly(t.x,t.y,c.coords)){const e={};null!==c.seriesIndex&&(e.seriesIndex=parseInt(c.seriesIndex)),null!==c.itemIndex&&(e.itemIndex=parseInt(c.itemIndex)),null!==c.componentInfo&&(e.componentInfo=decodeURIComponent(c.componentInfo)),t.selected.push(e)}}this._dispatchPickEvents(t)}else this.urlLoadJsonFile||(this.showSpinner(),this.url&&(this.startSpinner(),this.model=this._assembleModel(),this.model&&(this.model.rendererProperties.pickProperties=t,this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this),this.model))))}_pointInPoly(t,e,n){for(var i,r,a,s=n[0]-t,o=n[1]-e,l=0,c=2;c<n.length;c+=2)if(r=n[c+1]-e,o<0&&r<0||o>0&&r>0)o=r,s=n[c]-t;else{if(i=n[c]-t,r>0&&o<=0){if((a=s*r-i*o)>0)l++;else if(0===a)return!1}else if(o>0&&r<=0){if((a=s*r-i*o)<0)l++;else if(0===a)return!1}else if(0===r&&o<0){if(0===(a=s*r-i*o))return!1}else if(0===o&&r<0){if(0===(a=s*r-i*o))return!1}else if(0===o&&0===r){if(i<=0&&s>=0)return!1;if(s<=0&&i>=0)return!1}o=r,s=i}return l%2!=0}_dispatchPickEvents(t){const e={selected:t.selected};"TRACK"===t.type?(e.left=t.left,e.top=t.top,e.right=t.right,e.bottom=t.bottom,this.dispatchEvent(new CustomEvent("avs-track",{detail:e}))):(e.x=t.x,e.y=t.y,"HOVER"===t.type?this.dispatchEvent(new CustomEvent("avs-hover",{detail:e})):this.dispatchEvent(new CustomEvent("avs-tap",{detail:e})))}_resetTimer(){window.clearTimeout(this.timer),this.timer=window.setTimeout((()=>{this.dispatchEvent(new Event("avs-pointer-timeout"))}),1e3*this.pointerTimeout)}constructor(){super(),this.renderer="THREEJS",this.resizeThreshold=10,this.pointerTimeout=600,this.panWidthZoomLevel=100,this.panHeightZoomLevel=100,this.panMaximumZoomLevel=1e3,this.lowResizeWidth=this.highResizeWidth=0,this.highResizeWidth=this.highResizeHeight=0,this.motionCaptureTime=0,this.motionCaptureFrames??=[],this._resetTimer(),this._updatePixelRatio()}connectedCallback(){super.connectedCallback(),Cf.observe(this),this.addEventListener("pointerdown",this._handlePointerDown),this.addEventListener("pointerup",this._handlePointerUp),this.addEventListener("pointermove",this._handlePointerMove),this.addEventListener("pointerout",this._handlePointerMove);var t=this;this.addEventListener("contextmenu",(function(e){t.trackEnable&&e.preventDefault()}))}disconnectedCallback(){super.disconnectedCallback(),Cf.unobserve(this)}_handlePointerEnterMotionCaptureControl(t){if(!this.showMotionCaptureTooltip){var e=this._getAdjustedCoords(t.clientX,t.clientY),n=this.renderRoot.querySelector("#motionCaptureTooltip"),i=this._calcTooltipPosition(n,e.x,e.y);n.style.left=i.x+"px",n.style.top=i.y+"px",n.style.opacity="1";const r=t.currentTarget;n.innerHTML=r.dataset.tooltip??r.id,this.showMotionCaptureTooltip=!0}}_handlePointerLeaveMotionCaptureControl(){this.renderRoot.querySelector("#motionCaptureTooltip").style.opacity="0",this.showMotionCaptureTooltip=!1}_round2dp(t){return Math.round(100*(t+Number.EPSILON))/100}_handleMotionCaptureSnapshot(){const t=this._getTransformComponents();this.motionCaptureFrames.length>0&&(this.motionCaptureTime+=this.motionCaptureDelay);const e={time:1e3*this.motionCaptureTime,scale:this._round2dp(t.scale),position:[this._round2dp(t.position[0]),this._round2dp(t.position[1]),this._round2dp(t.position[2])],rotation:[this._round2dp(t.rotation[0]),this._round2dp(t.rotation[1]),this._round2dp(t.rotation[2]),t.rotation[3]]};this.motionCaptureFrames.push(e),1==this.motionCaptureFrames.length&&(this.renderRoot.querySelector("#motionCapturePlay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureDelay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="2",this.renderRoot.querySelector("#motionCaptureClear").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.remove("disabled"),this.motionCaptureDelay=2),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML=String(this.motionCaptureFrames.length)}_handleMotionCaptureDelayIncrease(){this.motionCaptureDelay++,this.motionCaptureDelay>9&&(this.motionCaptureDelay=9),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML=String(this.motionCaptureDelay)}_handleMotionCaptureDelayDecrease(){this.motionCaptureDelay--,this.motionCaptureDelay<1&&(this.motionCaptureDelay=1),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML=String(this.motionCaptureDelay)}_handleMotionCaptureCopyData(){const t=JSON.stringify(this.motionCaptureFrames);navigator.clipboard.writeText(t);const e=this.renderRoot.querySelector("#motionCaptureAlert");e.innerHTML="Motion capture URL copied to clipboard",e.style.opacity="1",setTimeout((()=>{e.style.opacity="0"}),2e3)}async _handleMotionCaptureCopyUrl(){const t=JSON.stringify(this.motionCaptureFrames),e=await this._compress(t),n=btoa(String.fromCharCode(...new Uint8Array(e))).replaceAll("/","_").replaceAll("+","-"),i=window.location.origin+window.location.pathname+"?motionCapture="+n;navigator.clipboard.writeText(i);const r=this.renderRoot.querySelector("#motionCaptureAlert");r.innerHTML="Motion capture URL copied to clipboard",r.style.opacity="1",setTimeout((()=>{r.style.opacity="0"}),2e3)}async _compress(t){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];for await(const t of e)n.push(t);return this._concatUint8Arrays(n)}async _decompress(t){const e=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip")),n=[];for await(const t of e)n.push(t);const i=await this._concatUint8Arrays(n);return(new TextDecoder).decode(i)}async _concatUint8Arrays(t){const e=new Blob(t),n=await e.arrayBuffer();return new Uint8Array(n)}_handleMotionCaptureClear(){this.motionCaptureFrames.length=0,this.renderRoot.querySelector("#motionCapturePlay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureDelay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureClear").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.add("disabled"),this.motionCaptureDelay=0,this.motionCaptureTime=0}_updatePixelRatio(t){const e=window.devicePixelRatio;matchMedia(`(resolution: ${e}dppx)`).addEventListener("change",this._updatePixelRatio.bind(this,!0),{once:!0}),t&&this.updateViewer()}_motionCaptureControlsEnableChanged(t,e){this.renderRoot.querySelector("#motionCapture").style.display=t?"block":"none"}_transformEnableChanged(t,e){this.threeViewer&&(t?(void 0===this.transformInteractor&&(this.transformInteractor=new df(this.renderRoot.querySelector("#dataVizDiv"))),this.threeViewer.addInteractor(this.transformInteractor),this.transformRotateDisable&&(this.transformInteractor.enableRotate=!1),this.transformZoomDisable&&(this.transformInteractor.enableZoom=!1),this.transformPanDisable&&(this.transformInteractor.enablePan=!1),this.transformClientOnly&&(this.transformInteractor.clientOnly=!0)):this.threeViewer.removeInteractor(this.transformInteractor))}_transformClientOnlyChanged(t,e){this.transformInteractor&&(this.transformInteractor.clientOnly=t),this.zoomRectangleInteractor&&(this.zoomRectangleInteractor.clientOnly=t)}_transformRotateDisableChanged(t,e){this.transformInteractor&&(this.transformInteractor.enableRotate=!t)}_transformZoomDisableChanged(t,e){this.transformInteractor&&(this.transformInteractor.enableZoom=!t)}_transformPanDisableChanged(t,e){this.transformInteractor&&(this.transformInteractor.enablePan=!t)}resetTransform(){this.transformInteractor&&this.transformInteractor.reset()}zoomIn(){this.transformInteractor&&this.transformInteractor.zoomIn()}zoomOut(){this.transformInteractor&&this.transformInteractor.zoomOut()}panTo(t,e,n){this.transformInteractor&&this.transformInteractor.panTo(t,e,n)}_getTransformComponents(){var t,e=new Ci,n=new Ai,i=new Ci,r=new lr;return this.transformInteractor&&(t=this.transformInteractor.object.matrix),t.decompose(e,n,i),r.setFromQuaternion(n),{position:e.toArray(),rotation:[180*r.x/Math.PI,180*r.y/Math.PI,180*r.z/Math.PI],rotationOrder:r.order,scale:100*i.x}}getTransformMatrix(){if(this.transformInteractor)return this.transformInteractor.object.matrix.elements.slice()}runAnimation(){if(this.threeViewer){var t=window.getComputedStyle(this,null),e={transform:this.motionCaptureFrames.length>0?JSON.stringify(this.motionCaptureFrames):null};this._applyCustomCssProperties(e,t,{scene:"--avs-scene-animations",sceneTitle:"--avs-scene-title-animations",chart:"--avs-chart-animations",chartTitle:"--avs-chart-title-animations",axis:"--avs-axis-animations",legend:"--avs-legend-animations",legendTitle:"--avs-legend-title-animations",glyph:"--avs-glyph-animations"}),this.animator.setStyleMap(e),this.threeViewer.runAnimation()}}_animatedGlyphsVisibleChanged(t,e){this.threeViewer&&this.threeViewer.setVisibleAnimatedGlyphs(t)}_animatedGlyphsEnableChanged(t,e){this.threeViewer&&this.threeViewer.setEnableAnimatedGlyphs(t)}_transformValueChanged(){var t=void 0!==this.transformTwistAngle?this.transformTwistAngle*Math.PI/180:0,e=void 0!==this.transformTiltAngle?this.transformTiltAngle*Math.PI/180:0,n=void 0!==this.transformScale?this.transformScale/100:1,i=Math.sin(t),r=Math.cos(t),a=Math.sin(e),s=Math.cos(e),o=[r*n,0,s*i*n,0,0,s*n,-a*n,0,-i*n,r*a*n,r*s*n,0,0,0,0,1];this.transformMatrix=o,this.transformInteractor&&this.transformInteractor.object.matrix.fromArray(o)}async _motionCaptureValueChanged(t,e){if(t){try{this.motionCaptureFrames=JSON.parse(t)}catch{const e=atob(t).replaceAll("_","/").replaceAll("-","+"),n=await this._decompress(e);this.motionCaptureFrames=JSON.parse(n)}this.motionCaptureFrames||(this.motionCaptureFrames=[]),this.motionCaptureFrames.length>0?(this.renderRoot.querySelector("#motionCapturePlay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML=String(this.motionCaptureFrames.length),this.renderRoot.querySelector("#motionCaptureDelay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="2",this.renderRoot.querySelector("#motionCaptureClear").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.remove("disabled"),this.motionCaptureDelay=2,this.motionCaptureTime=this.motionCaptureFrames[this.motionCaptureFrames.length-1].time/1e3):(this.renderRoot.querySelector("#motionCapturePlay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureDelay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureClear").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.add("disabled"),this.motionCaptureDelay=0,this.motionCaptureTime=0)}}_zoomRectangleEnableChanged(t,e){this.threeViewer&&(t?(void 0===this.zoomRectangleInteractor&&(this.zoomRectangleInteractor=new bf(this)),this.threeViewer.addInteractor(this.zoomRectangleInteractor),this.transformClientOnly&&(this.zoomRectangleInteractor.clientOnly=!0)):this.threeViewer.removeInteractor(this.zoomRectangleInteractor))}_panEnableChanged(t,e){this.threeViewer&&(t?(void 0===this.panInteractor&&(this.panInteractor=new vf(this)),this.threeViewer.addInteractor(this.panInteractor),this.panZoomEnable&&(this.panInteractor.addEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.addEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.addEventListener("zoomEnd",this._handlePanZoomEnd.bind(this))),this.panInteractor.setWidthZoomLevel(this.panWidthZoomLevel),this.panInteractor.setHeightZoomLevel(this.panHeightZoomLevel),this.panInteractor.setMaximumZoomLevel(this.panMaximumZoomLevel),this.panInteractor.saveState()):(this.threeViewer.removeInteractor(this.panInteractor),this.panZoomEnable&&(this.panInteractor.removeEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.removeEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.removeEventListener("zoomEnd",this._handlePanZoomEnd.bind(this)))))}_panZoomEnableChanged(t,e){this.threeViewer&&this.panInteractor&&(t?(this.panInteractor.addEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.addEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.addEventListener("zoomEnd",this._handlePanZoomEnd.bind(this))):(this.panInteractor.removeEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.removeEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.removeEventListener("zoomEnd",this._handlePanZoomEnd.bind(this))))}_handlePanChanged(t){this.dispatchEvent(new CustomEvent("avs-pan-info",t))}_handlePanZoom(t){window.clearTimeout(this.zoomOverlayTimeoutId);var e=Math.round(t.detail.widthZoomLevel),n=Math.round(t.detail.heightZoomLevel);this.renderRoot.querySelector("#zoomOverlay").innerHTML=e===n?e+"%":e+"%,"+n+"%";var i=this._getAdjustedCoords(t.detail.clientX,t.detail.clientY);const r=this.renderRoot.querySelector("#zoomOverlay");r.style.left=i.x+"px",r.style.top=i.y+"px",r.style.opacity="1",this.pointerDown=!0,this._dispatchPickEvents({type:"HOVER",x:0,y:0,selected:[]}),this.zoomOverlayTimeoutId=window.setTimeout((()=>{this.renderRoot.querySelector("#zoomOverlay").style.opacity="0",this.pointerDown=!1}),1e3)}_handlePanZoomEnd(t){this.panWidthZoomLevel=t.detail.widthZoomLevel,this.panHeightZoomLevel=t.detail.heightZoomLevel}_panWidthZoomLevelChanged(t,e){this.panInteractor&&this.panInteractor.setWidthZoomLevel(t)}_panHeightZoomLevelChanged(t,e){this.panInteractor&&this.panInteractor.setHeightZoomLevel(t)}_panMaximumZoomLevelChanged(t,e){this.panInteractor&&this.panInteractor.setMaximumZoomLevel(t)}resetPan(){this.panInteractor&&this.panInteractor.reset()}_rendererChanged(t,e){if("IMAGE"===e)this.sceneImage.src="data:,",this.renderRoot.querySelector("#dataVizDiv").removeChild(this.sceneImage),this.renderRoot.querySelector("#dataVizDiv").removeChild(this.sceneImageMap);else if("SVG"===e){for(var n=this.svgDiv;n.firstChild;)n.removeChild(n.firstChild);this.renderRoot.querySelector("#dataVizDiv").removeChild(this.svgDiv)}else this.threeViewer&&(this.threeViewer.clearGeometry(),this.threeViewer.render(),this.renderRoot.querySelector("#dataVizDiv").removeChild(this.threeViewer.domElement));if("IMAGE"===t)void 0===this.sceneImage&&(this.sceneImage=document.createElement("img"),this.sceneImage.setAttribute("id","sceneImage"),this.sceneImage.setAttribute("usemap","#sceneImageMap"),this.sceneImageMap=document.createElement("map"),this.sceneImageMap.setAttribute("id","sceneImageMap"),this.sceneImageMap.setAttribute("name","sceneImageMap")),this.renderRoot.querySelector("#dataVizDiv").appendChild(this.sceneImage),this.renderRoot.querySelector("#dataVizDiv").appendChild(this.sceneImageMap),this.threeViewer=null;else if("SVG"===t)void 0===this.svgDiv&&(this.svgDiv=document.createElement("div"),this.svgDiv.setAttribute("id","svgDiv")),this.renderRoot.querySelector("#dataVizDiv").appendChild(this.svgDiv),this.threeViewer=null;else{if(!this.threeViewer){this.threeViewer=new of;var i="avsDefaultWebGLRenderer",r=document.getElementById(i);null==r&&((r=new om).setAttribute("id",i),document.body.appendChild(r)),this.threeViewer.setWebGLRenderer(r.webGLRenderer),this.animator=new Ef,this.threeViewer.setAnimator(this.animator)}this.renderRoot.querySelector("#dataVizDiv").appendChild(this.threeViewer.domElement)}}_trackEnableChanged(t,e){t?(void 0===this.rectCanvas&&(this.rectCanvas=document.createElement("canvas"),this.rectCanvas.setAttribute("id","rectCanvas"),this.rectCtx=this.rectCanvas.getContext("2d")),this.renderRoot.appendChild(this.rectCanvas)):this.renderRoot.removeChild(this.rectCanvas)}_displayCanvasChanged(t,e){this.threeViewer&&(this.threeViewer.displayCanvas=t)}setTooltipHTML(t){this.renderRoot.querySelector("#tooltip").innerHTML=t}showTooltip(t,e){var n=this.renderRoot.querySelector("#tooltip"),i=this._calcTooltipPosition(n,t,e);n.style.left=i.x+"px",n.style.top=i.y+"px",n.style.opacity="1"}hideTooltip(){this.renderRoot.querySelector("#tooltip").style.opacity="0"}_calcTooltipPosition(t,e,n){var i=this.renderRoot.querySelector("#dataVizDiv"),r=this._getOffset(i),a=-Math.min(0,r.top-window.pageYOffset),s=-Math.min(0,r.left-window.pageXOffset),o=-Math.min(0,window.innerHeight-(i.offsetHeight+r.top-window.pageYOffset)),l=-Math.min(0,window.innerWidth-(i.offsetWidth+r.left-window.pageXOffset)),c=(i.offsetHeight-a-o)/2+a,h={x:0,y:0};if(e<(i.offsetWidth-s-l)/2+s){var d=n<c?15:5;h.x=e+d+i.offsetLeft}else h.x=e-10+i.offsetLeft-t.offsetWidth;return h.y=n<c?n+5+i.offsetTop:n-10+i.offsetTop-t.offsetHeight,h}_getOffset(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+i,left:e.left+n}}},Af([ut({attribute:"manual-update",type:Boolean})],t.AvsGoDataViz.prototype,"manualUpdate",void 0),Af([ut({attribute:"display-canvas",type:Boolean})],t.AvsGoDataViz.prototype,"displayCanvas",void 0),Af([ut()],t.AvsGoDataViz.prototype,"url",void 0),Af([ut({attribute:"url-load-json-file",type:Boolean})],t.AvsGoDataViz.prototype,"urlLoadJsonFile",void 0),Af([ut({attribute:"data-source-name"})],t.AvsGoDataViz.prototype,"dataSourceName",void 0),Af([ut({attribute:"data-source-user-properties"})],t.AvsGoDataViz.prototype,"dataSourceUserProperties",void 0),Af([ut({attribute:"scene-name"})],t.AvsGoDataViz.prototype,"sceneName",void 0),Af([ut({attribute:"scene-user-properties"})],t.AvsGoDataViz.prototype,"sceneUserProperties",void 0),Af([ut({attribute:"renderer-name"})],t.AvsGoDataViz.prototype,"rendererName",void 0),Af([ut({attribute:"renderer-user-properties"})],t.AvsGoDataViz.prototype,"rendererUserProperties",void 0),Af([ut()],t.AvsGoDataViz.prototype,"renderer",void 0),Af([ut({attribute:"stream-enable",type:Boolean})],t.AvsGoDataViz.prototype,"streamEnable",void 0),Af([ut({attribute:"stream-chunk-size-first"})],t.AvsGoDataViz.prototype,"streamChunkSizeFirst",void 0),Af([ut({attribute:"stream-chunk-size"})],t.AvsGoDataViz.prototype,"streamChunkSize",void 0),Af([ut({attribute:"theme-name"})],t.AvsGoDataViz.prototype,"themeName",void 0),Af([ut({attribute:"resize-threshold"})],t.AvsGoDataViz.prototype,"resizeThreshold",void 0),Af([ut({attribute:"pointer-timeout"})],t.AvsGoDataViz.prototype,"pointerTimeout",void 0),Af([ut({attribute:"tap-enable",type:Boolean})],t.AvsGoDataViz.prototype,"tapEnable",void 0),Af([ut({attribute:"tap-level"})],t.AvsGoDataViz.prototype,"tapLevel",void 0),Af([ut({attribute:"tap-depth"})],t.AvsGoDataViz.prototype,"tapDepth",void 0),Af([ut({attribute:"tap-highlight-enable",type:Boolean})],t.AvsGoDataViz.prototype,"tapHighlightEnable",void 0),Af([ut({attribute:"tap-highlight-color"})],t.AvsGoDataViz.prototype,"tapHighlightColor",void 0),Af([ut({attribute:"tap-highlight-layer-enable",type:Boolean})],t.AvsGoDataViz.prototype,"tapHighlightLayerEnable",void 0),Af([ut({attribute:"tap-process-event-on-client",type:Boolean})],t.AvsGoDataViz.prototype,"tapProcessEventOnClient",void 0),Af([ut({attribute:"track-enable",type:Boolean})],t.AvsGoDataViz.prototype,"trackEnable",void 0),Af([ut({attribute:"track-level"})],t.AvsGoDataViz.prototype,"trackLevel",void 0),Af([ut({attribute:"track-depth"})],t.AvsGoDataViz.prototype,"trackDepth",void 0),Af([ut({attribute:"track-highlight-enable",type:Boolean})],t.AvsGoDataViz.prototype,"trackHighlightEnable",void 0),Af([ut({attribute:"track-highlight-color"})],t.AvsGoDataViz.prototype,"trackHighlightColor",void 0),Af([ut({attribute:"track-highlight-layer-enable",type:Boolean})],t.AvsGoDataViz.prototype,"trackHighlightLayerEnable",void 0),Af([ut({attribute:"track-process-event-on-client",type:Boolean})],t.AvsGoDataViz.prototype,"trackProcessEventOnClient",void 0),Af([ut({attribute:"hover-enable",type:Boolean})],t.AvsGoDataViz.prototype,"hoverEnable",void 0),Af([ut({attribute:"hover-level"})],t.AvsGoDataViz.prototype,"hoverLevel",void 0),Af([ut({attribute:"hover-depth"})],t.AvsGoDataViz.prototype,"hoverDepth",void 0),Af([ut({attribute:"hover-highlight-enable",type:Boolean})],t.AvsGoDataViz.prototype,"hoverHighlightEnable",void 0),Af([ut({attribute:"hover-highlight-color"})],t.AvsGoDataViz.prototype,"hoverHighlightColor",void 0),Af([ut({attribute:"hover-highlight-layer-enable",type:Boolean})],t.AvsGoDataViz.prototype,"hoverHighlightLayerEnable",void 0),Af([ut({attribute:"transform-enable",type:Boolean})],t.AvsGoDataViz.prototype,"transformEnable",void 0),Af([ut({attribute:"transform-client-only",type:Boolean})],t.AvsGoDataViz.prototype,"transformClientOnly",void 0),Af([ut({attribute:"transform-rotate-disable",type:Boolean})],t.AvsGoDataViz.prototype,"transformRotateDisable",void 0),Af([ut({attribute:"transform-zoom-disable",type:Boolean})],t.AvsGoDataViz.prototype,"transformZoomDisable",void 0),Af([ut({attribute:"transform-pan-disable",type:Boolean})],t.AvsGoDataViz.prototype,"transformPanDisable",void 0),Af([ut({attribute:"transform-twist-angle"})],t.AvsGoDataViz.prototype,"transformTwistAngle",void 0),Af([ut({attribute:"transform-tilt-angle"})],t.AvsGoDataViz.prototype,"transformTiltAngle",void 0),Af([ut({attribute:"transform-scale"})],t.AvsGoDataViz.prototype,"transformScale",void 0),Af([ut({attribute:"motion-capture"})],t.AvsGoDataViz.prototype,"motionCapture",void 0),Af([ut({attribute:"zoom-rectangle-enable",type:Boolean})],t.AvsGoDataViz.prototype,"zoomRectangleEnable",void 0),Af([ut({attribute:"pan-enable",type:Boolean})],t.AvsGoDataViz.prototype,"panEnable",void 0),Af([ut({attribute:"pan-zoom-enable",type:Boolean})],t.AvsGoDataViz.prototype,"panZoomEnable",void 0),Af([ut({attribute:"pan-width-zoom-level"})],t.AvsGoDataViz.prototype,"panWidthZoomLevel",void 0),Af([ut({attribute:"pan-height-zoom-level"})],t.AvsGoDataViz.prototype,"panHeightZoomLevel",void 0),Af([ut({attribute:"pan-maximum-zoom-level"})],t.AvsGoDataViz.prototype,"panMaximumZoomLevel",void 0),Af([ut({attribute:"animated-glyphs-visible",type:Boolean})],t.AvsGoDataViz.prototype,"animatedGlyphsVisible",void 0),Af([ut({attribute:"animated-glyphs-enable",type:Boolean})],t.AvsGoDataViz.prototype,"animatedGlyphsEnable",void 0),Af([ut({attribute:"motion-capture-controls-enable",type:Boolean})],t.AvsGoDataViz.prototype,"motionCaptureControlsEnable",void 0),t.AvsGoDataViz=Af([ct("avs-go-dataviz")],t.AvsGoDataViz);
|
|
338
|
+
`}_assembleModel(t){if(!this.sceneName)return void this._dispatchErrorEvent("'scene-name' property must be set to the name of the scene registered in the library map on the AVS/Go server.");if(!this.width||!this.height)return;const e={sceneProperties:{name:this.sceneName}};if(this.sceneUserProperties){let t;try{t=JSON.parse(this.sceneUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'scene-user-properties'. "+t.message)}e.sceneProperties.userProperties=t}const n={width:this.width,height:this.height,name:this.rendererName,type:this.renderer};if(this.rendererUserProperties){let t;try{t=JSON.parse(this.rendererUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'renderer-user-properties'. "+t.message)}n.userProperties=t}e.rendererProperties=n,this.transformInteractor&&(this.transformMatrix=this.transformInteractor.object.matrix.elements.slice()),this.transformMatrix&&!this.transformClientOnly&&(n.transformMatrix=this.transformMatrix),t&&(this.transformClientOnly&&this.transformInteractor?this.transformInteractor.fullReset=t:n.fullReset=!0),this.panEnable&&(n.panProperties={widthZoomLevel:Math.min(this.panWidthZoomLevel,this.panMaximumZoomLevel),heightZoomLevel:Math.min(this.panHeightZoomLevel,this.panMaximumZoomLevel)}),n.themeName=this.themeName;var i=window.getComputedStyle(this,null),r=i.getPropertyValue("background-color").trim(),a=i.getPropertyValue("color").trim(),s=i.getPropertyValue("font-family").trim().replace(/['"]+/g,"");if(n.cssProperties={sceneBackgroundType:"Solid",sceneBackgroundColor:r,sceneLineColor:a,sceneTextColor:a,sceneFontFamily:s,sceneSurfaceColor:a},this._applyCustomCssProperties(n.cssProperties,i,{sceneBackgroundType:"--avs-scene-background-type",sceneBackgroundColor:"--avs-scene-background-color",sceneBackgroundStartColor:"--avs-scene-background-start-color",sceneBackgroundEndColor:"--avs-scene-background-end-color",sceneBackgroundGradientStyle:"--avs-scene-background-gradient-style",sceneBackgroundGradientInterpolation:"--avs-scene-background-gradient-interpolation",sceneBackgroundGradientColorRepeat:"--avs-scene-background-gradient-color-repeat",sceneHighlightColor:"--avs-scene-highlight-color",sceneSurfaceColor:"--avs-scene-surface-color",scenePointColor:"--avs-scene-point-color",sceneLineColor:"--avs-scene-line-color",sceneLineWidth:"--avs-scene-line-width",sceneTextColor:"--avs-scene-text-color",sceneTextRotation:"--avs-scene-text-rotation",sceneFontFamily:"--avs-scene-font-family",sceneFontStyle:"--avs-scene-font-style",sceneFontWeight:"--avs-scene-font-weight",sceneFontSize:"--avs-scene-font-size",sceneTitleTextColor:"--avs-scene-title-text-color",sceneTitleTextRotation:"--avs-scene-title-text-rotation",sceneTitleFontFamily:"--avs-scene-title-font-family",sceneTitleFontStyle:"--avs-scene-title-font-style",sceneTitleFontWeight:"--avs-scene-title-font-weight",sceneTitleFontSize:"--avs-scene-title-font-size",chartBackgroundType:"--avs-chart-background-type",chartBackgroundColor:"--avs-chart-background-color",chartBackgroundStartColor:"--avs-chart-background-start-color",chartBackgroundEndColor:"--avs-chart-background-end-color",chartBackgroundGradientStyle:"--avs-chart-background-gradient-style",chartBackgroundGradientInterpolation:"--avs-chart-background-gradient-interpolation",chartBackgroundGradientColorRepeat:"--avs-chart-background-gradient-color-repeat",chartHighlightColor:"--avs-chart-highlight-color",chartSurfaceColor:"--avs-chart-surface-color",chartPointColor:"--avs-chart-point-color",chartLineColor:"--avs-chart-line-color",chartLineWidth:"--avs-chart-line-width",chartLinePattern:"--avs-chart-line-pattern",chartTextColor:"--avs-chart-text-color",chartTextRotation:"--avs-chart-text-rotation",chartFontFamily:"--avs-chart-font-family",chartFontStyle:"--avs-chart-font-style",chartFontWeight:"--avs-chart-font-weight",chartFontSize:"--avs-chart-font-size",chartTitleTextColor:"--avs-chart-title-text-color",chartTitleTextRotation:"--avs-chart-title-text-rotation",chartTitleFontFamily:"--avs-chart-title-font-family",chartTitleFontStyle:"--avs-chart-title-font-style",chartTitleFontWeight:"--avs-chart-title-font-weight",chartTitleFontSize:"--avs-chart-title-font-size",axisLineColor:"--avs-axis-line-color",axisLineWidth:"--avs-axis-line-width",axisTextColor:"--avs-axis-text-color",axisTextRotation:"--avs-axis-text-rotation",axisFontFamily:"--avs-axis-font-family",axisFontStyle:"--avs-axis-font-style",axisFontWeight:"--avs-axis-font-weight",axisFontSize:"--avs-axis-font-size",axisAxleColor:"--avs-axis-axle-color",axisAxleWidth:"--avs-axis-axle-width",axisMajorTickMarkColor:"--avs-axis-major-tick-mark-color",axisMajorTickMarkWidth:"--avs-axis-major-tick-mark-width",axisMajorTickLineColor:"--avs-axis-major-tick-line-color",axisMajorTickLineWidth:"--avs-axis-major-tick-line-width",axisMajorTickLineStyle:"--avs-axis-major-tick-line-style",axisMajorUnlabeledTickMarkColor:"--avs-axis-major-unlabeled-tick-mark-color",axisMajorUnlabeledTickMarkWidth:"--avs-axis-major-unlabeled-tick-mark-width",axisMajorUnlabeledTickLineColor:"--avs-axis-major-unlabeled-tick-line-color",axisMajorUnlabeledTickLineWidth:"--avs-axis-major-unlabeled-tick-line-width",axisMajorUnlabeledTickLineStyle:"--avs-axis-major-unlabeled-tick-line-style",axisMinorTickMarkColor:"--avs-axis-minor-tick-mark-color",axisMinorTickMarkWidth:"--avs-axis-minor-tick-mark-width",axisMinorTickLineColor:"--avs-axis-minor-tick-line-color",axisMinorTickLineWidth:"--avs-axis-minor-tick-line-width",axisMinorTickLineStyle:"--avs-axis-minor-tick-line-style",axisTitleTextColor:"--avs-axis-title-text-color",axisTitleTextRotation:"--avs-axis-title-text-rotation",axisTitleFontFamily:"--avs-axis-title-font-family",axisTitleFontStyle:"--avs-axis-title-font-style",axisTitleFontWeight:"--avs-axis-title-font-weight",axisTitleFontSize:"--avs-axis-title-font-size",axisUnitTextColor:"--avs-axis-unit-text-color",axisUnitTextRotation:"--avs-axis-unit-text-rotation",axisUnitFontFamily:"--avs-axis-unit-font-family",axisUnitFontStyle:"--avs-axis-unit-font-style",axisUnitFontWeight:"--avs-axis-unit-font-weight",axisUnitFontSize:"--avs-axis-unit-font-size",axisLabelTextColor:"--avs-axis-label-text-color",axisLabelTextRotation:"--avs-axis-label-text-rotation",axisLabelFontFamily:"--avs-axis-label-font-family",axisLabelFontStyle:"--avs-axis-label-font-style",axisLabelFontWeight:"--avs-axis-label-font-weight",axisLabelFontSize:"--avs-axis-label-font-size",legendBackgroundColor:"--avs-legend-background-color",legendTextColor:"--avs-legend-text-color",legendTextRotation:"--avs-legend-text-rotation",legendFontFamily:"--avs-legend-font-family",legendFontStyle:"--avs-legend-font-style",legendFontWeight:"--avs-legend-font-weight",legendFontSize:"--avs-legend-font-size",legendPointColor:"--avs-legend-point-color",legendTitleTextColor:"--avs-legend-title-text-color",legendTitleTextRotation:"--avs-legend-title-text-rotation",legendTitleFontFamily:"--avs-legend-title-font-family",legendTitleFontStyle:"--avs-legend-title-font-style",legendTitleFontWeight:"--avs-legend-title-font-weight",legendTitleFontSize:"--avs-legend-title-font-size"}),this.dataSourceName&&(e.dataSourceProperties={name:this.dataSourceName},this.dataSourceUserProperties)){let t;try{t=JSON.parse(this.dataSourceUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. "+t.message)}e.dataSourceProperties.userProperties=t}return this.threeViewer&&this.streamEnable&&(n.streamProperties={chunkSizeFirst:this.streamChunkSizeFirst,chunkSize:this.streamChunkSize}),e}_applyCustomCssProperties(t,e,n){for(var i in n)if(n.hasOwnProperty(i)){var r=e.getPropertyValue(n[i]).trim();r.length>0&&(t[i]=r)}}_onResize(t){this.width=Math.round(t.width),this.height=Math.round(t.height),this.rectCanvas&&(this.rectCanvas.width=this.width,this.rectCanvas.height=this.height),!this.urlLoadJsonFile&&!this.manualUpdate&&this.resizeThreshold>0&&(!this.lowResizeWidth||this.width<this.lowResizeWidth||this.width>this.highResizeWidth||this.height<this.lowResizeHeight||this.height>this.highResizeHeight)?(this._updateResizeLimits(),this.updateViewer()):this.threeViewer&&this.threeViewer.render(!0)}_updateResizeLimits(){this.lowResizeWidth=(100-this.resizeThreshold)/100*this.width,this.highResizeWidth=(100+this.resizeThreshold)/100*this.width,this.lowResizeHeight=(100-this.resizeThreshold)/100*this.height,this.highResizeHeight=(100+this.resizeThreshold)/100*this.height}showSpinner(){var t=window.getComputedStyle(this,null).getPropertyValue("--avs-spinner").trim().replace(/['"]+/g,"");t.length>0?fetch(t).then((t=>{if(t.ok)return t.text()})).then((t=>{this.renderRoot.querySelector("#spinner").innerHTML=t})).catch((t=>{this.renderRoot.querySelector("#spinner").innerHTML=Tf})):this.renderRoot.querySelector("#spinner").innerHTML=Tf,this.renderRoot.querySelector("#spinner").style.display="block"}hideSpinner(){this.renderRoot.querySelector("#spinner").style.display="none"}startSpinner(){this.renderRoot.querySelector("#spinner").className="spin"}stopSpinner(){this.renderRoot.querySelector("#spinner").className=""}updated(t){if(!["IMAGE","SVG","THREEJS"].includes(this.renderer))return void this._dispatchErrorEvent("'renderer' property must be 'IMAGE', 'SVG' or 'THREEJS'.");if(t.has("renderer")&&this._rendererChanged(this.renderer,t.renderer),t.has("transformEnable")&&this._transformEnableChanged(this.transformEnable,t.transformEnable),t.has("transformClientOnly")&&this._transformClientOnlyChanged(this.transformClientOnly,t.transformClientOnly),t.has("transformRotateDisable")&&this._transformRotateDisableChanged(this.transformRotateDisable,t.transformRotateDisable),t.has("transformZoomDisable")&&this._transformZoomDisableChanged(this.transformZoomDisable,t.transformZoomDisable),t.has("transformPanDisable")&&this._transformPanDisableChanged(this.transformPanDisable,t.transformPanDisable),t.has("animatedGlyphsVisible")&&this._animatedGlyphsVisibleChanged(this.animatedGlyphsVisible,t.animatedGlyphsVisible),t.has("animatedGlyphsEnable")&&this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable,t.animatedGlyphsEnable),(t.has("transformTwistAngle")||t.has("transformTiltAngle")||t.has("transformScale"))&&this._transformValueChanged(),t.has("animatedGlyphsEnable")&&this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable,t.animatedGlyphsEnable),t.has("zoomRectangleEnable")&&this._zoomRectangleEnableChanged(this.zoomRectangleEnable,t.zoomRectangleEnable),t.has("panEnable")&&this._panEnableChanged(this.panEnable,t.panEnable),t.has("panZoomEnable")&&this._panZoomEnableChanged(this.panZoomEnable,t.panZoomEnable),t.has("panWidthZoomLevel")&&this._panWidthZoomLevelChanged(this.panWidthZoomLevel,t.panWidthZoomLevel),t.has("panHeightZoomLevel")&&this._panHeightZoomLevelChanged(this.panHeightZoomLevel,t.panHeightZoomLevel),t.has("panMaximumZoomLevel")&&this._panMaximumZoomLevelChanged(this.panMaximumZoomLevel,t.panMaximumZoomLevel),t.has("trackEnable")&&this._trackEnableChanged(this.trackEnable,t.trackEnable),t.has("displayCanvas")&&this._displayCanvasChanged(this.displayCanvas,t.displayCanvas),t.has("motionCaptureControlsEnable")&&this._motionCaptureControlsEnableChanged(this.motionCaptureControlsEnable,t.motionCaptureControlsEnable),t.has("motionCapture")&&this._motionCaptureValueChanged(this.motionCapture,t.motionCapture),!this.url)return;let e=!1;this.manualUpdate?this.forceUpdate&&(e=!0):(this.forceUpdate||t.has("url")||t.has("renderer")||t.has("urlLoadJsonFile")||t.has("sceneName")||t.has("sceneUserProperties")||t.has("dataSourceName")||t.has("dataSourceUserProperties")||t.has("rendererName")||t.has("rendererUserProperties")||t.has("streamEnable")||this.panEnable&&t.has("panWidthZoomLevel")||this.panEnable&&t.has("panHeightZoomLevel"))&&(e=!0),e&&(this.forceUpdate=!1,this.urlLoadJsonFile?(this.chunkFile=0,this.showSpinner(),this.startSpinner(),this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this))):(this.model=this._assembleModel(),this.model&&(this.showSpinner(),this.startSpinner(),this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this),this.model))))}_handleHttpError(){this.hideSpinner()}updateViewer(){this.forceUpdate=!0,this.requestUpdate()}clear(){if(this.threeViewer)this.threeViewer.clearGeometry(),this.threeViewer.render();else if("SVG"===this.renderer)for(var t=this.svgDiv;t.firstChild;)t.removeChild(t.firstChild);else this.sceneImage.src="data:,";this.showSpinner()}_handleHttpResponse(t){if(t){if(t.selectionInfo&&this._dispatchPickEvents(t.selectionInfo),t.sceneInfo){this.dispatchEvent(new CustomEvent("avs-scene-info",{detail:t.sceneInfo}));const s=this.renderRoot.querySelector("#motionCapture"),o=this.renderRoot.querySelector("#zoomOverlay"),l=this.renderRoot.querySelector("#tooltip"),c=this.renderRoot.querySelector("#motionCaptureTooltip");if(t.sceneInfo.backgroundColor){var e=t.sceneInfo.backgroundColor.match(/[0-9.]+/gi),n=this._getInheritedBackgroundCol(this).trim().match(/[0-9.]+/gi),i=Number(e[0])*Number(e[3]),r=Number(e[1])*Number(e[3]),a=Number(e[2])*Number(e[3]);0==Number(e[3])&&(i+=Number(n[0])*(1-Number(e[3])),r+=Number(n[1])*(1-Number(e[3])),a+=Number(n[2])*(1-Number(e[3]))),s.style.color="var(--avs-motion-capture-color, rgb("+i+", "+r+", "+a+"))",o.style.color="var(--avs-zoom-overlay-color, rgb("+i+","+r+","+a+"))",l.style.color="var(--avs-tooltip-color, rgb("+i+","+r+","+a+"))",c.style.color="var(--avs-tooltip-color, rgb("+i+","+r+","+a+"))"}t.sceneInfo.color&&(e=t.sceneInfo.color.match(/[0-9.]+/gi),s.style.background="var(--avs-motion-capture-background, rgba("+e[0]+","+e[1]+","+e[2]+",0.75))",o.style.background="var(--avs-zoom-overlay-background, rgba("+e[0]+","+e[1]+","+e[2]+",0.75))",l.style.background="var(--avs-tooltip-background, rgb("+e[0]+","+e[1]+","+e[2]+"))",c.style.background="var(--avs-tooltip-background, rgb("+e[0]+","+e[1]+","+e[2]+"))"),t.sceneInfo.fontFamily&&(s.style.fontFamily="var(--avs-motion-capture-font-family, "+t.sceneInfo.fontFamily+")",o.style.fontFamily="var(--avs-zoom-overlay-font-family, "+t.sceneInfo.fontFamily+")",l.style.fontFamily="var(--avs-tooltip-font-family, "+t.sceneInfo.fontFamily+")",c.style.fontFamily="var(--avs-tooltip-font-family, "+t.sceneInfo.fontFamily+")")}if(t.image)this.sceneImage.src=t.image,t.imagemap?(this.sceneImageMap.innerHTML=decodeURIComponent(t.imagemap.replace(/\+/g,"%20")),this.imageMapData=Array.from(this.sceneImageMap.querySelectorAll("area")).map((t=>({shape:t.getAttribute("shape"),coords:t.getAttribute("coords").split(",").map(Number),seriesIndex:t.getAttribute("series-index"),itemIndex:t.getAttribute("item-index"),componentInfo:t.getAttribute("component-info")})))):(this.sceneImageMap.innerHTML="",this.imageMapData=void 0),this.urlLoadJsonFile||this._dispatchSceneData(t),this._handleLoadComplete();else if(t.svg)this.svgDiv.innerHTML=decodeURIComponent(t.svg.replace(/\+/g,"%20")),this.urlLoadJsonFile||this._dispatchSceneData(t),this._handleLoadComplete();else if(t.threejs)if(this.urlLoadJsonFile||this._dispatchSceneData(t),t.threejs.chunkId){if(this.threeViewer.loadGeometryAsEvents(t.threejs,this._handleLoadComplete.bind(this)),t.threejs.moreChunks)if(this.urlLoadJsonFile){this.chunkFile++;const t=this.url.substring(0,this.url.lastIndexOf("."))||this.url,e=this.url.split(".").pop();this._httpRequest(t+"-"+this.chunkFile+"."+e,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this))}else this.model.rendererProperties.streamProperties.chunkId=t.threejs.chunkId,this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this),this.model)}else this.threeViewer.loadGeometryAsJson(t.threejs,this._handleLoadComplete.bind(this));else this._dispatchErrorEvent("No image, SVG, or ThreeJS found in response."),this._handleLoadComplete()}}_getInheritedBackgroundCol(t){var e=this._getDefaultBackground(),n=window.getComputedStyle(t).backgroundColor;return n!=e?n:t.parentElement?this._getInheritedBackgroundCol(t.parentElement):e}_getDefaultBackground(){var t=document.createElement("div");document.head.appendChild(t);var e=window.getComputedStyle(t).backgroundColor;return document.head.removeChild(t),e}_handleLoadComplete(){this.hideSpinner(),this.stopSpinner(),this.dispatchEvent(new CustomEvent("avs-load-complete"))}_dispatchSceneData(t){this.dispatchEvent(new CustomEvent("avs-scene-data",{detail:t}))}_handleTap(t,e,n){const i=this._getAdjustedCoords(t,e),r={type:"TAP",x:i.x,y:i.y,level:this.tapLevel,depth:this.tapDepth,highlight:this.tapHighlightEnable,highlightColor:this.tapHighlightColor,highlightLayer:this.tapHighlightLayerEnable};this._processPick(r,this.tapProcessEventOnClient,n)}_handleTrack(t,e,n,i,r){var a=this._getAdjustedRectangleCoords(e,n,i,r);switch(t){case"start":break;case"track":this.rectCtx.clearRect(0,0,this.width,this.height),this.rectCtx.setLineDash([3]),this.rectCtx.strokeStyle="#ff0000",this.rectCtx.strokeRect(a.left,a.top,a.right-a.left,a.bottom-a.top);break;case"end":this.rectCtx.clearRect(0,0,this.width,this.height);const t={type:"TRACK",left:a.left,right:a.right,top:a.top,bottom:a.bottom,level:this.trackLevel,depth:this.trackDepth,highlight:this.trackHighlightEnable,highlightColor:this.trackHighlightColor,highlightLayer:this.trackHighlightLayerEnable};this._processPick(t,this.trackProcessEventOnClient)}}_handlePointerDown(t){this.pointerDownX=t.clientX,this.pointerDownY=t.clientY,this.pointerDown=!0,this.tapEnable&&1&t.buttons&&(this.tapping=!0),this.trackEnable&&1&t.buttons&&(this.tracking=1)}_handlePointerMove(t){if(this.tracking>=1){if(1===this.tracking){var e=Math.abs(t.clientX-this.pointerDownX),n=Math.abs(t.clientY-this.pointerDownY);e*e+n*n>=5&&(this.tracking=2,this._handleTrack("start",t.clientX,t.clientY,t.clientX-this.pointerDownX,t.clientY-this.pointerDownY))}2===this.tracking&&this._handleTrack("track",t.clientX,t.clientY,t.clientX-this.pointerDownX,t.clientY-this.pointerDownY)}if(this.hoverEnable){var i=this._getAdjustedCoords(t.clientX,t.clientY);const e={type:"HOVER",x:i.x,y:i.y};this.pointerDown?(e.selected=[],this._dispatchPickEvents(e)):(void 0!==this.hoverLevel&&(e.level=this.hoverLevel),void 0!==this.hoverDepth&&(e.depth=this.hoverDepth),this.hoverHighlightEnable&&(e.highlight=!0),void 0!==this.hoverHighlightColor&&(e.highlightColor=this.hoverHighlightColor),this.hoverHighlightLayerEnable&&(e.highlightLayer=!0),this._processPick(e,!0,t.target))}this._resetTimer()}_handlePointerUp(t){if(this.pointerDown=!1,this.tapping){this.tapping=!1;var e=Math.abs(t.clientX-this.pointerDownX),n=Math.abs(t.clientY-this.pointerDownY);e*e+n*n<25&&this._handleTap(t.clientX,t.clientY,t.currentTarget)}this.tracking>1&&(this.tracking=0,this._handleTrack("end",t.clientX,t.clientY,t.clientX-this.pointerDownX,t.clientY-this.pointerDownY))}_getAdjustedCoords(t,e){var n=this.renderRoot.querySelector("#dataVizDiv").getBoundingClientRect(),i=Math.round(t-n.left),r=Math.round(e-n.top);return{x:Math.max(0,Math.min(i,this.width)),y:Math.max(0,Math.min(r,this.height))}}_getAdjustedRectangleCoords(t,e,n,i){var r=this.renderRoot.querySelector("#dataVizDiv").getBoundingClientRect(),a=Math.round(t-r.left),s=Math.round(e-r.top),o=Math.max(0,Math.min(a,this.width)),l=Math.max(0,Math.min(s,this.height)),c=Math.max(0,Math.min(a-n,this.width)),h=Math.max(0,Math.min(s-i,this.height));return{left:Math.min(c,o),right:Math.max(c,o),top:Math.min(h,l),bottom:Math.max(h,l)}}_processPick(t,e,n){if(e)if(this.threeViewer){this.threeViewer.setPickDepth("ALL"===t.depth?lm:cm),"TRACK"===t.type?this.threeViewer.setPickRectangle(t.left,t.top,t.right,t.bottom):this.threeViewer.setPickRay(t.x,t.y),this.threeViewer.pick();var i={};i="CELL"===t.level?this.threeViewer.getPickedCells():"CELL_SET"===t.level?this.threeViewer.getPickedCellSets():this.threeViewer.getPickedSceneNodes(),t.selected=this.threeViewer.getSelectionInfo(i),this._dispatchPickEvents(t),t.highlight&&(this.threeViewer.highlightColor.set(t.highlightColor),this.threeViewer.highlightObjects(i,t.highlightLayer))}else if("SVG"===this.renderer){if(t.selected=[],"TRACK"!==t.type&&("polygon"===n.nodeName||"circle"===n.nodeName)){const e={};for(var r=null,a=n.parentElement;null!==a&&null===(r=a.getAttribute("series-index"));)a=a.parentElement;null!==r&&(e.seriesIndex=parseInt(r));var s=null;for(a=n.parentElement;null!==a&&null===(s=a.getAttribute("item-index"));)a=a.parentElement;null!==s&&(e.itemIndex=parseInt(s));var o=null;for(a=n.parentElement;null!==a&&null===(o=a.getAttribute("component-info"));)a=a.parentElement;null!==o&&(e.componentInfo=decodeURIComponent(o)),t.selected.push(e)}if(this._dispatchPickEvents(t),t.highlight){void 0===this.highlightSvg&&(this.highlightSvg=[]);for(var l=0;l<this.highlightSvg.length;l++)this.highlightSvg[l].setAttribute("fill",this.highlightSvg[l].getAttribute("saveFill"));this.highlightSvg.length=0,"TRACK"===t.type||"polygon"!==n.nodeName&&"circle"!==n.nodeName||(this.highlightSvg.push(n),n.setAttribute("saveFill",n.getAttribute("fill")),n.setAttribute("fill",t.highlightColor))}}else{if(t.selected=[],"TRACK"!==t.type&&void 0!==this.imageMapData)for(l=0;l<this.imageMapData.length;l++){var c=this.imageMapData[l];if(console.log(t.x+" "+t.y),"poly"===c.shape&&this._pointInPoly(t.x,t.y,c.coords)){const e={};null!==c.seriesIndex&&(e.seriesIndex=parseInt(c.seriesIndex)),null!==c.itemIndex&&(e.itemIndex=parseInt(c.itemIndex)),null!==c.componentInfo&&(e.componentInfo=decodeURIComponent(c.componentInfo)),t.selected.push(e)}}this._dispatchPickEvents(t)}else this.urlLoadJsonFile||(this.showSpinner(),this.url&&(this.startSpinner(),this.model=this._assembleModel(),this.model&&(this.model.rendererProperties.pickProperties=t,this._httpRequest(this.url,this._handleHttpResponse.bind(this),this._handleHttpError.bind(this),this.model))))}_pointInPoly(t,e,n){for(var i,r,a,s=n[0]-t,o=n[1]-e,l=0,c=2;c<n.length;c+=2)if(r=n[c+1]-e,o<0&&r<0||o>0&&r>0)o=r,s=n[c]-t;else{if(i=n[c]-t,r>0&&o<=0){if((a=s*r-i*o)>0)l++;else if(0===a)return!1}else if(o>0&&r<=0){if((a=s*r-i*o)<0)l++;else if(0===a)return!1}else if(0===r&&o<0){if(0===(a=s*r-i*o))return!1}else if(0===o&&r<0){if(0===(a=s*r-i*o))return!1}else if(0===o&&0===r){if(i<=0&&s>=0)return!1;if(s<=0&&i>=0)return!1}o=r,s=i}return l%2!=0}_dispatchPickEvents(t){const e={selected:t.selected};"TRACK"===t.type?(e.left=t.left,e.top=t.top,e.right=t.right,e.bottom=t.bottom,this.dispatchEvent(new CustomEvent("avs-track",{detail:e}))):(e.x=t.x,e.y=t.y,"HOVER"===t.type?this.dispatchEvent(new CustomEvent("avs-hover",{detail:e})):this.dispatchEvent(new CustomEvent("avs-tap",{detail:e})))}_resetTimer(){window.clearTimeout(this.timer),this.timer=window.setTimeout((()=>{this.dispatchEvent(new Event("avs-pointer-timeout"))}),1e3*this.pointerTimeout)}constructor(){super(),this.renderer="THREEJS",this.resizeThreshold=10,this.pointerTimeout=600,this.panWidthZoomLevel=100,this.panHeightZoomLevel=100,this.panMaximumZoomLevel=1e3,this.lowResizeWidth=this.highResizeWidth=0,this.highResizeWidth=this.highResizeHeight=0,this.motionCaptureTime=0,this.motionCaptureFrames??=[],this._resetTimer(),this._updatePixelRatio()}connectedCallback(){super.connectedCallback(),Cf.observe(this),this.addEventListener("pointerdown",this._handlePointerDown),this.addEventListener("pointerup",this._handlePointerUp),this.addEventListener("pointermove",this._handlePointerMove),this.addEventListener("pointerout",this._handlePointerMove);var t=this;this.addEventListener("contextmenu",(function(e){t.trackEnable&&e.preventDefault()}))}disconnectedCallback(){super.disconnectedCallback(),Cf.unobserve(this)}_handlePointerEnterMotionCaptureControl(t){if(!this.showMotionCaptureTooltip){var e=this._getAdjustedCoords(t.clientX,t.clientY),n=this.renderRoot.querySelector("#motionCaptureTooltip"),i=this._calcTooltipPosition(n,e.x,e.y);n.style.left=i.x+"px",n.style.top=i.y+"px",n.style.opacity="1";const r=t.currentTarget;n.innerHTML=r.dataset.tooltip??r.id,this.showMotionCaptureTooltip=!0}}_handlePointerLeaveMotionCaptureControl(){this.renderRoot.querySelector("#motionCaptureTooltip").style.opacity="0",this.showMotionCaptureTooltip=!1}_round2dp(t){return Math.round(100*(t+Number.EPSILON))/100}_handleMotionCaptureSnapshot(){const t=this._getTransformComponents();this.motionCaptureFrames.length>0&&(this.motionCaptureTime+=this.motionCaptureDelay);const e={time:1e3*this.motionCaptureTime,scale:this._round2dp(t.scale),position:[this._round2dp(t.position[0]),this._round2dp(t.position[1]),this._round2dp(t.position[2])],rotation:[this._round2dp(t.rotation[0]),this._round2dp(t.rotation[1]),this._round2dp(t.rotation[2]),t.rotation[3]]};this.motionCaptureFrames.push(e),1==this.motionCaptureFrames.length&&(this.renderRoot.querySelector("#motionCapturePlay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureDelay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="2",this.renderRoot.querySelector("#motionCaptureClear").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.remove("disabled"),this.motionCaptureDelay=2),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML=String(this.motionCaptureFrames.length)}_handleMotionCaptureDelayIncrease(){this.motionCaptureDelay++,this.motionCaptureDelay>9&&(this.motionCaptureDelay=9),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML=String(this.motionCaptureDelay)}_handleMotionCaptureDelayDecrease(){this.motionCaptureDelay--,this.motionCaptureDelay<1&&(this.motionCaptureDelay=1),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML=String(this.motionCaptureDelay)}_handleMotionCaptureCopyData(){const t=JSON.stringify(this.motionCaptureFrames);navigator.clipboard.writeText(t);const e=this.renderRoot.querySelector("#motionCaptureAlert");e.innerHTML="Motion capture URL copied to clipboard",e.style.opacity="1",setTimeout((()=>{e.style.opacity="0"}),2e3)}async _handleMotionCaptureCopyUrl(){const t=JSON.stringify(this.motionCaptureFrames),e=await this._compress(t),n=btoa(e).replaceAll("/","_").replaceAll("+","-"),i=window.location.origin+window.location.pathname+"?motionCapture="+n;navigator.clipboard.writeText(i);const r=this.renderRoot.querySelector("#motionCaptureAlert");r.innerHTML="Motion capture URL copied to clipboard",r.style.opacity="1",setTimeout((()=>{r.style.opacity="0"}),2e3)}async _compress(t){const e=(new TextEncoder).encode(t),n=new CompressionStream("gzip"),i=n.writable.getWriter();i.write(e),i.close();const r=await new Response(n.readable).arrayBuffer();return String.fromCharCode(...new Uint8Array(r))}async _decompress(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);const n=new DecompressionStream("gzip"),i=n.writable.getWriter();i.write(e),i.close();const r=await new Response(n.readable).arrayBuffer();return String.fromCharCode(...new Uint8Array(r))}_handleMotionCaptureClear(){this.motionCaptureFrames.length=0,this.renderRoot.querySelector("#motionCapturePlay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureDelay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureClear").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.add("disabled"),this.motionCaptureDelay=0,this.motionCaptureTime=0}_updatePixelRatio(t){const e=window.devicePixelRatio;matchMedia(`(resolution: ${e}dppx)`).addEventListener("change",this._updatePixelRatio.bind(this,!0),{once:!0}),t&&this.updateViewer()}_motionCaptureControlsEnableChanged(t,e){this.renderRoot.querySelector("#motionCapture").style.display=t?"block":"none"}_transformEnableChanged(t,e){this.threeViewer&&(t?(void 0===this.transformInteractor&&(this.transformInteractor=new df(this.renderRoot.querySelector("#dataVizDiv"))),this.threeViewer.addInteractor(this.transformInteractor),this.transformRotateDisable&&(this.transformInteractor.enableRotate=!1),this.transformZoomDisable&&(this.transformInteractor.enableZoom=!1),this.transformPanDisable&&(this.transformInteractor.enablePan=!1),this.transformClientOnly&&(this.transformInteractor.clientOnly=!0)):this.threeViewer.removeInteractor(this.transformInteractor))}_transformClientOnlyChanged(t,e){this.transformInteractor&&(this.transformInteractor.clientOnly=t),this.zoomRectangleInteractor&&(this.zoomRectangleInteractor.clientOnly=t)}_transformRotateDisableChanged(t,e){this.transformInteractor&&(this.transformInteractor.enableRotate=!t)}_transformZoomDisableChanged(t,e){this.transformInteractor&&(this.transformInteractor.enableZoom=!t)}_transformPanDisableChanged(t,e){this.transformInteractor&&(this.transformInteractor.enablePan=!t)}resetTransform(){this.transformInteractor&&this.transformInteractor.reset()}zoomIn(){this.transformInteractor&&this.transformInteractor.zoomIn()}zoomOut(){this.transformInteractor&&this.transformInteractor.zoomOut()}panTo(t,e,n){this.transformInteractor&&this.transformInteractor.panTo(t,e,n)}_getTransformComponents(){var t,e=new Ci,n=new Ai,i=new Ci,r=new lr;return this.transformInteractor&&(t=this.transformInteractor.object.matrix),t.decompose(e,n,i),r.setFromQuaternion(n),{position:e.toArray(),rotation:[180*r.x/Math.PI,180*r.y/Math.PI,180*r.z/Math.PI],rotationOrder:r.order,scale:100*i.x}}getTransformMatrix(){if(this.transformInteractor)return this.transformInteractor.object.matrix.elements.slice()}runAnimation(){if(this.threeViewer){var t=window.getComputedStyle(this,null),e={transform:this.motionCaptureFrames.length>0?JSON.stringify(this.motionCaptureFrames):null};this._applyCustomCssProperties(e,t,{scene:"--avs-scene-animations",sceneTitle:"--avs-scene-title-animations",chart:"--avs-chart-animations",chartTitle:"--avs-chart-title-animations",axis:"--avs-axis-animations",legend:"--avs-legend-animations",legendTitle:"--avs-legend-title-animations",glyph:"--avs-glyph-animations"}),this.animator.setStyleMap(e),this.threeViewer.runAnimation()}}_animatedGlyphsVisibleChanged(t,e){this.threeViewer&&this.threeViewer.setVisibleAnimatedGlyphs(t)}_animatedGlyphsEnableChanged(t,e){this.threeViewer&&this.threeViewer.setEnableAnimatedGlyphs(t)}_transformValueChanged(){var t=void 0!==this.transformTwistAngle?this.transformTwistAngle*Math.PI/180:0,e=void 0!==this.transformTiltAngle?this.transformTiltAngle*Math.PI/180:0,n=void 0!==this.transformScale?this.transformScale/100:1,i=Math.sin(t),r=Math.cos(t),a=Math.sin(e),s=Math.cos(e),o=[r*n,0,s*i*n,0,0,s*n,-a*n,0,-i*n,r*a*n,r*s*n,0,0,0,0,1];this.transformMatrix=o,this.transformInteractor&&this.transformInteractor.object.matrix.fromArray(o)}async _motionCaptureValueChanged(t,e){if(t){try{this.motionCaptureFrames=JSON.parse(t)}catch{const e=atob(t.replaceAll("_","/").replaceAll("-","+")),n=await this._decompress(e);this.motionCaptureFrames=JSON.parse(n)}this.motionCaptureFrames||(this.motionCaptureFrames=[]),this.motionCaptureFrames.length>0?(this.renderRoot.querySelector("#motionCapturePlay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML=String(this.motionCaptureFrames.length),this.renderRoot.querySelector("#motionCaptureDelay").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="2",this.renderRoot.querySelector("#motionCaptureClear").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.remove("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.remove("disabled"),this.motionCaptureDelay=2,this.motionCaptureTime=this.motionCaptureFrames[this.motionCaptureFrames.length-1].time/1e3):(this.renderRoot.querySelector("#motionCapturePlay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureSnapshotLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureDelay").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureDelayLabel").innerHTML="0",this.renderRoot.querySelector("#motionCaptureClear").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyData").classList.add("disabled"),this.renderRoot.querySelector("#motionCaptureCopyUrl").classList.add("disabled"),this.motionCaptureDelay=0,this.motionCaptureTime=0)}}_zoomRectangleEnableChanged(t,e){this.threeViewer&&(t?(void 0===this.zoomRectangleInteractor&&(this.zoomRectangleInteractor=new bf(this)),this.threeViewer.addInteractor(this.zoomRectangleInteractor),this.transformClientOnly&&(this.zoomRectangleInteractor.clientOnly=!0)):this.threeViewer.removeInteractor(this.zoomRectangleInteractor))}_panEnableChanged(t,e){this.threeViewer&&(t?(void 0===this.panInteractor&&(this.panInteractor=new vf(this)),this.threeViewer.addInteractor(this.panInteractor),this.panZoomEnable&&(this.panInteractor.addEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.addEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.addEventListener("zoomEnd",this._handlePanZoomEnd.bind(this))),this.panInteractor.setWidthZoomLevel(this.panWidthZoomLevel),this.panInteractor.setHeightZoomLevel(this.panHeightZoomLevel),this.panInteractor.setMaximumZoomLevel(this.panMaximumZoomLevel),this.panInteractor.saveState()):(this.threeViewer.removeInteractor(this.panInteractor),this.panZoomEnable&&(this.panInteractor.removeEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.removeEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.removeEventListener("zoomEnd",this._handlePanZoomEnd.bind(this)))))}_panZoomEnableChanged(t,e){this.threeViewer&&this.panInteractor&&(t?(this.panInteractor.addEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.addEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.addEventListener("zoomEnd",this._handlePanZoomEnd.bind(this))):(this.panInteractor.removeEventListener("change",this._handlePanChanged.bind(this)),this.panInteractor.removeEventListener("zoom",this._handlePanZoom.bind(this)),this.panInteractor.removeEventListener("zoomEnd",this._handlePanZoomEnd.bind(this))))}_handlePanChanged(t){this.dispatchEvent(new CustomEvent("avs-pan-info",t))}_handlePanZoom(t){window.clearTimeout(this.zoomOverlayTimeoutId);var e=Math.round(t.detail.widthZoomLevel),n=Math.round(t.detail.heightZoomLevel);this.renderRoot.querySelector("#zoomOverlay").innerHTML=e===n?e+"%":e+"%,"+n+"%";var i=this._getAdjustedCoords(t.detail.clientX,t.detail.clientY);const r=this.renderRoot.querySelector("#zoomOverlay");r.style.left=i.x+"px",r.style.top=i.y+"px",r.style.opacity="1",this.pointerDown=!0,this._dispatchPickEvents({type:"HOVER",x:0,y:0,selected:[]}),this.zoomOverlayTimeoutId=window.setTimeout((()=>{this.renderRoot.querySelector("#zoomOverlay").style.opacity="0",this.pointerDown=!1}),1e3)}_handlePanZoomEnd(t){this.panWidthZoomLevel=t.detail.widthZoomLevel,this.panHeightZoomLevel=t.detail.heightZoomLevel}_panWidthZoomLevelChanged(t,e){this.panInteractor&&this.panInteractor.setWidthZoomLevel(t)}_panHeightZoomLevelChanged(t,e){this.panInteractor&&this.panInteractor.setHeightZoomLevel(t)}_panMaximumZoomLevelChanged(t,e){this.panInteractor&&this.panInteractor.setMaximumZoomLevel(t)}resetPan(){this.panInteractor&&this.panInteractor.reset()}_rendererChanged(t,e){if("IMAGE"===e)this.sceneImage.src="data:,",this.renderRoot.querySelector("#dataVizDiv").removeChild(this.sceneImage),this.renderRoot.querySelector("#dataVizDiv").removeChild(this.sceneImageMap);else if("SVG"===e){for(var n=this.svgDiv;n.firstChild;)n.removeChild(n.firstChild);this.renderRoot.querySelector("#dataVizDiv").removeChild(this.svgDiv)}else this.threeViewer&&(this.threeViewer.clearGeometry(),this.threeViewer.render(),this.renderRoot.querySelector("#dataVizDiv").removeChild(this.threeViewer.domElement));if("IMAGE"===t)void 0===this.sceneImage&&(this.sceneImage=document.createElement("img"),this.sceneImage.setAttribute("id","sceneImage"),this.sceneImage.setAttribute("usemap","#sceneImageMap"),this.sceneImageMap=document.createElement("map"),this.sceneImageMap.setAttribute("id","sceneImageMap"),this.sceneImageMap.setAttribute("name","sceneImageMap")),this.renderRoot.querySelector("#dataVizDiv").appendChild(this.sceneImage),this.renderRoot.querySelector("#dataVizDiv").appendChild(this.sceneImageMap),this.threeViewer=null;else if("SVG"===t)void 0===this.svgDiv&&(this.svgDiv=document.createElement("div"),this.svgDiv.setAttribute("id","svgDiv")),this.renderRoot.querySelector("#dataVizDiv").appendChild(this.svgDiv),this.threeViewer=null;else{if(!this.threeViewer){this.threeViewer=new of;var i="avsDefaultWebGLRenderer",r=document.getElementById(i);null==r&&((r=new om).setAttribute("id",i),document.body.appendChild(r)),this.threeViewer.setWebGLRenderer(r.webGLRenderer),this.animator=new Ef,this.threeViewer.setAnimator(this.animator)}this.renderRoot.querySelector("#dataVizDiv").appendChild(this.threeViewer.domElement)}}_trackEnableChanged(t,e){t?(void 0===this.rectCanvas&&(this.rectCanvas=document.createElement("canvas"),this.rectCanvas.setAttribute("id","rectCanvas"),this.rectCtx=this.rectCanvas.getContext("2d")),this.renderRoot.appendChild(this.rectCanvas)):this.renderRoot.removeChild(this.rectCanvas)}_displayCanvasChanged(t,e){this.threeViewer&&(this.threeViewer.displayCanvas=t)}setTooltipHTML(t){this.renderRoot.querySelector("#tooltip").innerHTML=t}showTooltip(t,e){var n=this.renderRoot.querySelector("#tooltip"),i=this._calcTooltipPosition(n,t,e);n.style.left=i.x+"px",n.style.top=i.y+"px",n.style.opacity="1"}hideTooltip(){this.renderRoot.querySelector("#tooltip").style.opacity="0"}_calcTooltipPosition(t,e,n){var i=this.renderRoot.querySelector("#dataVizDiv"),r=this._getOffset(i),a=-Math.min(0,r.top-window.pageYOffset),s=-Math.min(0,r.left-window.pageXOffset),o=-Math.min(0,window.innerHeight-(i.offsetHeight+r.top-window.pageYOffset)),l=-Math.min(0,window.innerWidth-(i.offsetWidth+r.left-window.pageXOffset)),c=(i.offsetHeight-a-o)/2+a,h={x:0,y:0};if(e<(i.offsetWidth-s-l)/2+s){var d=n<c?15:5;h.x=e+d+i.offsetLeft}else h.x=e-10+i.offsetLeft-t.offsetWidth;return h.y=n<c?n+5+i.offsetTop:n-10+i.offsetTop-t.offsetHeight,h}_getOffset(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+i,left:e.left+n}}},Af([ut({attribute:"manual-update",type:Boolean})],t.AvsGoDataViz.prototype,"manualUpdate",void 0),Af([ut({attribute:"display-canvas",type:Boolean})],t.AvsGoDataViz.prototype,"displayCanvas",void 0),Af([ut()],t.AvsGoDataViz.prototype,"url",void 0),Af([ut({attribute:"url-load-json-file",type:Boolean})],t.AvsGoDataViz.prototype,"urlLoadJsonFile",void 0),Af([ut({attribute:"data-source-name"})],t.AvsGoDataViz.prototype,"dataSourceName",void 0),Af([ut({attribute:"data-source-user-properties"})],t.AvsGoDataViz.prototype,"dataSourceUserProperties",void 0),Af([ut({attribute:"scene-name"})],t.AvsGoDataViz.prototype,"sceneName",void 0),Af([ut({attribute:"scene-user-properties"})],t.AvsGoDataViz.prototype,"sceneUserProperties",void 0),Af([ut({attribute:"renderer-name"})],t.AvsGoDataViz.prototype,"rendererName",void 0),Af([ut({attribute:"renderer-user-properties"})],t.AvsGoDataViz.prototype,"rendererUserProperties",void 0),Af([ut()],t.AvsGoDataViz.prototype,"renderer",void 0),Af([ut({attribute:"stream-enable",type:Boolean})],t.AvsGoDataViz.prototype,"streamEnable",void 0),Af([ut({attribute:"stream-chunk-size-first"})],t.AvsGoDataViz.prototype,"streamChunkSizeFirst",void 0),Af([ut({attribute:"stream-chunk-size"})],t.AvsGoDataViz.prototype,"streamChunkSize",void 0),Af([ut({attribute:"theme-name"})],t.AvsGoDataViz.prototype,"themeName",void 0),Af([ut({attribute:"resize-threshold"})],t.AvsGoDataViz.prototype,"resizeThreshold",void 0),Af([ut({attribute:"pointer-timeout"})],t.AvsGoDataViz.prototype,"pointerTimeout",void 0),Af([ut({attribute:"tap-enable",type:Boolean})],t.AvsGoDataViz.prototype,"tapEnable",void 0),Af([ut({attribute:"tap-level"})],t.AvsGoDataViz.prototype,"tapLevel",void 0),Af([ut({attribute:"tap-depth"})],t.AvsGoDataViz.prototype,"tapDepth",void 0),Af([ut({attribute:"tap-highlight-enable",type:Boolean})],t.AvsGoDataViz.prototype,"tapHighlightEnable",void 0),Af([ut({attribute:"tap-highlight-color"})],t.AvsGoDataViz.prototype,"tapHighlightColor",void 0),Af([ut({attribute:"tap-highlight-layer-enable",type:Boolean})],t.AvsGoDataViz.prototype,"tapHighlightLayerEnable",void 0),Af([ut({attribute:"tap-process-event-on-client",type:Boolean})],t.AvsGoDataViz.prototype,"tapProcessEventOnClient",void 0),Af([ut({attribute:"track-enable",type:Boolean})],t.AvsGoDataViz.prototype,"trackEnable",void 0),Af([ut({attribute:"track-level"})],t.AvsGoDataViz.prototype,"trackLevel",void 0),Af([ut({attribute:"track-depth"})],t.AvsGoDataViz.prototype,"trackDepth",void 0),Af([ut({attribute:"track-highlight-enable",type:Boolean})],t.AvsGoDataViz.prototype,"trackHighlightEnable",void 0),Af([ut({attribute:"track-highlight-color"})],t.AvsGoDataViz.prototype,"trackHighlightColor",void 0),Af([ut({attribute:"track-highlight-layer-enable",type:Boolean})],t.AvsGoDataViz.prototype,"trackHighlightLayerEnable",void 0),Af([ut({attribute:"track-process-event-on-client",type:Boolean})],t.AvsGoDataViz.prototype,"trackProcessEventOnClient",void 0),Af([ut({attribute:"hover-enable",type:Boolean})],t.AvsGoDataViz.prototype,"hoverEnable",void 0),Af([ut({attribute:"hover-level"})],t.AvsGoDataViz.prototype,"hoverLevel",void 0),Af([ut({attribute:"hover-depth"})],t.AvsGoDataViz.prototype,"hoverDepth",void 0),Af([ut({attribute:"hover-highlight-enable",type:Boolean})],t.AvsGoDataViz.prototype,"hoverHighlightEnable",void 0),Af([ut({attribute:"hover-highlight-color"})],t.AvsGoDataViz.prototype,"hoverHighlightColor",void 0),Af([ut({attribute:"hover-highlight-layer-enable",type:Boolean})],t.AvsGoDataViz.prototype,"hoverHighlightLayerEnable",void 0),Af([ut({attribute:"transform-enable",type:Boolean})],t.AvsGoDataViz.prototype,"transformEnable",void 0),Af([ut({attribute:"transform-client-only",type:Boolean})],t.AvsGoDataViz.prototype,"transformClientOnly",void 0),Af([ut({attribute:"transform-rotate-disable",type:Boolean})],t.AvsGoDataViz.prototype,"transformRotateDisable",void 0),Af([ut({attribute:"transform-zoom-disable",type:Boolean})],t.AvsGoDataViz.prototype,"transformZoomDisable",void 0),Af([ut({attribute:"transform-pan-disable",type:Boolean})],t.AvsGoDataViz.prototype,"transformPanDisable",void 0),Af([ut({attribute:"transform-twist-angle"})],t.AvsGoDataViz.prototype,"transformTwistAngle",void 0),Af([ut({attribute:"transform-tilt-angle"})],t.AvsGoDataViz.prototype,"transformTiltAngle",void 0),Af([ut({attribute:"transform-scale"})],t.AvsGoDataViz.prototype,"transformScale",void 0),Af([ut({attribute:"motion-capture"})],t.AvsGoDataViz.prototype,"motionCapture",void 0),Af([ut({attribute:"zoom-rectangle-enable",type:Boolean})],t.AvsGoDataViz.prototype,"zoomRectangleEnable",void 0),Af([ut({attribute:"pan-enable",type:Boolean})],t.AvsGoDataViz.prototype,"panEnable",void 0),Af([ut({attribute:"pan-zoom-enable",type:Boolean})],t.AvsGoDataViz.prototype,"panZoomEnable",void 0),Af([ut({attribute:"pan-width-zoom-level"})],t.AvsGoDataViz.prototype,"panWidthZoomLevel",void 0),Af([ut({attribute:"pan-height-zoom-level"})],t.AvsGoDataViz.prototype,"panHeightZoomLevel",void 0),Af([ut({attribute:"pan-maximum-zoom-level"})],t.AvsGoDataViz.prototype,"panMaximumZoomLevel",void 0),Af([ut({attribute:"animated-glyphs-visible",type:Boolean})],t.AvsGoDataViz.prototype,"animatedGlyphsVisible",void 0),Af([ut({attribute:"animated-glyphs-enable",type:Boolean})],t.AvsGoDataViz.prototype,"animatedGlyphsEnable",void 0),Af([ut({attribute:"motion-capture-controls-enable",type:Boolean})],t.AvsGoDataViz.prototype,"motionCaptureControlsEnable",void 0),t.AvsGoDataViz=Af([ct("avs-go-dataviz")],t.AvsGoDataViz);
|
|
339
339
|
/**
|
|
340
340
|
* @license
|
|
341
341
|
* Copyright 2018-2026 Advanced Visual Systems Inc.
|
|
@@ -355,9 +355,9 @@ var Af=function(t,e,n,i){var r,a=arguments.length,s=a<3?e:null===i?i=Object.getO
|
|
|
355
355
|
* This product includes software developed at
|
|
356
356
|
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
357
357
|
*/
|
|
358
|
-
var Rf=function(t,e,n,i){var r,a=arguments.length,s=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(s=(a<3?r(s):a>3?r(e,n,s):r(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};
|
|
359
|
-
/*! @license DOMPurify 3.4.
|
|
360
|
-
const{entries:If,setPrototypeOf:Pf,isFrozen:Lf,getPrototypeOf:Df,getOwnPropertyDescriptor:Nf}=Object;let{freeze:Of,seal:Uf,create:Ff}=Object,{apply:zf,construct:kf}="undefined"!=typeof Reflect&&Reflect;Of||(Of=function(t){return t}),Uf||(Uf=function(t){return t}),zf||(zf=function(t,e){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return t.apply(e,i)}),kf||(kf=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return new t(...n)});const Bf=og(Array.prototype.forEach),Gf=og(Array.prototype.lastIndexOf),Vf=og(Array.prototype.pop),Hf=og(Array.prototype.push),Wf=og(Array.prototype.splice),jf=Array.isArray,Xf=og(String.prototype.toLowerCase),qf=og(String.prototype.toString),Yf=og(String.prototype.match),Zf=og(String.prototype.replace),$f=og(String.prototype.indexOf),Jf=og(String.prototype.trim),Kf=og(Number.prototype.toString),Qf=og(Boolean.prototype.toString),tg="undefined"==typeof BigInt?null:og(BigInt.prototype.toString),eg="undefined"==typeof Symbol?null:og(Symbol.prototype.toString),ng=og(Object.prototype.hasOwnProperty),ig=og(Object.prototype.toString),rg=og(RegExp.prototype.test),ag=(sg=TypeError,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return kf(sg,e)});var sg;function og(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return zf(t,e,i)}}function lg(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Xf;if(Pf&&Pf(t,null),!jf(e))return t;let i=e.length;for(;i--;){let r=e[i];if("string"==typeof r){const t=n(r);t!==r&&(Lf(e)||(e[i]=t),r=t)}t[r]=!0}return t}function cg(t){for(let e=0;e<t.length;e++)ng(t,e)||(t[e]=null);return t}function hg(t){const e=Ff(null);for(const[n,i]of If(t))ng(t,n)&&(jf(i)?e[n]=cg(i):i&&"object"==typeof i&&i.constructor===Object?e[n]=hg(i):e[n]=i);return e}function dg(t,e){for(;null!==t;){const n=Nf(t,e);if(n){if(n.get)return og(n.get);if("function"==typeof n.value)return og(n.value)}t=Df(t)}return function(){return null}}const ug=Of(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),pg=Of(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),mg=Of(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),fg=Of(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),gg=Of(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),vg=Of(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_g=Of(["#text"]),yg=Of(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),xg=Of(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),bg=Of(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sg=Of(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Mg=Uf(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wg=Uf(/<%[\w\W]*|[\w\W]*%>/gm),Eg=Uf(/\$\{[\w\W]*/gm),Tg=Uf(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ag=Uf(/^aria-[\-\w]+$/),Cg=Uf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Rg=Uf(/^(?:\w+script|data):/i),Ig=Uf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Pg=Uf(/^html$/i),Lg=Uf(/^[a-z][.\w]*(-[.\w]+)+$/i);var Dg=Object.freeze({__proto__:null,ARIA_ATTR:Ag,ATTR_WHITESPACE:Ig,CUSTOM_ELEMENT:Lg,DATA_ATTR:Tg,DOCTYPE_NAME:Pg,ERB_EXPR:wg,IS_ALLOWED_URI:Cg,IS_SCRIPT_OR_DATA:Rg,MUSTACHE_EXPR:Mg,TMPLIT_EXPR:Eg});const Ng=1,Og=3,Ug=7,Fg=8,zg=9,kg=function(){return"undefined"==typeof window?null:window};var Bg=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kg();const n=e=>t(e);if(n.version="3.4.2",n.removed=[],!e||!e.document||e.document.nodeType!==zg||!e.Element)return n.isSupported=!1,n;let{document:i}=e;const r=i,a=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:h,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:p,trustedTypes:m}=e,f=c.prototype,g=dg(f,"cloneNode"),v=dg(f,"remove"),_=dg(f,"nextSibling"),y=dg(f,"childNodes"),x=dg(f,"parentNode");if("function"==typeof o){const t=i.createElement("template");t.content&&t.content.ownerDocument&&(i=t.content.ownerDocument)}let b,S="";const{implementation:M,createNodeIterator:w,createDocumentFragment:E,getElementsByTagName:T}=i,{importNode:A}=r;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof If&&"function"==typeof x&&M&&void 0!==M.createHTMLDocument;const{MUSTACHE_EXPR:R,ERB_EXPR:I,TMPLIT_EXPR:P,DATA_ATTR:L,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:O,CUSTOM_ELEMENT:U}=Dg;let{IS_ALLOWED_URI:F}=Dg,z=null;const k=lg({},[...ug,...pg,...mg,...gg,..._g]);let B=null;const G=lg({},[...yg,...xg,...bg,...Sg]);let V=Object.seal(Ff(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),H=null,W=null;const j=Object.seal(Ff(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let X=!0,q=!0,Y=!1,Z=!0,$=!1,J=!0,K=!1,Q=!1,tt=!1,et=!1,nt=!1,it=!1,rt=!0,at=!1;const st="user-content-";let ot=!0,lt=!1,ct={},ht=null;const dt=lg({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ut=null;const pt=lg({},["audio","video","img","source","image","track"]);let mt=null;const ft=lg({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gt="http://www.w3.org/1998/Math/MathML",vt="http://www.w3.org/2000/svg",_t="http://www.w3.org/1999/xhtml";let yt=_t,xt=!1,bt=null;const St=lg({},[gt,vt,_t],qf);let Mt=lg({},["mi","mo","mn","ms","mtext"]),wt=lg({},["annotation-xml"]);const Et=lg({},["title","style","font","a","script"]);let Tt=null;const At=["application/xhtml+xml","text/html"];let Ct=null,Rt=null;const It=i.createElement("form"),Pt=function(t){return t instanceof RegExp||t instanceof Function},Lt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Rt&&Rt===t)return;t&&"object"==typeof t||(t={}),t=hg(t),Tt=-1===At.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ct="application/xhtml+xml"===Tt?qf:Xf,z=ng(t,"ALLOWED_TAGS")&&jf(t.ALLOWED_TAGS)?lg({},t.ALLOWED_TAGS,Ct):k,B=ng(t,"ALLOWED_ATTR")&&jf(t.ALLOWED_ATTR)?lg({},t.ALLOWED_ATTR,Ct):G,bt=ng(t,"ALLOWED_NAMESPACES")&&jf(t.ALLOWED_NAMESPACES)?lg({},t.ALLOWED_NAMESPACES,qf):St,mt=ng(t,"ADD_URI_SAFE_ATTR")&&jf(t.ADD_URI_SAFE_ATTR)?lg(hg(ft),t.ADD_URI_SAFE_ATTR,Ct):ft,ut=ng(t,"ADD_DATA_URI_TAGS")&&jf(t.ADD_DATA_URI_TAGS)?lg(hg(pt),t.ADD_DATA_URI_TAGS,Ct):pt,ht=ng(t,"FORBID_CONTENTS")&&jf(t.FORBID_CONTENTS)?lg({},t.FORBID_CONTENTS,Ct):dt,H=ng(t,"FORBID_TAGS")&&jf(t.FORBID_TAGS)?lg({},t.FORBID_TAGS,Ct):hg({}),W=ng(t,"FORBID_ATTR")&&jf(t.FORBID_ATTR)?lg({},t.FORBID_ATTR,Ct):hg({}),ct=!!ng(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?hg(t.USE_PROFILES):t.USE_PROFILES),X=!1!==t.ALLOW_ARIA_ATTR,q=!1!==t.ALLOW_DATA_ATTR,Y=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Z=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,$=t.SAFE_FOR_TEMPLATES||!1,J=!1!==t.SAFE_FOR_XML,K=t.WHOLE_DOCUMENT||!1,et=t.RETURN_DOM||!1,nt=t.RETURN_DOM_FRAGMENT||!1,it=t.RETURN_TRUSTED_TYPE||!1,tt=t.FORCE_BODY||!1,rt=!1!==t.SANITIZE_DOM,at=t.SANITIZE_NAMED_PROPS||!1,ot=!1!==t.KEEP_CONTENT,lt=t.IN_PLACE||!1,F=function(t){try{return rg(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Cg,yt="string"==typeof t.NAMESPACE?t.NAMESPACE:_t,Mt=ng(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?hg(t.MATHML_TEXT_INTEGRATION_POINTS):lg({},["mi","mo","mn","ms","mtext"]),wt=ng(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?hg(t.HTML_INTEGRATION_POINTS):lg({},["annotation-xml"]);const e=ng(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?hg(t.CUSTOM_ELEMENT_HANDLING):Ff(null);if(V=Ff(null),ng(e,"tagNameCheck")&&Pt(e.tagNameCheck)&&(V.tagNameCheck=e.tagNameCheck),ng(e,"attributeNameCheck")&&Pt(e.attributeNameCheck)&&(V.attributeNameCheck=e.attributeNameCheck),ng(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(V.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),$&&(q=!1),nt&&(et=!0),ct&&(z=lg({},_g),B=Ff(null),!0===ct.html&&(lg(z,ug),lg(B,yg)),!0===ct.svg&&(lg(z,pg),lg(B,xg),lg(B,Sg)),!0===ct.svgFilters&&(lg(z,mg),lg(B,xg),lg(B,Sg)),!0===ct.mathMl&&(lg(z,gg),lg(B,bg),lg(B,Sg))),j.tagCheck=null,j.attributeCheck=null,ng(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?j.tagCheck=t.ADD_TAGS:jf(t.ADD_TAGS)&&(z===k&&(z=hg(z)),lg(z,t.ADD_TAGS,Ct))),ng(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?j.attributeCheck=t.ADD_ATTR:jf(t.ADD_ATTR)&&(B===G&&(B=hg(B)),lg(B,t.ADD_ATTR,Ct))),ng(t,"ADD_URI_SAFE_ATTR")&&jf(t.ADD_URI_SAFE_ATTR)&&lg(mt,t.ADD_URI_SAFE_ATTR,Ct),ng(t,"FORBID_CONTENTS")&&jf(t.FORBID_CONTENTS)&&(ht===dt&&(ht=hg(ht)),lg(ht,t.FORBID_CONTENTS,Ct)),ng(t,"ADD_FORBID_CONTENTS")&&jf(t.ADD_FORBID_CONTENTS)&&(ht===dt&&(ht=hg(ht)),lg(ht,t.ADD_FORBID_CONTENTS,Ct)),ot&&(z["#text"]=!0),K&&lg(z,["html","head","body"]),z.table&&(lg(z,["tbody"]),delete H.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw ag('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw ag('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=t.TRUSTED_TYPES_POLICY,S=b.createHTML("")}else void 0===b&&(b=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(n=e.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return t.createPolicy(r,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(m,a)),null!==b&&"string"==typeof S&&(S=b.createHTML(""));Of&&Of(t),Rt=t},Dt=lg({},[...pg,...mg,...fg]),Nt=lg({},[...gg,...vg]),Ot=function(t){Hf(n.removed,{element:t});try{x(t).removeChild(t)}catch(e){v(t)}},Ut=function(t,e){try{Hf(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Hf(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(et||nt)try{Ot(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ft=function(t){let e=null,n=null;if(tt)t="<remove></remove>"+t;else{const e=Yf(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===Tt&&yt===_t&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const r=b?b.createHTML(t):t;if(yt===_t)try{e=(new p).parseFromString(r,Tt)}catch(t){}if(!e||!e.documentElement){e=M.createDocument(yt,"template",null);try{e.documentElement.innerHTML=xt?S:r}catch(t){}}const a=e.body||e.documentElement;return t&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),yt===_t?T.call(e,K?"html":"body")[0]:K?e.documentElement:a},zt=function(t){return w.call(t.ownerDocument||t,t,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},kt=function(t){return t instanceof u&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof d)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Bt=function(t){return"function"==typeof l&&t instanceof l};function Gt(t,e,i){Bf(t,(t=>{t.call(n,e,i,Rt)}))}const Vt=function(t){let e=null;if(Gt(C.beforeSanitizeElements,t,null),kt(t))return Ot(t),!0;const i=Ct(t.nodeName);if(Gt(C.uponSanitizeElement,t,{tagName:i,allowedTags:z}),J&&t.hasChildNodes()&&!Bt(t.firstElementChild)&&rg(/<[/\w!]/g,t.innerHTML)&&rg(/<[/\w!]/g,t.textContent))return Ot(t),!0;if(J&&t.namespaceURI===_t&&"style"===i&&Bt(t.firstElementChild))return Ot(t),!0;if(t.nodeType===Ug)return Ot(t),!0;if(J&&t.nodeType===Fg&&rg(/<[/\w]/g,t.data))return Ot(t),!0;if(H[i]||!(j.tagCheck instanceof Function&&j.tagCheck(i))&&!z[i]){if(!H[i]&&jt(i)){if(V.tagNameCheck instanceof RegExp&&rg(V.tagNameCheck,i))return!1;if(V.tagNameCheck instanceof Function&&V.tagNameCheck(i))return!1}if(ot&&!ht[i]){const e=x(t)||t.parentNode,n=y(t)||t.childNodes;if(n&&e)for(let i=n.length-1;i>=0;--i){const r=g(n[i],!0);e.insertBefore(r,_(t))}}return Ot(t),!0}return t instanceof c&&!function(t){let e=x(t);e&&e.tagName||(e={namespaceURI:yt,tagName:"template"});const n=Xf(t.tagName),i=Xf(e.tagName);return!!bt[t.namespaceURI]&&(t.namespaceURI===vt?e.namespaceURI===_t?"svg"===n:e.namespaceURI===gt?"svg"===n&&("annotation-xml"===i||Mt[i]):Boolean(Dt[n]):t.namespaceURI===gt?e.namespaceURI===_t?"math"===n:e.namespaceURI===vt?"math"===n&&wt[i]:Boolean(Nt[n]):t.namespaceURI===_t?!(e.namespaceURI===vt&&!wt[i])&&!(e.namespaceURI===gt&&!Mt[i])&&!Nt[n]&&(Et[n]||!Dt[n]):!("application/xhtml+xml"!==Tt||!bt[t.namespaceURI]))}(t)?(Ot(t),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!rg(/<\/no(script|embed|frames)/i,t.innerHTML)?($&&t.nodeType===Og&&(e=t.textContent,Bf([R,I,P],(t=>{e=Zf(e,t," ")})),t.textContent!==e&&(Hf(n.removed,{element:t.cloneNode()}),t.textContent=e)),Gt(C.afterSanitizeElements,t,null),!1):(Ot(t),!0)},Ht=function(t,e,n){if(W[e])return!1;if(rt&&("id"===e||"name"===e)&&(n in i||n in It))return!1;const r=B[e]||j.attributeCheck instanceof Function&&j.attributeCheck(e,t);if(q&&!W[e]&&rg(L,e));else if(X&&rg(D,e));else if(!r||W[e]){if(!(jt(t)&&(V.tagNameCheck instanceof RegExp&&rg(V.tagNameCheck,t)||V.tagNameCheck instanceof Function&&V.tagNameCheck(t))&&(V.attributeNameCheck instanceof RegExp&&rg(V.attributeNameCheck,e)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(e,t))||"is"===e&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&rg(V.tagNameCheck,n)||V.tagNameCheck instanceof Function&&V.tagNameCheck(n))))return!1}else if(mt[e]);else if(rg(F,Zf(n,O,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==$f(n,"data:")||!ut[t])if(Y&&!rg(N,Zf(n,O,"")));else if(n)return!1;return!0},Wt=lg({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),jt=function(t){return!Wt[Xf(t)]&&rg(U,t)},Xt=function(t){Gt(C.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||kt(t))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let r=e.length;for(;r--;){const a=e[r],{name:s,namespaceURI:o,value:l}=a,c=Ct(s),h=l;let d="value"===s?h:Jf(h);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,Gt(C.uponSanitizeAttribute,t,i),d=i.attrValue,!at||"id"!==c&&"name"!==c||0===$f(d,st)||(Ut(s,t),d=st+d),J&&rg(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Ut(s,t);continue}if("attributename"===c&&Yf(d,"href")){Ut(s,t);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){Ut(s,t);continue}if(!Z&&rg(/\/>/i,d)){Ut(s,t);continue}$&&Bf([R,I,P],(t=>{d=Zf(d,t," ")}));const u=Ct(t.nodeName);if(Ht(u,c,d)){if(b&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(o);else switch(m.getAttributeType(u,c)){case"TrustedHTML":d=b.createHTML(d);break;case"TrustedScriptURL":d=b.createScriptURL(d)}if(d!==h)try{o?t.setAttributeNS(o,s,d):t.setAttribute(s,d),kt(t)?Ot(t):Vf(n.removed)}catch(e){Ut(s,t)}}else Ut(s,t)}Gt(C.afterSanitizeAttributes,t,null)},qt=function(t){let e=null;const n=zt(t);for(Gt(C.beforeSanitizeShadowDOM,t,null);e=n.nextNode();)Gt(C.uponSanitizeShadowNode,e,null),Vt(e),Xt(e),e.content instanceof s&&qt(e.content);Gt(C.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,a=null,o=null,c=null;if(xt=!t,xt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Bt(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return Kf(t);case"boolean":return Qf(t);case"bigint":return tg?tg(t):"0";case"symbol":return eg?eg(t):"Symbol()";case"undefined":default:return ig(t);case"function":case"object":{if(null===t)return ig(t);const e=t,n=dg(e,"toString");if("function"==typeof n){const t=n(e);return"string"==typeof t?t:ig(t)}return ig(t)}}}(t)))throw ag("dirty is not a string, aborting");if(!n.isSupported)return t;if(Q||Lt(e),n.removed=[],"string"==typeof t&&(lt=!1),lt){const e=t.nodeName;if("string"==typeof e){const t=Ct(e);if(!z[t]||H[t])throw ag("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)i=Ft("\x3c!----\x3e"),a=i.ownerDocument.importNode(t,!0),a.nodeType===Ng&&"BODY"===a.nodeName||"HTML"===a.nodeName?i=a:i.appendChild(a);else{if(!et&&!$&&!K&&-1===t.indexOf("<"))return b&&it?b.createHTML(t):t;if(i=Ft(t),!i)return et?null:it?S:""}i&&tt&&Ot(i.firstChild);const h=zt(lt?t:i);for(;o=h.nextNode();)Vt(o),Xt(o),o.content instanceof s&&qt(o.content);if(lt)return t;if(et){if($){i.normalize();let t=i.innerHTML;Bf([R,I,P],(e=>{t=Zf(t,e," ")})),i.innerHTML=t}if(nt)for(c=E.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(B.shadowroot||B.shadowrootmode)&&(c=A.call(r,c,!0)),c}let d=K?i.outerHTML:i.innerHTML;return K&&z["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&rg(Pg,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),$&&Bf([R,I,P],(t=>{d=Zf(d,t," ")})),b&&it?b.createHTML(d):d},n.setConfig=function(){Lt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},n.clearConfig=function(){Rt=null,Q=!1},n.isValidAttribute=function(t,e,n){Rt||Lt({});const i=Ct(t),r=Ct(e);return Ht(i,r,n)},n.addHook=function(t,e){"function"==typeof e&&Hf(C[t],e)},n.removeHook=function(t,e){if(void 0!==e){const n=Gf(C[t],e);return-1===n?void 0:Wf(C[t],n,1)[0]}return Vf(C[t])},n.removeHooks=function(t){C[t]=[]},n.removeAllHooks=function(){C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Gg=function(t,e,n,i){var r,a=arguments.length,s=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(s=(a<3?r(s):a>3?r(e,n,s):r(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};
|
|
358
|
+
var Rf=function(t,e,n,i){var r,a=arguments.length,s=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(s=(a<3?r(s):a>3?r(e,n,s):r(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};
|
|
359
|
+
/*! @license DOMPurify 3.4.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.5/LICENSE */
|
|
360
|
+
function If(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Pf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,a,s,o=[],l=!0,c=!1;try{if(a=(n=n.call(t)).next,0===e);else for(;!(l=(i=a.call(n)).done)&&(o.push(i.value),o.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return If(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?If(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}t.AvsGoInfo=class extends(e(ot)){constructor(){super(...arguments),this.url=""}updateInfo(){if(!this.url||this.url.length<1)return void this._dispatchErrorEvent("'url' property must be set to an instance of AVS/Go server.");if(!this.infoName)return void this._dispatchErrorEvent("'info-name' property must be set to the name of the info registered in the library map on the AVS/Go server.");const t={infoProperties:{name:this.infoName}};if(this.infoUserProperties){let e;try{e=JSON.parse(this.infoUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'info-user-properties'. "+t)}t.infoProperties.userProperties=e}if(this.dataSourceName&&(t.dataSourceProperties={name:this.dataSourceName},this.dataSourceUserProperties)){let e;try{e=JSON.parse(this.dataSourceUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. "+t)}t.dataSourceProperties.userProperties=e}this._httpRequest(this.url,(t=>{if(t.info){const e=JSON.parse(decodeURIComponent(t.info.replace(/\+/g,"%20")));this.dispatchEvent(new CustomEvent("avs-go-info-response",{bubbles:!0,composed:!0,detail:e}))}else this._dispatchErrorEvent("Empty response from AVS/Go server.")}),void 0,t)}},Rf([ut()],t.AvsGoInfo.prototype,"url",void 0),Rf([ut({attribute:"data-source-name"})],t.AvsGoInfo.prototype,"dataSourceName",void 0),Rf([ut({attribute:"data-source-user-properties"})],t.AvsGoInfo.prototype,"dataSourceUserProperties",void 0),Rf([ut({attribute:"info-name"})],t.AvsGoInfo.prototype,"infoName",void 0),Rf([ut({attribute:"info-user-properties"})],t.AvsGoInfo.prototype,"infoUserProperties",void 0),t.AvsGoInfo=Rf([ct("avs-go-info")],t.AvsGoInfo);const Lf=Object.entries,Df=Object.setPrototypeOf,Nf=Object.isFrozen,Of=Object.getPrototypeOf,Uf=Object.getOwnPropertyDescriptor;let Ff=Object.freeze,zf=Object.seal,kf=Object.create,Bf="undefined"!=typeof Reflect&&Reflect,Gf=Bf.apply,Vf=Bf.construct;Ff||(Ff=function(t){return t}),zf||(zf=function(t){return t}),Gf||(Gf=function(t,e){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return t.apply(e,i)}),Vf||(Vf=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return new t(...n)});const Hf=hg(Array.prototype.forEach),Wf=hg(Array.prototype.lastIndexOf),jf=hg(Array.prototype.pop),Xf=hg(Array.prototype.push),qf=hg(Array.prototype.splice),Yf=Array.isArray,Zf=hg(String.prototype.toLowerCase),$f=hg(String.prototype.toString),Jf=hg(String.prototype.match),Kf=hg(String.prototype.replace),Qf=hg(String.prototype.indexOf),tg=hg(String.prototype.trim),eg=hg(Number.prototype.toString),ng=hg(Boolean.prototype.toString),ig="undefined"==typeof BigInt?null:hg(BigInt.prototype.toString),rg="undefined"==typeof Symbol?null:hg(Symbol.prototype.toString),ag=hg(Object.prototype.hasOwnProperty),sg=hg(Object.prototype.toString),og=hg(RegExp.prototype.test),lg=(cg=TypeError,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Vf(cg,e)});var cg;function hg(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Gf(t,e,i)}}function dg(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Zf;if(Df&&Df(t,null),!Yf(e))return t;let i=e.length;for(;i--;){let r=e[i];if("string"==typeof r){const t=n(r);t!==r&&(Nf(e)||(e[i]=t),r=t)}t[r]=!0}return t}function ug(t){for(let e=0;e<t.length;e++)ag(t,e)||(t[e]=null);return t}function pg(t){const e=kf(null);for(const i of Lf(t)){var n=Pf(i,2);const r=n[0],a=n[1];ag(t,r)&&(Yf(a)?e[r]=ug(a):a&&"object"==typeof a&&a.constructor===Object?e[r]=pg(a):e[r]=a)}return e}function mg(t,e){for(;null!==t;){const n=Uf(t,e);if(n){if(n.get)return hg(n.get);if("function"==typeof n.value)return hg(n.value)}t=Of(t)}return function(){return null}}const fg=Ff(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gg=Ff(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),vg=Ff(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),_g=Ff(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),yg=Ff(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),xg=Ff(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bg=Ff(["#text"]),Sg=Ff(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Mg=Ff(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),wg=Ff(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Eg=Ff(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Tg=zf(/{{[\w\W]*|^[\w\W]*}}/g),Ag=zf(/<%[\w\W]*|^[\w\W]*%>/g),Cg=zf(/\${[\w\W]*/g),Rg=zf(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ig=zf(/^aria-[\-\w]+$/),Pg=zf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lg=zf(/^(?:\w+script|data):/i),Dg=zf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ng=zf(/^html$/i),Og=zf(/^[a-z][.\w]*(-[.\w]+)+$/i),Ug=1,Fg=3,zg=7,kg=8,Bg=9,Gg=function(){return"undefined"==typeof window?null:window};var Vg=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gg();const n=e=>t(e);if(n.version="3.4.5",n.removed=[],!e||!e.document||e.document.nodeType!==Bg||!e.Element)return n.isSupported=!1,n;let i=e.document;const r=i,a=r.currentScript,s=e.DocumentFragment,o=e.HTMLTemplateElement,l=e.Node,c=e.Element,h=e.NodeFilter,d=e.NamedNodeMap,u=void 0===d?e.NamedNodeMap||e.MozNamedAttrMap:d,p=e.HTMLFormElement,m=e.DOMParser,f=e.trustedTypes,g=c.prototype,v=mg(g,"cloneNode"),_=mg(g,"remove"),y=mg(g,"nextSibling"),x=mg(g,"childNodes"),b=mg(g,"parentNode"),S=l&&l.prototype?mg(l.prototype,"nodeType"):null;if("function"==typeof o){const t=i.createElement("template");t.content&&t.content.ownerDocument&&(i=t.content.ownerDocument)}let M,w="";const E=i,T=E.implementation,A=E.createNodeIterator,C=E.createDocumentFragment,R=E.getElementsByTagName,I=r.importNode;let P={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Lf&&"function"==typeof b&&T&&void 0!==T.createHTMLDocument;const L=Tg,D=Ag,N=Cg,O=Rg,U=Ig,F=Lg,z=Dg,k=Og;let B=Pg,G=null;const V=dg({},[...fg,...gg,...vg,...yg,...bg]);let H=null;const W=dg({},[...Sg,...Mg,...wg,...Eg]);let j=Object.seal(kf(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,q=null;const Y=Object.seal(kf(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Z=!0,$=!0,J=!1,K=!0,Q=!1,tt=!0,et=!1,nt=!1,it=!1,rt=!1,at=!1,st=!1,ot=!0,lt=!1;const ct="user-content-";let ht=!0,dt=!1,ut={},pt=null;const mt=dg({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ft=null;const gt=dg({},["audio","video","img","source","image","track"]);let vt=null;const _t=dg({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",bt="http://www.w3.org/1999/xhtml";let St=bt,Mt=!1,wt=null;const Et=dg({},[yt,xt,bt],$f);let Tt=dg({},["mi","mo","mn","ms","mtext"]),At=dg({},["annotation-xml"]);const Ct=dg({},["title","style","font","a","script"]);let Rt=null;const It=["application/xhtml+xml","text/html"];let Pt=null,Lt=null;const Dt=i.createElement("form"),Nt=function(t){return t instanceof RegExp||t instanceof Function},Ot=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Lt&&Lt===t)return;t&&"object"==typeof t||(t={}),t=pg(t),Rt=-1===It.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Pt="application/xhtml+xml"===Rt?$f:Zf,G=ag(t,"ALLOWED_TAGS")&&Yf(t.ALLOWED_TAGS)?dg({},t.ALLOWED_TAGS,Pt):V,H=ag(t,"ALLOWED_ATTR")&&Yf(t.ALLOWED_ATTR)?dg({},t.ALLOWED_ATTR,Pt):W,wt=ag(t,"ALLOWED_NAMESPACES")&&Yf(t.ALLOWED_NAMESPACES)?dg({},t.ALLOWED_NAMESPACES,$f):Et,vt=ag(t,"ADD_URI_SAFE_ATTR")&&Yf(t.ADD_URI_SAFE_ATTR)?dg(pg(_t),t.ADD_URI_SAFE_ATTR,Pt):_t,ft=ag(t,"ADD_DATA_URI_TAGS")&&Yf(t.ADD_DATA_URI_TAGS)?dg(pg(gt),t.ADD_DATA_URI_TAGS,Pt):gt,pt=ag(t,"FORBID_CONTENTS")&&Yf(t.FORBID_CONTENTS)?dg({},t.FORBID_CONTENTS,Pt):mt,X=ag(t,"FORBID_TAGS")&&Yf(t.FORBID_TAGS)?dg({},t.FORBID_TAGS,Pt):pg({}),q=ag(t,"FORBID_ATTR")&&Yf(t.FORBID_ATTR)?dg({},t.FORBID_ATTR,Pt):pg({}),ut=!!ag(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?pg(t.USE_PROFILES):t.USE_PROFILES),Z=!1!==t.ALLOW_ARIA_ATTR,$=!1!==t.ALLOW_DATA_ATTR,J=t.ALLOW_UNKNOWN_PROTOCOLS||!1,K=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Q=t.SAFE_FOR_TEMPLATES||!1,tt=!1!==t.SAFE_FOR_XML,et=t.WHOLE_DOCUMENT||!1,rt=t.RETURN_DOM||!1,at=t.RETURN_DOM_FRAGMENT||!1,st=t.RETURN_TRUSTED_TYPE||!1,it=t.FORCE_BODY||!1,ot=!1!==t.SANITIZE_DOM,lt=t.SANITIZE_NAMED_PROPS||!1,ht=!1!==t.KEEP_CONTENT,dt=t.IN_PLACE||!1,B=function(t){try{return og(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Pg,St="string"==typeof t.NAMESPACE?t.NAMESPACE:bt,Tt=ag(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?pg(t.MATHML_TEXT_INTEGRATION_POINTS):dg({},["mi","mo","mn","ms","mtext"]),At=ag(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?pg(t.HTML_INTEGRATION_POINTS):dg({},["annotation-xml"]);const e=ag(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?pg(t.CUSTOM_ELEMENT_HANDLING):kf(null);if(j=kf(null),ag(e,"tagNameCheck")&&Nt(e.tagNameCheck)&&(j.tagNameCheck=e.tagNameCheck),ag(e,"attributeNameCheck")&&Nt(e.attributeNameCheck)&&(j.attributeNameCheck=e.attributeNameCheck),ag(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(j.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),Q&&($=!1),at&&(rt=!0),ut&&(G=dg({},bg),H=kf(null),!0===ut.html&&(dg(G,fg),dg(H,Sg)),!0===ut.svg&&(dg(G,gg),dg(H,Mg),dg(H,Eg)),!0===ut.svgFilters&&(dg(G,vg),dg(H,Mg),dg(H,Eg)),!0===ut.mathMl&&(dg(G,yg),dg(H,wg),dg(H,Eg))),Y.tagCheck=null,Y.attributeCheck=null,ag(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?Y.tagCheck=t.ADD_TAGS:Yf(t.ADD_TAGS)&&(G===V&&(G=pg(G)),dg(G,t.ADD_TAGS,Pt))),ag(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?Y.attributeCheck=t.ADD_ATTR:Yf(t.ADD_ATTR)&&(H===W&&(H=pg(H)),dg(H,t.ADD_ATTR,Pt))),ag(t,"ADD_URI_SAFE_ATTR")&&Yf(t.ADD_URI_SAFE_ATTR)&&dg(vt,t.ADD_URI_SAFE_ATTR,Pt),ag(t,"FORBID_CONTENTS")&&Yf(t.FORBID_CONTENTS)&&(pt===mt&&(pt=pg(pt)),dg(pt,t.FORBID_CONTENTS,Pt)),ag(t,"ADD_FORBID_CONTENTS")&&Yf(t.ADD_FORBID_CONTENTS)&&(pt===mt&&(pt=pg(pt)),dg(pt,t.ADD_FORBID_CONTENTS,Pt)),ht&&(G["#text"]=!0),et&&dg(G,["html","head","body"]),G.table&&(dg(G,["tbody"]),delete X.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw lg('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw lg('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=t.TRUSTED_TYPES_POLICY,w=M.createHTML("")}else void 0===M&&(M=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(n=e.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return t.createPolicy(r,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(f,a)),null!==M&&"string"==typeof w&&(w=M.createHTML(""));Ff&&Ff(t),Lt=t},Ut=dg({},[...gg,...vg,..._g]),Ft=dg({},[...yg,...xg]),zt=function(t){Xf(n.removed,{element:t});try{b(t).removeChild(t)}catch(e){_(t)}},kt=function(t,e){try{Xf(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Xf(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(rt||at)try{zt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Bt=function(t){let e=null,n=null;if(it)t="<remove></remove>"+t;else{const e=Jf(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===Rt&&St===bt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const r=M?M.createHTML(t):t;if(St===bt)try{e=(new m).parseFromString(r,Rt)}catch(t){}if(!e||!e.documentElement){e=T.createDocument(St,"template",null);try{e.documentElement.innerHTML=Mt?w:r}catch(t){}}const a=e.body||e.documentElement;return t&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),St===bt?R.call(e,et?"html":"body")[0]:et?e.documentElement:a},Gt=function(t){return A.call(t.ownerDocument||t,t,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Vt=function(t){t.normalize();const e=A.call(t.ownerDocument||t,t,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null);let n=e.nextNode();for(;n;){let t=n.data;Hf([L,D,N],(e=>{t=Kf(t,e," ")})),n.data=t,n=e.nextNode()}},Ht=function(t){return t instanceof p&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof u)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Wt=function(t){if(!S||"object"!=typeof t||null===t)return!1;try{return"number"==typeof S(t)}catch(t){return!1}};function jt(t,e,i){Hf(t,(t=>{t.call(n,e,i,Lt)}))}const Xt=function(t){let e=null;if(jt(P.beforeSanitizeElements,t,null),Ht(t))return zt(t),!0;const i=Pt(t.nodeName);if(jt(P.uponSanitizeElement,t,{tagName:i,allowedTags:G}),tt&&t.hasChildNodes()&&!Wt(t.firstElementChild)&&og(/<[/\w!]/g,t.innerHTML)&&og(/<[/\w!]/g,t.textContent))return zt(t),!0;if(tt&&t.namespaceURI===bt&&"style"===i&&Wt(t.firstElementChild))return zt(t),!0;if(t.nodeType===zg)return zt(t),!0;if(tt&&t.nodeType===kg&&og(/<[/\w]/g,t.data))return zt(t),!0;if(X[i]||!(Y.tagCheck instanceof Function&&Y.tagCheck(i))&&!G[i]){if(!X[i]&&Zt(i)){if(j.tagNameCheck instanceof RegExp&&og(j.tagNameCheck,i))return!1;if(j.tagNameCheck instanceof Function&&j.tagNameCheck(i))return!1}if(ht&&!pt[i]){const e=b(t)||t.parentNode,n=x(t)||t.childNodes;if(n&&e)for(let i=n.length-1;i>=0;--i){const r=v(n[i],!0);e.insertBefore(r,y(t))}}return zt(t),!0}return t instanceof c&&!function(t){let e=b(t);e&&e.tagName||(e={namespaceURI:St,tagName:"template"});const n=Zf(t.tagName),i=Zf(e.tagName);return!!wt[t.namespaceURI]&&(t.namespaceURI===xt?e.namespaceURI===bt?"svg"===n:e.namespaceURI===yt?"svg"===n&&("annotation-xml"===i||Tt[i]):Boolean(Ut[n]):t.namespaceURI===yt?e.namespaceURI===bt?"math"===n:e.namespaceURI===xt?"math"===n&&At[i]:Boolean(Ft[n]):t.namespaceURI===bt?!(e.namespaceURI===xt&&!At[i])&&!(e.namespaceURI===yt&&!Tt[i])&&!Ft[n]&&(Ct[n]||!Ut[n]):!("application/xhtml+xml"!==Rt||!wt[t.namespaceURI]))}(t)?(zt(t),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!og(/<\/no(script|embed|frames)/i,t.innerHTML)?(Q&&t.nodeType===Fg&&(e=t.textContent,Hf([L,D,N],(t=>{e=Kf(e,t," ")})),t.textContent!==e&&(Xf(n.removed,{element:t.cloneNode()}),t.textContent=e)),jt(P.afterSanitizeElements,t,null),!1):(zt(t),!0)},qt=function(t,e,n){if(q[e])return!1;if(ot&&("id"===e||"name"===e)&&(n in i||n in Dt))return!1;const r=H[e]||Y.attributeCheck instanceof Function&&Y.attributeCheck(e,t);if($&&!q[e]&&og(O,e));else if(Z&&og(U,e));else if(!r||q[e]){if(!(Zt(t)&&(j.tagNameCheck instanceof RegExp&&og(j.tagNameCheck,t)||j.tagNameCheck instanceof Function&&j.tagNameCheck(t))&&(j.attributeNameCheck instanceof RegExp&&og(j.attributeNameCheck,e)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(e,t))||"is"===e&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&og(j.tagNameCheck,n)||j.tagNameCheck instanceof Function&&j.tagNameCheck(n))))return!1}else if(vt[e]);else if(og(B,Kf(n,z,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Qf(n,"data:")||!ft[t])if(J&&!og(F,Kf(n,z,"")));else if(n)return!1;return!0},Yt=dg({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Zt=function(t){return!Yt[Zf(t)]&&og(k,t)},$t=function(t){jt(P.beforeSanitizeAttributes,t,null);const e=t.attributes;if(!e||Ht(t))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let r=e.length;for(;r--;){const a=e[r],s=a.name,o=a.namespaceURI,l=a.value,c=Pt(s),h=l;let d="value"===s?h:tg(h);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,jt(P.uponSanitizeAttribute,t,i),d=i.attrValue,!lt||"id"!==c&&"name"!==c||0===Qf(d,ct)||(kt(s,t),d=ct+d),tt&&og(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){kt(s,t);continue}if("attributename"===c&&Jf(d,"href")){kt(s,t);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){kt(s,t);continue}if(!K&&og(/\/>/i,d)){kt(s,t);continue}Q&&Hf([L,D,N],(t=>{d=Kf(d,t," ")}));const u=Pt(t.nodeName);if(qt(u,c,d)){if(M&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(o);else switch(f.getAttributeType(u,c)){case"TrustedHTML":d=M.createHTML(d);break;case"TrustedScriptURL":d=M.createScriptURL(d)}if(d!==h)try{o?t.setAttributeNS(o,s,d):t.setAttribute(s,d),Ht(t)?zt(t):jf(n.removed)}catch(e){kt(s,t)}}else kt(s,t)}jt(P.afterSanitizeAttributes,t,null)},Jt=function(t){let e=null;const n=Gt(t);for(jt(P.beforeSanitizeShadowDOM,t,null);e=n.nextNode();)jt(P.uponSanitizeShadowNode,e,null),Xt(e),$t(e),e.content instanceof s&&Jt(e.content);jt(P.afterSanitizeShadowDOM,t,null)},Kt=function(t){if(t.nodeType===Ug&&t.shadowRoot instanceof s){const e=t.shadowRoot;Kt(e),Jt(e)}const e=t.childNodes;if(!e)return;const n=[];Hf(e,(t=>{Xf(n,t)}));for(const t of n)Kt(t)};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,a=null,o=null,l=null;if(Mt=!t,Mt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Wt(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return eg(t);case"boolean":return ng(t);case"bigint":return ig?ig(t):"0";case"symbol":return rg?rg(t):"Symbol()";case"undefined":default:return sg(t);case"function":case"object":{if(null===t)return sg(t);const e=t,n=mg(e,"toString");if("function"==typeof n){const t=n(e);return"string"==typeof t?t:sg(t)}return sg(t)}}}(t)))throw lg("dirty is not a string, aborting");if(!n.isSupported)return t;if(nt||Ot(e),n.removed=[],"string"==typeof t&&(dt=!1),dt){const e=t.nodeName;if("string"==typeof e){const t=Pt(e);if(!G[t]||X[t])throw lg("root node is forbidden and cannot be sanitized in-place")}Kt(t)}else if(Wt(t))i=Bt("\x3c!----\x3e"),a=i.ownerDocument.importNode(t,!0),a.nodeType===Ug&&"BODY"===a.nodeName||"HTML"===a.nodeName?i=a:i.appendChild(a),Kt(a);else{if(!rt&&!Q&&!et&&-1===t.indexOf("<"))return M&&st?M.createHTML(t):t;if(i=Bt(t),!i)return rt?null:st?w:""}i&&it&&zt(i.firstChild);const c=Gt(dt?t:i);for(;o=c.nextNode();)Xt(o),$t(o),o.content instanceof s&&Jt(o.content);if(dt)return Q&&Vt(t),t;if(rt){if(Q&&Vt(i),at)for(l=C.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(H.shadowroot||H.shadowrootmode)&&(l=I.call(r,l,!0)),l}let h=et?i.outerHTML:i.innerHTML;return et&&G["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&og(Ng,i.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+h),Q&&Hf([L,D,N],(t=>{h=Kf(h,t," ")})),M&&st?M.createHTML(h):h},n.setConfig=function(){Ot(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),nt=!0},n.clearConfig=function(){Lt=null,nt=!1},n.isValidAttribute=function(t,e,n){Lt||Ot({});const i=Pt(t),r=Pt(e);return qt(i,r,n)},n.addHook=function(t,e){"function"==typeof e&&Xf(P[t],e)},n.removeHook=function(t,e){if(void 0!==e){const n=Wf(P[t],e);return-1===n?void 0:qf(P[t],n,1)[0]}return jf(P[t])},n.removeHooks=function(t){P[t]=[]},n.removeAllHooks=function(){P={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Hg=function(t,e,n,i){var r,a=arguments.length,s=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(s=(a<3?r(s):a>3?r(e,n,s):r(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};
|
|
361
361
|
/**
|
|
362
362
|
* @license
|
|
363
363
|
* Copyright 2018-2026 Advanced Visual Systems Inc.
|
|
@@ -376,4 +376,4 @@ const{entries:If,setPrototypeOf:Pf,isFrozen:Lf,getPrototypeOf:Df,getOwnPropertyD
|
|
|
376
376
|
*
|
|
377
377
|
* This product includes software developed at
|
|
378
378
|
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
379
|
-
*/t.AvsGoDynamicHtml=class extends(e(ot)){render(){return H`${vt(this._html)}`}willUpdate(t){if(!this.url)return void(t.has("url")&&this._dispatchErrorEvent("'url' property must be set to an instance of AVS/Go server."));if(!this.dynamicHtmlName)return void(t.has("dynamicHtmlName")&&this._dispatchErrorEvent("'dynamic-html-name' property must be set to the name of the dynamicHtml registered in the library map on the AVS/Go server."));const e={dynamicHtmlProperties:{name:this.dynamicHtmlName}};if(this.dynamicHtmlUserProperties){let t;try{t=JSON.parse(this.dynamicHtmlUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'dynamic-html-user-properties'. "+t)}e.dynamicHtmlProperties.userProperties=t}if(this.dataSourceName&&(e.dataSourceProperties={name:this.dataSourceName},this.dataSourceUserProperties)){let t;try{t=JSON.parse(this.dataSourceUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. "+t)}e.dataSourceProperties.userProperties=t}this._httpRequest(this.url,(t=>{if(t.html){const e=decodeURIComponent(t.html.replace(/\+/g,"%20"));this._html=
|
|
379
|
+
*/t.AvsGoDynamicHtml=class extends(e(ot)){constructor(){super(...arguments),this.url=""}render(){return H`${vt(this._html)}`}willUpdate(t){if(!this.url||this.url.length<1)return void(t.has("url")&&this._dispatchErrorEvent("'url' property must be set to an instance of AVS/Go server."));if(!this.dynamicHtmlName)return void(t.has("dynamicHtmlName")&&this._dispatchErrorEvent("'dynamic-html-name' property must be set to the name of the dynamicHtml registered in the library map on the AVS/Go server."));const e={dynamicHtmlProperties:{name:this.dynamicHtmlName}};if(this.dynamicHtmlUserProperties){let t;try{t=JSON.parse(this.dynamicHtmlUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'dynamic-html-user-properties'. "+t)}e.dynamicHtmlProperties.userProperties=t}if(this.dataSourceName&&(e.dataSourceProperties={name:this.dataSourceName},this.dataSourceUserProperties)){let t;try{t=JSON.parse(this.dataSourceUserProperties)}catch(t){return void this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. "+t)}e.dataSourceProperties.userProperties=t}this._httpRequest(this.url,(t=>{if(t.html){const e=decodeURIComponent(t.html.replace(/\+/g,"%20"));this._html=Vg.sanitize(e)}else this._dispatchErrorEvent("Empty response from AVS/Go server.")}),void 0,e)}},Hg([ut()],t.AvsGoDynamicHtml.prototype,"url",void 0),Hg([ut({attribute:"data-source-name"})],t.AvsGoDynamicHtml.prototype,"dataSourceName",void 0),Hg([ut({attribute:"data-source-user-properties"})],t.AvsGoDynamicHtml.prototype,"dataSourceUserProperties",void 0),Hg([ut({attribute:"dynamic-html-name"})],t.AvsGoDynamicHtml.prototype,"dynamicHtmlName",void 0),Hg([ut({attribute:"dynamic-html-user-properties"})],t.AvsGoDynamicHtml.prototype,"dynamicHtmlUserProperties",void 0),Hg([function(t){return ut({...t,state:!0,attribute:!1})}()],t.AvsGoDynamicHtml.prototype,"_html",void 0),t.AvsGoDynamicHtml=Hg([ct("avs-go-dynamic-html")],t.AvsGoDynamicHtml)},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).AvsGo={});
|