@xtctwins/tctwins-bimx-viewer 1.1.6 → 1.1.7
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/tctwins-bimx-viewer.min.es.js +231 -143
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/types/src/BIMXViewer.d.ts +4 -0
|
@@ -4068,9 +4068,16 @@ _this23._lodManagerList[_i47].resetLodCulling();}}sceneTick++;});}/**
|
|
|
4068
4068
|
@private
|
|
4069
4069
|
*/function Spinner(owner){var _this24;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Spinner);_this24=_callSuper(this,Spinner,[owner,cfg]);_this24._canvas=cfg.canvas;_this24._element=null;_this24._isCustom=false;// True when the element is custom HTML
|
|
4070
4070
|
if(cfg.elementId){// Custom spinner element supplied
|
|
4071
|
-
_this24._element=document.getElementById(cfg.elementId);if(!_this24._element){_this24._createDefaultSpinner(cfg.elementId);}else{_this24._adjustPosition();}}else{_this24._createDefaultSpinner("engine_spinner");}_this24.processes=0;return _this24;}_inherits(Spinner,_Component5);return _createClass(Spinner,[{key:"type",get:/**
|
|
4071
|
+
_this24._element=document.getElementById(cfg.elementId);if(!_this24._element){_this24._createDefaultSpinner(cfg.elementId);}else{_this24._adjustPosition();}}else{_this24._createDefaultSpinner("engine_spinner");}_this24._manualVisible=false;_this24.processes=0;return _this24;}_inherits(Spinner,_Component5);return _createClass(Spinner,[{key:"type",get:/**
|
|
4072
4072
|
@private
|
|
4073
|
-
*/function get(){return"Spinner";}},{key:"visible",get:function get(){return this._element.style["visibility"]==="visible";}
|
|
4073
|
+
*/function get(){return"Spinner";}},{key:"visible",get:function get(){return this._element.style["visibility"]==="visible";}/**
|
|
4074
|
+
* 手动强制显示 / 解除强制显示(不再直接改 DOM,避免与 processes 计数互相覆盖)。
|
|
4075
|
+
*
|
|
4076
|
+
* - set true:强制显示 spinner,直到显式 set false(期间不受 processes 计数影响);
|
|
4077
|
+
* - set false:解除强制显示,可见性回落到 processes 计数控制(计数 > 0 时可见)。
|
|
4078
|
+
*
|
|
4079
|
+
* @param {Boolean} visible
|
|
4080
|
+
*/,set:function set(visible){visible=!!visible;if(this._manualVisible===visible){return;}this._manualVisible=visible;this._syncVisibility();}/** @private */},{key:"_createDefaultSpinner",value:function _createDefaultSpinner(elementId){// console.log("_createDefaultSpinner");
|
|
4074
4081
|
this._injectDefaultCSS();var element=document.createElement("div");element.setAttribute("id",elementId);var style=element.style;style["z-index"]="9000";style.position="absolute";element.innerHTML='<div class="sk-fading-circle">\
|
|
4075
4082
|
<div class="sk-circle1 sk-circle"></div>\
|
|
4076
4083
|
<div class="sk-circle2 sk-circle"></div>\
|
|
@@ -4109,7 +4116,10 @@ if(this._isCustom){return;}var canvas=this._canvas;var element=this._element;var
|
|
|
4109
4116
|
* The Spinner is visible while this property is greater than zero.
|
|
4110
4117
|
*
|
|
4111
4118
|
* @returns {Number} Current processes count.
|
|
4112
|
-
*/function get(){return this._processes;}
|
|
4119
|
+
*/function get(){return this._processes;}/**
|
|
4120
|
+
* 按「计数 > 0 或手动强制显示」同步 spinner 元素的可见性。
|
|
4121
|
+
* @private
|
|
4122
|
+
*/,set:function set(value){value=value||0;if(this._processes===value){return;}if(value<0){return;}var prevValue=this._processes;this._processes=value;this._syncVisibility();/**
|
|
4113
4123
|
Fired whenever this Spinner's {@link Spinner#visible} property changes.
|
|
4114
4124
|
|
|
4115
4125
|
@event processes
|
|
@@ -4118,7 +4128,7 @@ if(this._isCustom){return;}var canvas=this._canvas;var element=this._element;var
|
|
|
4118
4128
|
Fired whenever this Spinner's {@link Spinner#visible} property becomes zero.
|
|
4119
4129
|
|
|
4120
4130
|
@event zeroProcesses
|
|
4121
|
-
*/this.fire("zeroProcesses",this._processes);}}},{key:"destroy",value:function destroy(){if(this._element&&!this._isCustom){this._element.parentNode.removeChild(this._element);this._element=null;}var styleElement=document.getElementById("tctwins-spinner-css");if(styleElement){styleElement.parentNode.removeChild(styleElement);}}}]);}(Component);var WEBGL_CONTEXT_NAMES=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"];/**
|
|
4131
|
+
*/this.fire("zeroProcesses",this._processes);}}},{key:"_syncVisibility",value:function _syncVisibility(){var element=this._element;if(element){element.style["visibility"]=this._processes>0||this._manualVisible?"visible":"hidden";}}},{key:"destroy",value:function destroy(){if(this._element&&!this._isCustom){this._element.parentNode.removeChild(this._element);this._element=null;}var styleElement=document.getElementById("tctwins-spinner-css");if(styleElement){styleElement.parentNode.removeChild(styleElement);}}}]);}(Component);var WEBGL_CONTEXT_NAMES=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"];/**
|
|
4122
4132
|
* @desc Manages its {@link Scene}'s HTML canvas.
|
|
4123
4133
|
*
|
|
4124
4134
|
* * Provides the HTML canvas element in {@link Canvas#canvas}.
|
|
@@ -4760,7 +4770,8 @@ occlusionRenderBuffer1.bind();occlusionRenderBuffer1.clear();saoDepthLimitedBlur
|
|
|
4760
4770
|
drawable.drawShadow(frameCtx);}}}}shadowRenderBuf.unbind();}function drawColor(params){var normalDrawSAOBin=[];var normalEdgesOpaqueBin=[];var normalFillTransparentBin=[];var normalEdgesTransparentBin=[];var xrayedFillOpaqueBin=[];var xrayEdgesOpaqueBin=[];var xrayedFillTransparentBin=[];var xrayEdgesTransparentBin=[];var highlightedFillOpaqueBin=[];var highlightedEdgesOpaqueBin=[];var highlightedFillTransparentBin=[];var highlightedEdgesTransparentBin=[];var selectedFillOpaqueBin=[];var selectedEdgesOpaqueBin=[];var selectedFillTransparentBin=[];var selectedEdgesTransparentBin=[];var ambientColorAndIntensity=scene._lightsState.getAmbientColorAndIntensity();frameCtx.reset();frameCtx.pass=params.pass;frameCtx.withSAO=false;frameCtx.pbrEnabled=pbrEnabled&&!!scene.pbrEnabled;frameCtx.colorTextureEnabled=colorTextureEnabled&&!!scene.colorTextureEnabled;gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);if(canvasTransparent){gl.clearColor(0,0,0,0);}else{var _backgroundColor2=scene.canvas.backgroundColorFromAmbientLight?ambientColorAndIntensity:scene.canvas.backgroundColor;gl.clearColor(_backgroundColor2[0],_backgroundColor2[1],_backgroundColor2[2],1.0);}gl.enable(gl.DEPTH_TEST);gl.frontFace(gl.CCW);gl.enable(gl.CULL_FACE);gl.depthMask(true);gl.lineWidth(1);frameCtx.lineWidth=1;var saoPossible=scene.sao.possible;if(saoEnabled&&saoPossible){var occlusionRenderBuffer1=renderBufferManager.getRenderBuffer("saoOcclusion");frameCtx.occlusionTexture=occlusionRenderBuffer1?occlusionRenderBuffer1.getTexture():null;}else{frameCtx.occlusionTexture=null;}var i;var drawable;var startTime=Date.now();if(params.clear!==false){gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);}var normalDrawSAOBinLen=0;var normalEdgesOpaqueBinLen=0;var normalFillTransparentBinLen=0;var normalEdgesTransparentBinLen=0;var xrayedFillOpaqueBinLen=0;var xrayEdgesOpaqueBinLen=0;var xrayedFillTransparentBinLen=0;var xrayEdgesTransparentBinLen=0;var highlightedFillOpaqueBinLen=0;var highlightedEdgesOpaqueBinLen=0;var highlightedFillTransparentBinLen=0;var highlightedEdgesTransparentBinLen=0;var selectedFillOpaqueBinLen=0;var selectedEdgesOpaqueBinLen=0;var selectedFillTransparentBinLen=0;var selectedEdgesTransparentBinLen=0;//------------------------------------------------------------------------------------------------------
|
|
4761
4771
|
// Render normal opaque solids, defer others to bins to render after
|
|
4762
4772
|
//------------------------------------------------------------------------------------------------------
|
|
4763
|
-
for(var _i69=0,len=postCullDrawableList.length;_i69<len;_i69++){drawable=postCullDrawableList[_i69];if(drawable.culled===true||drawable.visible===false){continue;}var renderFlags=drawable.renderFlags;if(renderFlags.colorOpaque){if(saoEnabled&&saoPossible&&drawable.saoEnabled){normalDrawSAOBin[normalDrawSAOBinLen++]=drawable;}else{drawable.drawColorOpaque(frameCtx);}}if(transparentEnabled){if(renderFlags.colorTransparent){normalFillTransparentBin[normalFillTransparentBinLen++]=drawable;}}if(renderFlags.xrayedSilhouetteTransparent){xrayedFillTransparentBin[xrayedFillTransparentBinLen++]=drawable;}if(renderFlags.xrayedSilhouetteOpaque){xrayedFillOpaqueBin[xrayedFillOpaqueBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteTransparent){highlightedFillTransparentBin[highlightedFillTransparentBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteOpaque){highlightedFillOpaqueBin[highlightedFillOpaqueBinLen++]=drawable;}if(renderFlags.selectedSilhouetteTransparent){selectedFillTransparentBin[selectedFillTransparentBinLen++]=drawable;}if(renderFlags.selectedSilhouetteOpaque){selectedFillOpaqueBin[selectedFillOpaqueBinLen++]=drawable;}
|
|
4773
|
+
for(var _i69=0,len=postCullDrawableList.length;_i69<len;_i69++){drawable=postCullDrawableList[_i69];if(drawable.culled===true||drawable.visible===false){continue;}var renderFlags=drawable.renderFlags;if(renderFlags.colorOpaque){if(saoEnabled&&saoPossible&&drawable.saoEnabled){normalDrawSAOBin[normalDrawSAOBinLen++]=drawable;}else{drawable.drawColorOpaque(frameCtx);}}if(transparentEnabled){if(renderFlags.colorTransparent){normalFillTransparentBin[normalFillTransparentBinLen++]=drawable;}}if(renderFlags.xrayedSilhouetteTransparent){xrayedFillTransparentBin[xrayedFillTransparentBinLen++]=drawable;}if(renderFlags.xrayedSilhouetteOpaque){xrayedFillOpaqueBin[xrayedFillOpaqueBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteTransparent){highlightedFillTransparentBin[highlightedFillTransparentBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteOpaque){highlightedFillOpaqueBin[highlightedFillOpaqueBinLen++]=drawable;}if(renderFlags.selectedSilhouetteTransparent){selectedFillTransparentBin[selectedFillTransparentBinLen++]=drawable;}if(renderFlags.selectedSilhouetteOpaque){selectedFillOpaqueBin[selectedFillOpaqueBinLen++]=drawable;}// 含房间体轮廓的模型(SceneModel#edgesForced)不受全局 edgesEnabled 开关影响
|
|
4774
|
+
if(drawable.edges&&(edgesEnabled||drawable.edgesForced)){if(renderFlags.edgesOpaque){normalEdgesOpaqueBin[normalEdgesOpaqueBinLen++]=drawable;}if(renderFlags.edgesTransparent){normalEdgesTransparentBin[normalEdgesTransparentBinLen++]=drawable;}if(renderFlags.selectedEdgesTransparent){selectedEdgesTransparentBin[selectedEdgesTransparentBinLen++]=drawable;}if(renderFlags.selectedEdgesOpaque){selectedEdgesOpaqueBin[selectedEdgesOpaqueBinLen++]=drawable;}if(renderFlags.xrayedEdgesTransparent){xrayEdgesTransparentBin[xrayEdgesTransparentBinLen++]=drawable;}if(renderFlags.xrayedEdgesOpaque){xrayEdgesOpaqueBin[xrayEdgesOpaqueBinLen++]=drawable;}if(renderFlags.highlightedEdgesTransparent){highlightedEdgesTransparentBin[highlightedEdgesTransparentBinLen++]=drawable;}if(renderFlags.highlightedEdgesOpaque){highlightedEdgesOpaqueBin[highlightedEdgesOpaqueBinLen++]=drawable;}}}//------------------------------------------------------------------------------------------------------
|
|
4764
4775
|
// Render deferred bins
|
|
4765
4776
|
//------------------------------------------------------------------------------------------------------
|
|
4766
4777
|
// Opaque color with SAO
|
|
@@ -9147,7 +9158,7 @@ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(
|
|
|
9147
9158
|
* @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
|
|
9148
9159
|
*/function Scene(viewer){var _this51;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Scene);_this51=_callSuper(this,Scene,[null,cfg]);var canvas=cfg.canvasElement||document.getElementById(cfg.canvasId);if(!(canvas instanceof HTMLCanvasElement)){throw"Mandatory config expected: valid canvasId or canvasElement";}/**
|
|
9149
9160
|
* @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}
|
|
9150
|
-
*/_this51._tickifiedFunctions={};_this51._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this51._edgesEnabled=!!cfg.edgesEnabled;_this51._aabbDirty=true;_this51._aabbUpdate=false;_this51._collideWithEntity=false;_this51._readableGeometry=!!cfg.readableGeometryEnabled;/**
|
|
9161
|
+
*/_this51._tickifiedFunctions={};_this51._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this51._edgesEnabled=!!cfg.edgesEnabled;_this51._spacesVisible=false;_this51._aabbDirty=true;_this51._aabbUpdate=false;_this51._collideWithEntity=false;_this51._readableGeometry=!!cfg.readableGeometryEnabled;/**
|
|
9151
9162
|
* The {@link Viewer} this Scene belongs to.
|
|
9152
9163
|
* @type {Viewer}
|
|
9153
9164
|
*/_this51.viewer=viewer;/** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.
|
|
@@ -9324,15 +9335,28 @@ element:_this51.canvas.canvas,keyboardEventsElement:cfg.keyboardEventsElement});
|
|
|
9324
9335
|
*/_this51.sao=new SAO(_this51,{enabled:cfg.saoEnabled});/** Configures Cross Sections for this Scene.
|
|
9325
9336
|
* @type {CrossSections}
|
|
9326
9337
|
* @final
|
|
9327
|
-
*/_this51.crossSections=new CrossSections(_this51,{});_this51.ticksPerRender=cfg.ticksPerRender;_this51.ticksPerOcclusionTest=cfg.ticksPerOcclusionTest;_this51.passes=cfg.passes;_this51.clearEachPass=cfg.clearEachPass;_this51.gammaInput=cfg.gammaInput;_this51.gammaOutput=cfg.gammaOutput;_this51.gammaFactor=cfg.gammaFactor;_this51._entityOffsetsEnabled=!!cfg.entityOffsetsEnabled;_this51._logarithmicDepthBufferEnabled=!!cfg.logarithmicDepthBufferEnabled;_this51._dtxEnabled=cfg.dtxEnabled!==false;_this51._pbrEnabled=!!cfg.pbrEnabled;_this51._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this51._dtxEnabled=!!cfg.dtxEnabled;_this51._lodEnabled=cfg.lodEnabled!==false;_this51._markerZOffset=cfg.markerZOffset;// Register Scene on xeokit
|
|
9338
|
+
*/_this51.crossSections=new CrossSections(_this51,{});_this51.ticksPerRender=cfg.ticksPerRender;_this51.ticksPerOcclusionTest=cfg.ticksPerOcclusionTest;_this51.passes=cfg.passes;_this51.clearEachPass=cfg.clearEachPass;_this51.gammaInput=cfg.gammaInput;_this51.gammaOutput=cfg.gammaOutput;_this51.gammaFactor=cfg.gammaFactor;_this51._entityOffsetsEnabled=!!cfg.entityOffsetsEnabled;_this51._logarithmicDepthBufferEnabled=!!cfg.logarithmicDepthBufferEnabled;_this51._dtxEnabled=cfg.dtxEnabled!==false;_this51._pbrEnabled=!!cfg.pbrEnabled;_this51._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this51._dtxEnabled=!!cfg.dtxEnabled;_this51._lodEnabled=cfg.lodEnabled!==false;_this51._autoFarPlaneFitEnabled=cfg.autoFarPlaneFitEnabled!==false;_this51._markerZOffset=cfg.markerZOffset;// Register Scene on xeokit
|
|
9328
9339
|
// Do this BEFORE we add components below
|
|
9329
9340
|
core._addScene(_this51);_this51._initDefaults();// Global components
|
|
9330
9341
|
_this51._viewport=new Viewport(_this51,{id:"default.viewport",autoBoundary:true,dontClear:true// Never destroy this component with Scene#clear();
|
|
9331
9342
|
});_this51._camera=new Camera(_this51,{id:"default.camera",worldAxis:cfg.worldAxis,dontClear:true// Never destroy this component with Scene#clear();
|
|
9332
9343
|
});// Default lights
|
|
9333
|
-
new AmbientLight(_this51,{color:[1,1,1.0],intensity:_this51.lightIntensity});new DirLight(_this51,{dir:[0.8,-0.5,-0.5],color:[0.67,0.67,0.86],intensity:_this51.lightIntensity,space:"world"});new DirLight(_this51,{dir:[-0.8,-1.0,0.5],color:[0.8,0.8,0.7],intensity:_this51.lightIntensity,space:"world"});_this51._camera.on("dirty",function(){_this51._renderer.imageDirty();});_this51._lod=new LOD(_this51,{enabled:_this51._lodEnabled,targetFPS:30})
|
|
9344
|
+
new AmbientLight(_this51,{color:[1,1,1.0],intensity:_this51.lightIntensity});new DirLight(_this51,{dir:[0.8,-0.5,-0.5],color:[0.67,0.67,0.86],intensity:_this51.lightIntensity,space:"world"});new DirLight(_this51,{dir:[-0.8,-1.0,0.5],color:[0.8,0.8,0.7],intensity:_this51.lightIntensity,space:"world"});_this51._camera.on("dirty",function(){_this51._renderer.imageDirty();});_this51._lod=new LOD(_this51,{enabled:_this51._lodEnabled,targetFPS:30});// 相机远裁剪面自适应:保证大尺度模型在相机拉远时不因 far 过小而“被剖切式”裁掉
|
|
9345
|
+
if(_this51._autoFarPlaneFitEnabled){_this51.on("tick",function(){return _this51._autoFitCameraFarPlane();});}return _this51;}/**
|
|
9346
|
+
* 让透视相机的远裁剪面({@link Perspective#far})始终覆盖整个场景:
|
|
9347
|
+
*
|
|
9348
|
+
* - 目标值 = ceil(max(初始 far, (相机到场景 AABB 中心距离 + AABB 半对角线) * 1.1 + 10));
|
|
9349
|
+
* - 需要时立即增大;仅当明显多余(目标 < 当前值的一半)时才收缩,避免逐帧抖动,
|
|
9350
|
+
* 同时在相机拉近后回收 far、维护近处深度精度;
|
|
9351
|
+
* - 正交 / frustum / customProjection 相机不处理。
|
|
9352
|
+
*
|
|
9353
|
+
* 可在 Viewer / Scene 配置中通过 autoFarPlaneFitEnabled: false 关闭本行为。
|
|
9354
|
+
*
|
|
9355
|
+
* @private
|
|
9356
|
+
*/_inherits(Scene,_Component18);return _createClass(Scene,[{key:"type",get:/**
|
|
9334
9357
|
@private
|
|
9335
|
-
*/function get(){return"Scene";}},{key:"
|
|
9358
|
+
*/function get(){return"Scene";}},{key:"_autoFitCameraFarPlane",value:function _autoFitCameraFarPlane(){var camera=this._camera;if(!camera||camera.projection!=="perspective"){return;}var aabb=this.aabb;if(!aabb||aabb[3]<aabb[0]||aabb[4]<aabb[1]||aabb[5]<aabb[2]){return;}var perspective=camera.perspective;if(this._autoFarPlaneFitFloor===undefined){// 收缩下限取首次参与自适应时的 far(即 Perspective 默认的 2000)
|
|
9359
|
+
this._autoFarPlaneFitFloor=perspective.far;}var radius=0.5*Math.hypot(aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2]);var eye=camera.eye;var dist=Math.hypot(eye[0]-(aabb[0]+aabb[3])/2,eye[1]-(aabb[1]+aabb[4])/2,eye[2]-(aabb[2]+aabb[5])/2);var targetFar=Math.ceil(Math.max(this._autoFarPlaneFitFloor,(dist+radius)*1.1+10));var currentFar=perspective.far;if(targetFar>currentFar||targetFar<currentFar*0.5){perspective.far=targetFar;}}},{key:"_initDefaults",value:function _initDefaults(){this.geometry;this.material;this.xrayMaterial;this.edgeMaterial;this.selectedMaterial;this.highlightMaterial;}},{key:"_addComponent",value:function _addComponent(component){if(component.id){// Manual ID
|
|
9336
9360
|
if(this.components[component.id]){if(component.id=="sectionControl"){return;}this.error("Component "+utils.inQuotes(component.id)+" already exists in Scene - ignoring ID, will randomly-generate instead");component.id=null;}}if(!component.id){// Auto ID
|
|
9337
9361
|
if(window.nextID===undefined){window.nextID=0;}//component.id = math.createUUID();
|
|
9338
9362
|
component.id="__"+window.nextID++;while(this.components[component.id]){component.id=math.createUUID();}}this.components[component.id]=component;// Register for class type
|
|
@@ -9447,9 +9471,23 @@ this.canvas.spinner.processes--;}/**
|
|
|
9447
9471
|
*/,set:function set(value){value=!!value;if(this._dtxEnabled===value){return;}this._dtxEnabled=value;}},{key:"edgesEnabled",get:/**
|
|
9448
9472
|
* @param {boolean} trans
|
|
9449
9473
|
*/function get(){return this._edgesEnabled;}/**
|
|
9474
|
+
* 是否显示 XTC 房间体(0 号段 metadata.spaceEids 命中的 IFCSPACE 实体)的填充。
|
|
9475
|
+
*
|
|
9476
|
+
* 默认 ````false````:房间体仅渲染轮廓线(填充近不可见),避免从外部透过幕墙玻璃看室内时被房间体"洗白";
|
|
9477
|
+
* 置 ````true````:房间体渲染为 50% 半透明白色 + 轮廓线,更突出、更明显。
|
|
9478
|
+
*
|
|
9479
|
+
* 仅影响注册过房间体的 XTC 模型(由 XTCLoaderPlugin / ParserV10 解析时注册)。
|
|
9480
|
+
*
|
|
9481
|
+
* @example
|
|
9482
|
+
* viewer.scene.spacesVisible = true;
|
|
9483
|
+
*
|
|
9484
|
+
* @type {Boolean}
|
|
9485
|
+
*/,set:function set(edgesEnabled){edgesEnabled=!!edgesEnabled;if(this._edgesEnabled===edgesEnabled){return;}this._edgesEnabled=edgesEnabled;this._renderer.setEdgesEnabled(edgesEnabled);}},{key:"spacesVisible",get:/**
|
|
9486
|
+
* @returns {Boolean}
|
|
9487
|
+
*/function get(){return this._spacesVisible;}/**
|
|
9450
9488
|
* set whether transparent of canvas background
|
|
9451
9489
|
* @param {boolean} trans
|
|
9452
|
-
*/,set:function set(
|
|
9490
|
+
*/,set:function set(visible){visible=!!visible;if(this._spacesVisible===visible){return;}this._spacesVisible=visible;for(var modelId in this.models){var model=this.models[modelId];if(model&&model._applySpacesVisibility){model._applySpacesVisibility();}}this.glRedraw();}},{key:"backgroundTransparent",get:/**
|
|
9453
9491
|
* @returns {boolean} backgroundTransparent
|
|
9454
9492
|
*/function get(){return this._transparent;}/**
|
|
9455
9493
|
* set background color
|
|
@@ -14914,7 +14952,8 @@ src.push("} else {");src.push(" vec4 localPosition = positionsDecodeMatrix
|
|
|
14914
14952
|
// renderPass = EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT
|
|
14915
14953
|
src.push("int edgeFlag = int(flags) >> 8 & 0xF;");src.push("if (edgeFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
14916
14954
|
src.push("} else {");src.push(" vec4 localPosition = positionsDecodeMatrix * vec4(position, 1.0);");src.push(" vec4 worldPosition = worldMatrix * vec4(dot(localPosition, modelMatrixCol0), dot(localPosition, modelMatrixCol1), dot(localPosition, modelMatrixCol2), 1.0); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");//src.push("vColor = vec4(float(color.r-100.0) / 255.0, float(color.g-100.0) / 255.0, float(color.b-100.0) / 255.0, float(color.a) / 255.0);");
|
|
14917
|
-
|
|
14955
|
+
// 边线 alpha 与填充 alpha 解耦:填充近全透明的构件(如"仅轮廓"房间体)其边线仍需可见
|
|
14956
|
+
src.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, 1.0);");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Batched geometry edges drawing fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i166=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i166<len;_i166++){src.push("uniform bool sectionPlaneActive"+_i166+";");src.push("uniform vec3 sectionPlanePos"+_i166+";");src.push("uniform vec3 sectionPlaneDir"+_i166+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");src.push.apply(src,_toConsumableArray(buildSectionClipping(sectionPlanesState,sectionPlanesState.getNumAllocatedSectionPlanes())));src.push(" if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outColor = vColor;");src.push("}");return src;}}]);}(EdgesRenderer$1);/**
|
|
14918
14957
|
* @private
|
|
14919
14958
|
*/var TrianglesPickMeshRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen5){function TrianglesPickMeshRenderer$1(){_classCallCheck(this,TrianglesPickMeshRenderer$1);return _callSuper(this,TrianglesPickMeshRenderer$1,arguments);}_inherits(TrianglesPickMeshRenderer$1,_TrianglesBatchingRen5);return _createClass(TrianglesPickMeshRenderer$1,[{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Batched geometry picking vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in vec4 modelMatrixCol0;");src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("in float flags;");src.push("in vec4 pickColor;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}this._addRemapClipPosLines(src);src.push("out vec4 vPickColor;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
14920
14959
|
// renderPass = PICK
|
|
@@ -15260,7 +15299,9 @@ src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._
|
|
|
15260
15299
|
// renderPass = EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED
|
|
15261
15300
|
src.push("int edgeFlag = int(flags) >> 8 & 0xF;");src.push("if (edgeFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15262
15301
|
src.push("} else {");src.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");// src.push("vColor = vec4(float(color.r-100.0) / 255.0, float(color.g-100.0) / 255.0, float(color.b-100.0) / 255.0, float(color.a) / 255.0);");
|
|
15263
|
-
|
|
15302
|
+
// 边线 alpha 与填充 alpha 解耦:填充近全透明的构件(如"仅轮廓"房间体)其边线仍需可见,
|
|
15303
|
+
// 因此边线不随填充 alpha 衰减(原实现 alpha=填充 alpha,房间体轮廓不可见)。
|
|
15304
|
+
src.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, 1.0);");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// EdgesColorRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i213=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i213<len;_i213++){src.push("uniform bool sectionPlaneActive"+_i213+";");src.push("uniform vec3 sectionPlanePos"+_i213+";");src.push("uniform vec3 sectionPlaneDir"+_i213+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");src.push.apply(src,_toConsumableArray(buildSectionClipping(sectionPlanesState,sectionPlanesState.getNumAllocatedSectionPlanes())));src.push(" if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outColor = vColor;");src.push("}");return src;}}]);}(EdgesRenderer);/**
|
|
15264
15305
|
* @private
|
|
15265
15306
|
*/var TrianglesPickMeshRenderer=/*#__PURE__*/function(_TrianglesInstancingR5){function TrianglesPickMeshRenderer(){_classCallCheck(this,TrianglesPickMeshRenderer);return _callSuper(this,TrianglesPickMeshRenderer,arguments);}_inherits(TrianglesPickMeshRenderer,_TrianglesInstancingR5);return _createClass(TrianglesPickMeshRenderer,[{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry picking vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 pickColor;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15266
15307
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);this._addRemapClipPosLines(src);if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vPickColor;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
@@ -16352,7 +16393,8 @@ src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(object
|
|
|
16352
16393
|
src.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));");// get color
|
|
16353
16394
|
src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");src.push("if (color.a == 0u) {");src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);");// Cull vertex
|
|
16354
16395
|
src.push(" return;");src.push("};");src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");src.push("vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags2 = flags2.r;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("vec4 rgb = vec4(color.rgba);");//src.push("vColor = vec4(float(color.r-100.0) / 255.0, float(color.g-100.0) / 255.0, float(color.b-100.0) / 255.0, float(color.a) / 255.0);");
|
|
16355
|
-
|
|
16396
|
+
// 边线 alpha 与填充 alpha 解耦:填充近全透明的构件(如"仅轮廓"房间体)其边线仍需可见
|
|
16397
|
+
src.push("vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, 1.0);");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// TrianglesDataTextureEdgesColorRenderer");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i300=0,len=scene._sectionPlanesState.getNumAllocatedSectionPlanes();_i300<len;_i300++){src.push("uniform bool sectionPlaneActive"+_i300+";");src.push("uniform vec3 sectionPlanePos"+_i300+";");src.push("uniform vec3 sectionPlaneDir"+_i300+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = vFlags2 > 0u;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");src.push.apply(src,_toConsumableArray(buildSectionClipping(scene._sectionPlanesState,scene._sectionPlanesState.getNumAllocatedSectionPlanes())));src.push(" if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" outColor = vColor;");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);}();var tempVec3a$f=math.vec3();var tempVec3b$d=math.vec3();var tempVec3c$b=math.vec3();var tempMat4a$8=math.mat4();/**
|
|
16356
16398
|
* @private
|
|
16357
16399
|
*/var DTXTrianglesPickMeshRenderer=/*#__PURE__*/function(){function DTXTrianglesPickMeshRenderer(scene){_classCallCheck(this,DTXTrianglesPickMeshRenderer);this._scene=scene;this._hash=this._getHash();this._allocate();}return _createClass(DTXTrianglesPickMeshRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){return this._scene._sectionPlanesState.getHash();}},{key:"drawLayer",value:function drawLayer(frameCtx,dataTextureLayer,renderPass){if(!this._program){this._allocate(dataTextureLayer);if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram(frameCtx);}var model=dataTextureLayer.model;var scene=model.scene;var camera=scene.camera;var gl=scene.canvas.gl;var state=dataTextureLayer._state;var textureState=state.textureState;var origin=dataTextureLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;textureState.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var rtcViewMatrix;var rtcCameraEye;var gotOrigin=origin[0]!==0||origin[1]!==0||origin[2]!==0;var gotPosition=position[0]!==0||position[1]!==0||position[2]!==0;if(gotOrigin||gotPosition){var rtcOrigin=tempVec3a$f;if(gotOrigin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3b$d);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(camera.viewMatrix,rtcOrigin,tempMat4a$8);rtcCameraEye=tempVec3c$b;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];}else{rtcViewMatrix=camera.viewMatrix;rtcCameraEye=camera.eye;}gl.uniform2fv(this._uPickClipPos,frameCtx.pickClipPos);gl.uniform2f(this._uDrawingBufferSize,gl.drawingBufferWidth,gl.drawingBufferHeight);gl.uniformMatrix4fv(this._uSceneModelMatrix,false,rotationMatrixConjugate);gl.uniformMatrix4fv(this._uViewMatrix,false,rtcViewMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform1i(this._uRenderPass,renderPass);if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(camera.project.far+1.0)/Math.LN2);// TODO: Far from pick project matrix?
|
|
16358
16400
|
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}var numAllocatedSectionPlanes=scene._sectionPlanesState.getNumAllocatedSectionPlanes();var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numAllocatedSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=dataTextureLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numAllocatedSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){if(sectionPlaneIndex<numSectionPlanes){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var sectionPlane=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos(sectionPlane.dist,sectionPlane.dir,origin,tempVec3a$f,model.matrix);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,sectionPlane.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,sectionPlane.dir);}}else{gl.uniform1i(sectionPlaneUniforms.active,0);}}}}if(state.numIndices8Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8// 8 bits indices
|
|
@@ -18533,7 +18575,9 @@ _this74._origin=math.vec3(cfg.origin||[0,0,0]);_this74._position=math.vec3(cfg.p
|
|
|
18533
18575
|
* @private
|
|
18534
18576
|
* Brightness factor for this SceneModel. Applied per-frame as a shader
|
|
18535
18577
|
* uniform in the main color render passes (textured and untextured).
|
|
18536
|
-
*/_this74._brightness=cfg.brightness!==undefined?cfg.brightness:1.0;_this74._saoEnabled=cfg.saoEnabled!==false;_this74._pbrEnabled=cfg.pbrEnabled!==false;_this74._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this74._isModel=cfg.isModel;if(_this74._isModel){_this74.scene._registerModel(_this74);}_this74._onCameraViewMatrix=_this74.scene.camera.on("matrix",function(){_this74._viewMatrixDirty=true;});_this74._meshesWithDirtyMatrices=[];_this74._numMeshesWithDirtyMatrices=0;_this74._onTick=_this74.scene.on("tick",function(){while(_this74._numMeshesWithDirtyMatrices>0){_this74._meshesWithDirtyMatrices[--_this74._numMeshesWithDirtyMatrices]._updateMatrix();}});_this74._createDefaultTextureSet();_this74.visible=cfg.visible;_this74.culled=cfg.culled;_this74.pickable=cfg.pickable;_this74.clippable=cfg.clippable;_this74.collidable=cfg.collidable;_this74.castsShadow=cfg.castsShadow;_this74.receivesShadow=cfg.receivesShadow;_this74.xrayed=cfg.xrayed;_this74.highlighted=cfg.highlighted;_this74.selected=cfg.selected;_this74.edges=cfg.edges
|
|
18578
|
+
*/_this74._brightness=cfg.brightness!==undefined?cfg.brightness:1.0;_this74._saoEnabled=cfg.saoEnabled!==false;_this74._pbrEnabled=cfg.pbrEnabled!==false;_this74._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this74._isModel=cfg.isModel;if(_this74._isModel){_this74.scene._registerModel(_this74);}_this74._onCameraViewMatrix=_this74.scene.camera.on("matrix",function(){_this74._viewMatrixDirty=true;});_this74._meshesWithDirtyMatrices=[];_this74._numMeshesWithDirtyMatrices=0;_this74._onTick=_this74.scene.on("tick",function(){while(_this74._numMeshesWithDirtyMatrices>0){_this74._meshesWithDirtyMatrices[--_this74._numMeshesWithDirtyMatrices]._updateMatrix();}});_this74._createDefaultTextureSet();_this74.visible=cfg.visible;_this74.culled=cfg.culled;_this74.pickable=cfg.pickable;_this74.clippable=cfg.clippable;_this74.collidable=cfg.collidable;_this74.castsShadow=cfg.castsShadow;_this74.receivesShadow=cfg.receivesShadow;_this74.xrayed=cfg.xrayed;_this74.highlighted=cfg.highlighted;_this74.selected=cfg.selected;_this74.edges=cfg.edges;// XTC 房间体(spaceEids 命中)实体注册表:默认"仅轮廓"呈现,
|
|
18579
|
+
// 是否显示其半透明填充由 Scene#spacesVisible 控制(见 _registerSpaceEntity)。
|
|
18580
|
+
_this74._spaceEntities=[];_this74.colorize=cfg.colorize;_this74.opacity=cfg.opacity;_this74.backfaces=cfg.backfaces;return _this74;}_inherits(SceneModel,_Component25);return _createClass(SceneModel,[{key:"_meshMatrixDirty",value:function _meshMatrixDirty(mesh){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=mesh;}},{key:"_createDefaultTextureSet",value:function _createDefaultTextureSet(){// Every SceneModelMesh gets at least the default TextureSet,
|
|
18537
18581
|
// which contains empty default textures filled with color
|
|
18538
18582
|
var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,texture:new Texture2D({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]// [r, g, b, a]})
|
|
18539
18583
|
})});var defaultMetalRoughTexture=new SceneModelTexture({id:DEFAULT_METAL_ROUGH_TEXTURE_ID,texture:new Texture2D({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]// [unused, roughness, metalness, unused]
|
|
@@ -18792,22 +18836,32 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
|
|
|
18792
18836
|
*
|
|
18793
18837
|
* @type {Boolean}
|
|
18794
18838
|
*/},{key:"edges",get:function get(){return this.numEdgesLayerPortions>0;}/**
|
|
18839
|
+
* @private
|
|
18840
|
+
* 注册 XTC 房间体实体(解析时 spaceEids 命中)。默认呈现为"仅轮廓":边线始终开启,
|
|
18841
|
+
* 填充近全透明;显示半透明填充由 {@link Scene#spacesVisible} 开关控制。
|
|
18842
|
+
* @param {SceneModelEntity} entity
|
|
18843
|
+
*/,set:/**
|
|
18795
18844
|
* Sets if all {@link SceneModelEntity}s in this SceneModel have edges emphasised.
|
|
18796
18845
|
*
|
|
18797
18846
|
* @type {Boolean}
|
|
18798
|
-
|
|
18847
|
+
*/function set(edges){edges=!!edges;this._edges=edges;for(var _i367=0,len=this._entityList.length;_i367<len;_i367++){this._entityList[_i367].edges=edges;}this.glRedraw();}/**
|
|
18799
18848
|
* Gets if this SceneModel is culled from view.
|
|
18800
18849
|
*
|
|
18801
18850
|
* The SceneModel is only rendered when {@link SceneModel#visible} is true and {@link SceneModel#culled} is false.
|
|
18802
18851
|
*
|
|
18803
18852
|
* @type {Boolean}
|
|
18804
|
-
*/},{key:"
|
|
18853
|
+
*/},{key:"_registerSpaceEntity",value:function _registerSpaceEntity(entity){if(this._spaceEntities.indexOf(entity)===-1){this._spaceEntities.push(entity);}// 解析期(层尚未 finalize)只登记,呈现延迟到 preFinalize 末尾统一应用;
|
|
18854
|
+
// finalize 之后注册的(渐进加载等)立即应用。
|
|
18855
|
+
if(this._layersFinalized){this._applySpaceEntity(entity);}}/** @private 应用单个房间体的当前呈现状态 */},{key:"_applySpaceEntity",value:function _applySpaceEntity(entity){entity.edges=true;// 关闭态填充用 1/255 而非 0:DTX 渲染器会剔除 color.a==0 的顶点(含边线 pass),
|
|
18856
|
+
// 用 0 会连轮廓一起消失;1/255 的叠加效果肉眼不可见。
|
|
18857
|
+
// 开启态 128/255(约 50%,与切片 Viewer forceTransparentSpaces 同值)。
|
|
18858
|
+
entity.opacity=this.scene.spacesVisible?128/255:1/255;}/** @private 供 {@link Scene#spacesVisible} 切换时批量刷新本模型房间体 */},{key:"_applySpacesVisibility",value:function _applySpacesVisibility(){for(var _i368=0,len=this._spaceEntities.length;_i368<len;_i368++){this._applySpaceEntity(this._spaceEntities[_i368]);}}/** @private 含房间体轮廓的模型:即使全局 edgesEnabled 关闭,也允许边线 pass 入列(Renderer 门控用) */},{key:"edgesForced",get:function get(){return this._spaceEntities.length>0;}},{key:"culled",get:function get(){return this._culled;}/**
|
|
18805
18859
|
* Sets if this SceneModel is culled from view.
|
|
18806
18860
|
*
|
|
18807
18861
|
* The SceneModel is only rendered when {@link SceneModel#visible} is true and {@link SceneModel#culled} is false.
|
|
18808
18862
|
*
|
|
18809
18863
|
* @type {Boolean}
|
|
18810
|
-
*/,set:function set(culled){culled=!!culled;this._culled=culled;for(var
|
|
18864
|
+
*/,set:function set(culled){culled=!!culled;this._culled=culled;for(var _i369=0,len=this._entityList.length;_i369<len;_i369++){this._entityList[_i369].culled=culled;}this.glRedraw();}/**
|
|
18811
18865
|
* Gets if {@link SceneModelEntity}s in this SceneModel are clippable.
|
|
18812
18866
|
*
|
|
18813
18867
|
* Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
|
|
@@ -18819,7 +18873,7 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
|
|
|
18819
18873
|
* Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
|
|
18820
18874
|
*
|
|
18821
18875
|
* @type {Boolean}
|
|
18822
|
-
*/,set:function set(clippable){clippable=clippable!==false;this._clippable=clippable;for(var
|
|
18876
|
+
*/,set:function set(clippable){clippable=clippable!==false;this._clippable=clippable;for(var _i370=0,len=this._entityList.length;_i370<len;_i370++){this._entityList[_i370].clippable=clippable;}this.glRedraw();}/**
|
|
18823
18877
|
* Gets if this SceneModel is collidable.
|
|
18824
18878
|
*
|
|
18825
18879
|
* @type {Boolean}
|
|
@@ -18827,7 +18881,7 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
|
|
|
18827
18881
|
* Sets if {@link SceneModelEntity}s in this SceneModel are collidable.
|
|
18828
18882
|
*
|
|
18829
18883
|
* @type {Boolean}
|
|
18830
|
-
*/,set:function set(collidable){collidable=collidable!==false;this._collidable=collidable;for(var
|
|
18884
|
+
*/,set:function set(collidable){collidable=collidable!==false;this._collidable=collidable;for(var _i371=0,len=this._entityList.length;_i371<len;_i371++){this._entityList[_i371].collidable=collidable;}}/**
|
|
18831
18885
|
* Gets if this SceneModel is pickable.
|
|
18832
18886
|
*
|
|
18833
18887
|
* Picking is done via calls to {@link Scene#pick}.
|
|
@@ -18839,7 +18893,7 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
|
|
|
18839
18893
|
* Picking is done via calls to {@link Scene#pick}.
|
|
18840
18894
|
*
|
|
18841
18895
|
* @type {Boolean}
|
|
18842
|
-
*/,set:function set(pickable){pickable=pickable!==false;this._pickable=pickable;for(var
|
|
18896
|
+
*/,set:function set(pickable){pickable=pickable!==false;this._pickable=pickable;for(var _i372=0,len=this._entityList.length;_i372<len;_i372++){this._entityList[_i372].pickable=pickable;}}/**
|
|
18843
18897
|
* Gets the RGB colorize color for this SceneModel.
|
|
18844
18898
|
*
|
|
18845
18899
|
* Each element of the color is in range ````[0..1]````.
|
|
@@ -18853,7 +18907,7 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
|
|
|
18853
18907
|
* Each element of the color is in range ````[0..1]````.
|
|
18854
18908
|
*
|
|
18855
18909
|
* @type {Number[]}
|
|
18856
|
-
*/,set:function set(colorize){this._colorize=colorize;for(var
|
|
18910
|
+
*/,set:function set(colorize){this._colorize=colorize;for(var _i373=0,len=this._entityList.length;_i373<len;_i373++){this._entityList[_i373].colorize=colorize;}}/**
|
|
18857
18911
|
* Gets this SceneModel's opacity factor.
|
|
18858
18912
|
*
|
|
18859
18913
|
* This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
|
|
@@ -18865,7 +18919,7 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
|
|
|
18865
18919
|
* This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
|
|
18866
18920
|
*
|
|
18867
18921
|
* @type {Number}
|
|
18868
|
-
*/,set:function set(opacity){this._opacity=opacity;for(var
|
|
18922
|
+
*/,set:function set(opacity){this._opacity=opacity;for(var _i374=0,len=this._entityList.length;_i374<len;_i374++){this._entityList[_i374].opacity=opacity;}}/**
|
|
18869
18923
|
* Gets the brightness factor for this SceneModel.
|
|
18870
18924
|
*
|
|
18871
18925
|
* A factor > 1 brightens the model, < 1 darkens. Default is ````1.0````.
|
|
@@ -18976,7 +19030,7 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
|
|
|
18976
19030
|
* @param {Number[]} [cfg.uvDecodeMatrix] A 3x3 matrix for decompressing ````uvCompressed````.
|
|
18977
19031
|
* @param {Number[]} [cfg.indices] Array of primitive connectivity indices. Not required for `points` primitives.
|
|
18978
19032
|
* @param {Number[]} [cfg.edgeIndices] Array of edge line indices. Used only with 'triangles', 'solid' and 'surface' primitives. Automatically generated internally if not supplied, using the optional ````edgeThreshold```` given to the ````SceneModel```` constructor.
|
|
18979
|
-
*/},{key:"createGeometry",value:function createGeometry(cfg){if(cfg.id===undefined||cfg.id===null){this.error("[createGeometry] Config missing: id");return;}if(this._geometries[cfg.id]){this.error("[createGeometry] Geometry already created: "+cfg.id);return;}if(cfg.primitive===undefined||cfg.primitive===null){cfg.primitive="triangles";}if(cfg.primitive!=="points"&&cfg.primitive!=="lines"&&cfg.primitive!=="triangles"&&cfg.primitive!=="solid"&&cfg.primitive!=="surface"){this.error("[createGeometry] Unsupported value for 'primitive': '".concat(cfg.primitive,"' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'."));return;}if(!cfg.positions&&!cfg.positionsCompressed&&!cfg.buckets){this.error("[createGeometry] Param expected: `positions`, `positionsCompressed' or 'buckets");return null;}if(cfg.positionsCompressed&&!cfg.positionsDecodeMatrix&&!cfg.positionsDecodeBoundary){this.error("[createGeometry] Param expected: `positionsDecodeMatrix` or 'positionsDecodeBoundary' (required for `positionsCompressed')");return null;}if(cfg.positionsDecodeMatrix&&cfg.positionsDecodeBoundary){this.error("[createGeometry] Only one of these params expected: `positionsDecodeMatrix` or 'positionsDecodeBoundary' (required for `positionsCompressed')");return null;}if(cfg.uvCompressed&&!cfg.uvDecodeMatrix){this.error("[createGeometry] Param expected: `uvDecodeMatrix` (required for `uvCompressed')");return null;}if(!cfg.buckets&&!cfg.indices&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")){var numPositions=(cfg.positions||cfg.positionsCompressed).length/3;cfg.indices=this._createDefaultIndices(numPositions);}if(!cfg.buckets&&!cfg.indices&&cfg.primitive!=="points"){this.error("[createGeometry] Param expected: indices (required for '".concat(cfg.primitive,"' primitive type)"));return null;}if(cfg.positionsDecodeBoundary){cfg.positionsDecodeMatrix=createPositionsDecodeMatrix(cfg.positionsDecodeBoundary,math.mat4());}if(cfg.positions){var aabb=math.collapseAABB3();cfg.positionsDecodeMatrix=math.mat4();math.expandAABB3Points3(aabb,cfg.positions);cfg.positionsCompressed=quantizePositions(cfg.positions,aabb,cfg.positionsDecodeMatrix);cfg.aabb=aabb;}else if(cfg.positionsCompressed){var _aabb=math.collapseAABB3();cfg.positionsDecodeMatrix=new Float64Array(cfg.positionsDecodeMatrix);cfg.positionsCompressed=new Uint16Array(cfg.positionsCompressed);math.expandAABB3Points3(_aabb,cfg.positionsCompressed);geometryCompressionUtils.decompressAABB(_aabb,cfg.positionsDecodeMatrix);cfg.aabb=_aabb;}else if(cfg.buckets){var _aabb2=math.collapseAABB3();this._dtxBuckets[cfg.id]=cfg.buckets;for(var
|
|
19033
|
+
*/},{key:"createGeometry",value:function createGeometry(cfg){if(cfg.id===undefined||cfg.id===null){this.error("[createGeometry] Config missing: id");return;}if(this._geometries[cfg.id]){this.error("[createGeometry] Geometry already created: "+cfg.id);return;}if(cfg.primitive===undefined||cfg.primitive===null){cfg.primitive="triangles";}if(cfg.primitive!=="points"&&cfg.primitive!=="lines"&&cfg.primitive!=="triangles"&&cfg.primitive!=="solid"&&cfg.primitive!=="surface"){this.error("[createGeometry] Unsupported value for 'primitive': '".concat(cfg.primitive,"' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'."));return;}if(!cfg.positions&&!cfg.positionsCompressed&&!cfg.buckets){this.error("[createGeometry] Param expected: `positions`, `positionsCompressed' or 'buckets");return null;}if(cfg.positionsCompressed&&!cfg.positionsDecodeMatrix&&!cfg.positionsDecodeBoundary){this.error("[createGeometry] Param expected: `positionsDecodeMatrix` or 'positionsDecodeBoundary' (required for `positionsCompressed')");return null;}if(cfg.positionsDecodeMatrix&&cfg.positionsDecodeBoundary){this.error("[createGeometry] Only one of these params expected: `positionsDecodeMatrix` or 'positionsDecodeBoundary' (required for `positionsCompressed')");return null;}if(cfg.uvCompressed&&!cfg.uvDecodeMatrix){this.error("[createGeometry] Param expected: `uvDecodeMatrix` (required for `uvCompressed')");return null;}if(!cfg.buckets&&!cfg.indices&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")){var numPositions=(cfg.positions||cfg.positionsCompressed).length/3;cfg.indices=this._createDefaultIndices(numPositions);}if(!cfg.buckets&&!cfg.indices&&cfg.primitive!=="points"){this.error("[createGeometry] Param expected: indices (required for '".concat(cfg.primitive,"' primitive type)"));return null;}if(cfg.positionsDecodeBoundary){cfg.positionsDecodeMatrix=createPositionsDecodeMatrix(cfg.positionsDecodeBoundary,math.mat4());}if(cfg.positions){var aabb=math.collapseAABB3();cfg.positionsDecodeMatrix=math.mat4();math.expandAABB3Points3(aabb,cfg.positions);cfg.positionsCompressed=quantizePositions(cfg.positions,aabb,cfg.positionsDecodeMatrix);cfg.aabb=aabb;}else if(cfg.positionsCompressed){var _aabb=math.collapseAABB3();cfg.positionsDecodeMatrix=new Float64Array(cfg.positionsDecodeMatrix);cfg.positionsCompressed=new Uint16Array(cfg.positionsCompressed);math.expandAABB3Points3(_aabb,cfg.positionsCompressed);geometryCompressionUtils.decompressAABB(_aabb,cfg.positionsDecodeMatrix);cfg.aabb=_aabb;}else if(cfg.buckets){var _aabb2=math.collapseAABB3();this._dtxBuckets[cfg.id]=cfg.buckets;for(var _i375=0,len=cfg.buckets.length;_i375<len;_i375++){var bucket=cfg.buckets[_i375];if(bucket.positions){math.expandAABB3Points3(_aabb2,bucket.positions);}else if(bucket.positionsCompressed){math.expandAABB3Points3(_aabb2,bucket.positionsCompressed);}}if(cfg.positionsDecodeMatrix){geometryCompressionUtils.decompressAABB(_aabb2,cfg.positionsDecodeMatrix);}cfg.aabb=_aabb2;}if(cfg.colorsCompressed&&cfg.colorsCompressed.length>0){cfg.colorsCompressed=new Uint8Array(cfg.colorsCompressed);}else if(cfg.colors&&cfg.colors.length>0){var colors=cfg.colors;var colorsCompressed=new Uint8Array(colors.length);for(var _i376=0,_len54=colors.length;_i376<_len54;_i376++){colorsCompressed[_i376]=colors[_i376]*255;}cfg.colorsCompressed=colorsCompressed;}if(!cfg.buckets&&!cfg.edgeIndices&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")){if(cfg.positions){cfg.edgeIndices=buildEdgeIndices(cfg.positions,cfg.indices,null,5.0);}else{cfg.edgeIndices=buildEdgeIndices(cfg.positionsCompressed,cfg.indices,cfg.positionsDecodeMatrix,2.0);}}if(cfg.uv){var bounds=geometryCompressionUtils.getUVBounds(cfg.uv);var result=geometryCompressionUtils.compressUVs(cfg.uv,bounds.min,bounds.max);cfg.uvCompressed=result.quantized;cfg.uvDecodeMatrix=result.decodeMatrix;}else if(cfg.uvCompressed){cfg.uvCompressed=new Uint16Array(cfg.uvCompressed);cfg.uvDecodeMatrix=new Float64Array(cfg.uvDecodeMatrix);}if(cfg.normals){// HACK
|
|
18980
19034
|
cfg.normals=null;}this._geometries[cfg.id]=cfg;this._numTriangles+=cfg.indices?Math.round(cfg.indices.length/3):0;this.numGeometries++;}/**
|
|
18981
19035
|
* Creates a texture within this SceneModel.
|
|
18982
19036
|
*
|
|
@@ -19086,7 +19140,7 @@ if(cfg.matrix){cfg.meshMatrix=cfg.matrix;}else if(cfg.scale||cfg.rotation||cfg.p
|
|
|
19086
19140
|
cfg.type=DTX;// NPR
|
|
19087
19141
|
cfg.color=cfg.color?new Uint8Array([Math.floor(cfg.color[0]*255),Math.floor(cfg.color[1]*255),Math.floor(cfg.color[2]*255)]):defaultCompressedColor;cfg.opacity=cfg.opacity!==undefined&&cfg.opacity!==null?Math.floor(cfg.opacity*255):255;// RTC
|
|
19088
19142
|
if(cfg.positions){var rtcCenter=math.vec3();var rtcPositions=[];var rtcNeeded=worldToRTCPositions(cfg.positions,rtcPositions,rtcCenter);if(rtcNeeded){cfg.positions=rtcPositions;cfg.origin=math.addVec3(cfg.origin,rtcCenter,rtcCenter);}}// COMPRESSION
|
|
19089
|
-
if(cfg.positions){var aabb=math.collapseAABB3();cfg.positionsDecodeMatrix=math.mat4();math.expandAABB3Points3(aabb,cfg.positions);cfg.positionsCompressed=quantizePositions(cfg.positions,aabb,cfg.positionsDecodeMatrix);cfg.aabb=aabb;}else if(cfg.positionsCompressed){var _aabb3=math.collapseAABB3();math.expandAABB3Points3(_aabb3,cfg.positionsCompressed);geometryCompressionUtils.decompressAABB(_aabb3,cfg.positionsDecodeMatrix);cfg.aabb=_aabb3;}if(cfg.buckets){var _aabb4=math.collapseAABB3();for(var
|
|
19143
|
+
if(cfg.positions){var aabb=math.collapseAABB3();cfg.positionsDecodeMatrix=math.mat4();math.expandAABB3Points3(aabb,cfg.positions);cfg.positionsCompressed=quantizePositions(cfg.positions,aabb,cfg.positionsDecodeMatrix);cfg.aabb=aabb;}else if(cfg.positionsCompressed){var _aabb3=math.collapseAABB3();math.expandAABB3Points3(_aabb3,cfg.positionsCompressed);geometryCompressionUtils.decompressAABB(_aabb3,cfg.positionsDecodeMatrix);cfg.aabb=_aabb3;}if(cfg.buckets){var _aabb4=math.collapseAABB3();for(var _i377=0,len=cfg.buckets.length;_i377<len;_i377++){var bucket=cfg.buckets[_i377];if(bucket.positions){math.expandAABB3Points3(_aabb4,bucket.positions);}else if(bucket.positionsCompressed){math.expandAABB3Points3(_aabb4,bucket.positionsCompressed);}}if(cfg.positionsDecodeMatrix){geometryCompressionUtils.decompressAABB(_aabb4,cfg.positionsDecodeMatrix);}cfg.aabb=_aabb4;}if(cfg.meshMatrix){math.AABB3ToOBB3(cfg.aabb,tempOBB3);math.transformOBB3(cfg.meshMatrix,tempOBB3);math.OBB3ToAABB3(tempOBB3,cfg.aabb);}// EDGES
|
|
19090
19144
|
if(!cfg.buckets&&!cfg.edgeIndices&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")){if(cfg.positions){// Faster
|
|
19091
19145
|
cfg.edgeIndices=buildEdgeIndices(cfg.positions,cfg.indices,null,2.0);}else{cfg.edgeIndices=buildEdgeIndices(cfg.positionsCompressed,cfg.indices,cfg.positionsDecodeMatrix,2.0);}}// BUCKETING
|
|
19092
19146
|
if(!cfg.buckets){cfg.buckets=createDTXBuckets(cfg,this._enableVertexWelding&&this._enableIndexBucketing);}}else{// VBO
|
|
@@ -19115,8 +19169,8 @@ if(cfg.textureSetId){cfg.textureSet=this._textureSets[cfg.textureSetId];// if (!
|
|
|
19115
19169
|
// this.error(`[createMesh] Texture set not found: ${cfg.textureSetId} - ensure that you create it first with createTextureSet()`);
|
|
19116
19170
|
// return false;
|
|
19117
19171
|
// }
|
|
19118
|
-
}}}cfg.numPrimitives=this._getNumPrimitives(cfg);return this._createMesh(cfg);}},{key:"_createDefaultIndices",value:function _createDefaultIndices(numIndices){var indices=[];for(var
|
|
19119
|
-
cfg.solid=cfg.primitive==="solid";mesh.origin=math.vec3(cfg.origin);switch(cfg.type){case DTX:mesh.layer=this._getDTXLayer(cfg);mesh.aabb=cfg.aabb;break;case VBO_BATCHED:mesh.layer=this._getVBOBatchingLayer(cfg);mesh.aabb=cfg.aabb;break;case VBO_INSTANCED:mesh.layer=this._getVBOInstancingLayer(cfg);mesh.aabb=cfg.aabb;break;}if(cfg.transform){cfg.meshMatrix=cfg.transform.worldMatrix;}mesh.portionId=mesh.layer.createPortion(mesh,cfg);mesh.numPrimitives=cfg.numPrimitives;this._meshes[cfg.id]=mesh;this._unusedMeshes[cfg.id]=mesh;this._meshList.push(mesh);return mesh;}},{key:"_getNumPrimitives",value:function _getNumPrimitives(cfg){var countIndices=0;var primitive=cfg.geometry?cfg.geometry.primitive:cfg.primitive;switch(primitive){case"triangles":case"solid":case"surface":switch(cfg.type){case DTX:for(var
|
|
19172
|
+
}}}cfg.numPrimitives=this._getNumPrimitives(cfg);return this._createMesh(cfg);}},{key:"_createDefaultIndices",value:function _createDefaultIndices(numIndices){var indices=[];for(var _i378=0;_i378<numIndices;_i378++){indices.push(_i378);}return indices;}},{key:"_createMesh",value:function _createMesh(cfg){var mesh=new SceneModelMesh(this,cfg.id,cfg.color,cfg.opacity,cfg.transform,cfg.textureSet);mesh.pickId=this.scene._renderer.getPickID(mesh);var pickId=mesh.pickId;var a=pickId>>24&0xff;var b=pickId>>16&0xff;var g=pickId>>8&0xff;var r=pickId&0xff;cfg.pickColor=new Uint8Array([r,g,b,a]);// Quantized pick color
|
|
19173
|
+
cfg.solid=cfg.primitive==="solid";mesh.origin=math.vec3(cfg.origin);switch(cfg.type){case DTX:mesh.layer=this._getDTXLayer(cfg);mesh.aabb=cfg.aabb;break;case VBO_BATCHED:mesh.layer=this._getVBOBatchingLayer(cfg);mesh.aabb=cfg.aabb;break;case VBO_INSTANCED:mesh.layer=this._getVBOInstancingLayer(cfg);mesh.aabb=cfg.aabb;break;}if(cfg.transform){cfg.meshMatrix=cfg.transform.worldMatrix;}mesh.portionId=mesh.layer.createPortion(mesh,cfg);mesh.numPrimitives=cfg.numPrimitives;this._meshes[cfg.id]=mesh;this._unusedMeshes[cfg.id]=mesh;this._meshList.push(mesh);return mesh;}},{key:"_getNumPrimitives",value:function _getNumPrimitives(cfg){var countIndices=0;var primitive=cfg.geometry?cfg.geometry.primitive:cfg.primitive;switch(primitive){case"triangles":case"solid":case"surface":switch(cfg.type){case DTX:for(var _i379=0,len=cfg.buckets.length;_i379<len;_i379++){countIndices+=cfg.buckets[_i379].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/3);case"points":switch(cfg.type){case DTX:for(var _i380=0,_len55=cfg.buckets.length;_i380<_len55;_i380++){countIndices+=cfg.buckets[_i380].positionsCompressed.length;}break;case VBO_BATCHED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;case VBO_INSTANCED:var geometry=cfg.geometry;countIndices+=geometry.positions?geometry.positions.length:geometry.positionsCompressed.length;break;}return Math.round(countIndices);case"lines":case"line-strip":switch(cfg.type){case DTX:for(var _i381=0,_len56=cfg.buckets.length;_i381<_len56;_i381++){countIndices+=cfg.buckets[_i381].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/2);}return 0;}},{key:"_getDTXLayer",value:function _getDTXLayer(cfg){var origin=cfg.origin;var primitive=cfg.geometry?cfg.geometry.primitive:cfg.primitive;var layerId=".".concat(primitive,".").concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]));var dtxLayer=this._dtxLayers[layerId];if(dtxLayer){if(!dtxLayer.canCreatePortion(cfg)){// dtxLayer.finalize();
|
|
19120
19174
|
delete this._dtxLayers[layerId];dtxLayer=null;}else{return dtxLayer;}}switch(primitive){case"triangles":case"solid":case"surface":dtxLayer=new DTXTrianglesLayer(this,{layerIndex:0,origin:origin,primitive:primitive});// layerIndex is set in #finalize()
|
|
19121
19175
|
break;case"lines":dtxLayer=new DTXLinesLayer(this,{layerIndex:0,origin:origin,primitive:primitive});// layerIndex is set in #finalize()
|
|
19122
19176
|
break;default:return;}this._dtxLayers[layerId]=dtxLayer;this.layerList.push(dtxLayer);this._layersToFinalize.push(dtxLayer);return dtxLayer;}},{key:"_getVBOBatchingLayer",value:function _getVBOBatchingLayer(cfg){var model=this;var origin=cfg.origin;cfg.renderLayer||0;var positionsDecodeHash=cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary?this._createHashStringFromMatrix(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary):"-";var textureSetId=cfg.textureSetId||"-";var layerId="".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]),".").concat(cfg.primitive,".").concat(positionsDecodeHash,".").concat(textureSetId);var vboBatchingLayer=this._vboBatchingLayers[layerId];if(vboBatchingLayer){return vboBatchingLayer;}var textureSet=cfg.textureSet;while(!vboBatchingLayer){switch(cfg.primitive){case"triangles":// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
@@ -19139,7 +19193,7 @@ origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,primitive:cfg.prim
|
|
|
19139
19193
|
vboBatchingLayer=new VBOBatchingPointsLayer({model:model,layerIndex:0,// This is set in #finalize()
|
|
19140
19194
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
19141
19195
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
19142
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,primitive:cfg.primitive});break;}var lenPositions=cfg.positionsCompressed?cfg.positionsCompressed.length:cfg.positions.length;var canCreatePortion=cfg.primitive==="points"?vboBatchingLayer.canCreatePortion(lenPositions):vboBatchingLayer.canCreatePortion(lenPositions,cfg.indices.length);if(!canCreatePortion){vboBatchingLayer.finalize();delete this._vboBatchingLayers[layerId];vboBatchingLayer=null;}}this._vboBatchingLayers[layerId]=vboBatchingLayer;this.layerList.push(vboBatchingLayer);this._layersToFinalize.push(vboBatchingLayer);return vboBatchingLayer;}},{key:"_createHashStringFromMatrix",value:function _createHashStringFromMatrix(matrix){var matrixString=matrix.join("");var hash=0;for(var
|
|
19196
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,primitive:cfg.primitive});break;}var lenPositions=cfg.positionsCompressed?cfg.positionsCompressed.length:cfg.positions.length;var canCreatePortion=cfg.primitive==="points"?vboBatchingLayer.canCreatePortion(lenPositions):vboBatchingLayer.canCreatePortion(lenPositions,cfg.indices.length);if(!canCreatePortion){vboBatchingLayer.finalize();delete this._vboBatchingLayers[layerId];vboBatchingLayer=null;}}this._vboBatchingLayers[layerId]=vboBatchingLayer;this.layerList.push(vboBatchingLayer);this._layersToFinalize.push(vboBatchingLayer);return vboBatchingLayer;}},{key:"_createHashStringFromMatrix",value:function _createHashStringFromMatrix(matrix){var matrixString=matrix.join("");var hash=0;for(var _i382=0;_i382<matrixString.length;_i382++){var _char=matrixString.charCodeAt(_i382);hash=(hash<<5)-hash+_char;hash|=0;// Convert to 32-bit integer
|
|
19143
19197
|
}var hashString=(hash>>>0).toString(16);return hashString;}},{key:"_getVBOInstancingLayer",value:function _getVBOInstancingLayer(cfg){var model=this;var origin=cfg.origin;var textureSetId=cfg.textureSetId||"-";var geometryId=cfg.geometryId;var layerId="".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]),".").concat(textureSetId,".").concat(geometryId);var vboInstancingLayer=this._vboInstancingLayers[layerId];if(vboInstancingLayer){return vboInstancingLayer;}var textureSet=cfg.textureSet;var geometry=cfg.geometry;while(!vboInstancingLayer){switch(geometry.primitive){case"triangles":// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
19144
19198
|
vboInstancingLayer=new VBOInstancingTrianglesLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:false});break;case"solid":// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
19145
19199
|
vboInstancingLayer=new VBOInstancingTrianglesLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:true});break;case"surface":// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
@@ -19178,7 +19232,7 @@ vboInstancingLayer=new VBOInstancingPointsLayer({model:model,textureSet:textureS
|
|
|
19178
19232
|
* @param {Boolean} [cfg.selected=false] Indicates if the SceneModelEntity is initially selected. Selected appearance is configured by {@link SceneModel#selectedMaterial}.
|
|
19179
19233
|
* @param {Boolean} [cfg.edges=false] Indicates if the SceneModelEntity's edges are initially emphasized. Edges appearance is configured by {@link SceneModel#edgeMaterial}.
|
|
19180
19234
|
* @returns {SceneModelEntity} The new SceneModelEntity.
|
|
19181
|
-
*/},{key:"createEntity",value:function createEntity(cfg){if(cfg.id===undefined){cfg.id=math.createUUID();}else if(this.scene.components[cfg.id]){this.error("Scene already has a Component with this ID: ".concat(cfg.id," - will assign random ID"));cfg.id=math.createUUID();}if(cfg.meshIds===undefined){this.error("Config missing: meshIds");return;}var flags=0;if(this._visible&&cfg.visible!==false){flags=flags|ENTITY_FLAGS.VISIBLE;}if(this._pickable&&cfg.pickable!==false){flags=flags|ENTITY_FLAGS.PICKABLE;}if(this._culled&&cfg.culled!==false){flags=flags|ENTITY_FLAGS.CULLED;}if(this._clippable&&cfg.clippable!==false){flags=flags|ENTITY_FLAGS.CLIPPABLE;}if(this._collidable&&cfg.collidable!==false){flags=flags|ENTITY_FLAGS.COLLIDABLE;}if(this._edges&&cfg.edges!==false){flags=flags|ENTITY_FLAGS.EDGES;}if(this._xrayed&&cfg.xrayed!==false){flags=flags|ENTITY_FLAGS.XRAYED;}if(this._highlighted&&cfg.highlighted!==false){flags=flags|ENTITY_FLAGS.HIGHLIGHTED;}if(this._selected&&cfg.selected!==false){flags=flags|ENTITY_FLAGS.SELECTED;}cfg.flags=flags;return this._createEntity(cfg);}},{key:"_createEntity",value:function _createEntity(cfg){var meshes=[];for(var
|
|
19235
|
+
*/},{key:"createEntity",value:function createEntity(cfg){if(cfg.id===undefined){cfg.id=math.createUUID();}else if(this.scene.components[cfg.id]){this.error("Scene already has a Component with this ID: ".concat(cfg.id," - will assign random ID"));cfg.id=math.createUUID();}if(cfg.meshIds===undefined){this.error("Config missing: meshIds");return;}var flags=0;if(this._visible&&cfg.visible!==false){flags=flags|ENTITY_FLAGS.VISIBLE;}if(this._pickable&&cfg.pickable!==false){flags=flags|ENTITY_FLAGS.PICKABLE;}if(this._culled&&cfg.culled!==false){flags=flags|ENTITY_FLAGS.CULLED;}if(this._clippable&&cfg.clippable!==false){flags=flags|ENTITY_FLAGS.CLIPPABLE;}if(this._collidable&&cfg.collidable!==false){flags=flags|ENTITY_FLAGS.COLLIDABLE;}if(this._edges&&cfg.edges!==false){flags=flags|ENTITY_FLAGS.EDGES;}if(this._xrayed&&cfg.xrayed!==false){flags=flags|ENTITY_FLAGS.XRAYED;}if(this._highlighted&&cfg.highlighted!==false){flags=flags|ENTITY_FLAGS.HIGHLIGHTED;}if(this._selected&&cfg.selected!==false){flags=flags|ENTITY_FLAGS.SELECTED;}cfg.flags=flags;return this._createEntity(cfg);}},{key:"_createEntity",value:function _createEntity(cfg){var meshes=[];for(var _i383=0,len=cfg.meshIds.length;_i383<len;_i383++){var meshId=cfg.meshIds[_i383];var _mesh4=this._meshes[meshId];// Trying to get already created mesh
|
|
19182
19236
|
if(!_mesh4){// Checks if there is already created mesh for this meshId
|
|
19183
19237
|
this.error("Mesh with this ID not found: \"".concat(meshId,"\" - ignoring this mesh"));// There is no such cfg
|
|
19184
19238
|
continue;}if(_mesh4.parent){this.error("Mesh with ID \"".concat(meshId,"\" already belongs to object with ID \"").concat(_mesh4.parent.id,"\" - ignoring this mesh"));continue;}meshes.push(_mesh4);delete this._unusedMeshes[meshId];}// 同一模型内出现重复的对象 ID(例如 XTC 将同一对象写成多条 entity 记录):
|
|
@@ -19190,33 +19244,36 @@ this._entityList.push(entity);this._entities[cfg.id]=entity;this._entitiesToFina
|
|
|
19190
19244
|
* Pre-renders all meshes that have been added, even if the SceneModel has not bee finalized yet.
|
|
19191
19245
|
* This is use for progressively showing the SceneModel while it is being loaded or constructed.
|
|
19192
19246
|
* @returns {boolean}
|
|
19193
|
-
*/},{key:"preFinalize",value:function preFinalize(){if(this.destroyed){return false;}if(this._layersToFinalize.length===0){return false;}this._createDummyEntityForUnusedMeshes();for(var
|
|
19194
|
-
this.layerList.sort(function(a,b){if(a.sortId<b.sortId){return-1;}if(a.sortId>b.sortId){return 1;}return 0;});for(var
|
|
19247
|
+
*/},{key:"preFinalize",value:function preFinalize(){if(this.destroyed){return false;}if(this._layersToFinalize.length===0){return false;}this._createDummyEntityForUnusedMeshes();for(var _i384=0,len=this._layersToFinalize.length;_i384<len;_i384++){var layer=this._layersToFinalize[_i384];layer.finalize();}this._vboBatchingLayers={};this._vboInstancingLayers={};this._dtxLayers={};this._layersToFinalize=[];for(var _i385=0,_len57=this._entitiesToFinalize.length;_i385<_len57;_i385++){var entity=this._entitiesToFinalize[_i385];entity._finalize();}for(var _i386=0,_len58=this._entitiesToFinalize.length;_i386<_len58;_i386++){var _entity=this._entitiesToFinalize[_i386];_entity._finalize2();}this._entitiesToFinalize=[];this.scene._aabbDirty=true;this._viewMatrixDirty=true;this._matrixDirty=true;this._aabbDirty=true;this._setWorldMatrixDirty();this._sceneModelDirty();this.position=this._position;// Sort layers to reduce WebGL shader switching when rendering them
|
|
19248
|
+
this.layerList.sort(function(a,b){if(a.sortId<b.sortId){return-1;}if(a.sortId>b.sortId){return 1;}return 0;});for(var _i387=0,_len59=this.layerList.length;_i387<_len59;_i387++){var _layer=this.layerList[_i387];_layer.layerIndex=_i387;}this.glRedraw();this._layersFinalized=true;// 房间体(spaceEids 命中)呈现:必须等各层 finalize 之后再应用——
|
|
19249
|
+
// 解析期就调用 entity.edges/opacity 会触发 DTX 层 "Not finalized",
|
|
19250
|
+
// 且 loader 的 parse 异常会成为 unhandled rejection,导致模型被静默截断。
|
|
19251
|
+
if(this._spaceEntities.length>0){this._applySpacesVisibility();}}/**
|
|
19195
19252
|
* Finalizes this SceneModel.
|
|
19196
19253
|
*
|
|
19197
19254
|
* Once finalized, you can't add anything more to this SceneModel.
|
|
19198
19255
|
*/},{key:"finalize",value:function finalize(){if(this.destroyed){return;}this.preFinalize();this._geometries={};this._dtxBuckets={};this._textures={};this._textureSets={};}/** @private */},{key:"stateSortCompare",value:function stateSortCompare(drawable1,drawable2){}/** @private */},{key:"rebuildRenderFlags",value:function rebuildRenderFlags(){this.renderFlags.reset();this._updateRenderFlagsVisibleLayers();if(this.renderFlags.numLayers>0&&this.renderFlags.numVisibleLayers===0){this.renderFlags.culled=true;return;}this._updateRenderFlags();}/**
|
|
19199
19256
|
* @private
|
|
19200
|
-
*/},{key:"_updateRenderFlagsVisibleLayers",value:function _updateRenderFlagsVisibleLayers(){var renderFlags=this.renderFlags;renderFlags.numLayers=this.layerList.length;renderFlags.numVisibleLayers=0;for(var layerIndex=0,len=this.layerList.length;layerIndex<len;layerIndex++){var layer=this.layerList[layerIndex];var layerVisible=this._getActiveSectionPlanesForLayer(layer);if(layerVisible){renderFlags.visibleLayers[renderFlags.numVisibleLayers++]=layerIndex;}}}/** @private */},{key:"_createDummyEntityForUnusedMeshes",value:function _createDummyEntityForUnusedMeshes(){var unusedMeshIds=Object.keys(this._unusedMeshes);if(unusedMeshIds.length>0){var entityId="".concat(this.id,"-").concat(math.createUUID());this.warn("Creating dummy SceneModelEntity \"".concat(entityId,"\" for unused SceneMeshes: [").concat(unusedMeshIds.join(","),"]"));this.createEntity({id:entityId,meshIds:unusedMeshIds,isObject:true});}this._unusedMeshes={};}},{key:"_getActiveSectionPlanesForLayer",value:function _getActiveSectionPlanesForLayer(layer){var renderFlags=this.renderFlags;var sectionPlanes=this.scene._sectionPlanesState.sectionPlanes;var numSectionPlanes=sectionPlanes.length;var baseIndex=layer.layerIndex*numSectionPlanes;if(numSectionPlanes>0){for(var
|
|
19201
|
-
/** @private */},{key:"drawColorOpaque",value:function drawColorOpaque(frameCtx,layerList){var renderFlags=this.renderFlags;for(var
|
|
19202
|
-
var renderFlags=this.renderFlags;for(var
|
|
19203
|
-
var renderFlags=this.renderFlags;for(var
|
|
19257
|
+
*/},{key:"_updateRenderFlagsVisibleLayers",value:function _updateRenderFlagsVisibleLayers(){var renderFlags=this.renderFlags;renderFlags.numLayers=this.layerList.length;renderFlags.numVisibleLayers=0;for(var layerIndex=0,len=this.layerList.length;layerIndex<len;layerIndex++){var layer=this.layerList[layerIndex];var layerVisible=this._getActiveSectionPlanesForLayer(layer);if(layerVisible){renderFlags.visibleLayers[renderFlags.numVisibleLayers++]=layerIndex;}}}/** @private */},{key:"_createDummyEntityForUnusedMeshes",value:function _createDummyEntityForUnusedMeshes(){var unusedMeshIds=Object.keys(this._unusedMeshes);if(unusedMeshIds.length>0){var entityId="".concat(this.id,"-").concat(math.createUUID());this.warn("Creating dummy SceneModelEntity \"".concat(entityId,"\" for unused SceneMeshes: [").concat(unusedMeshIds.join(","),"]"));this.createEntity({id:entityId,meshIds:unusedMeshIds,isObject:true});}this._unusedMeshes={};}},{key:"_getActiveSectionPlanesForLayer",value:function _getActiveSectionPlanesForLayer(layer){var renderFlags=this.renderFlags;var sectionPlanes=this.scene._sectionPlanesState.sectionPlanes;var numSectionPlanes=sectionPlanes.length;var baseIndex=layer.layerIndex*numSectionPlanes;if(numSectionPlanes>0){for(var _i388=0;_i388<numSectionPlanes;_i388++){var sectionPlane=sectionPlanes[_i388];if(!sectionPlane.active){renderFlags.sectionPlanesActivePerLayer[baseIndex+_i388]=false;}else{renderFlags.sectionPlanesActivePerLayer[baseIndex+_i388]=true;renderFlags.sectioned=true;}}}return true;}},{key:"_updateRenderFlags",value:function _updateRenderFlags(){if(this.numVisibleLayerPortions===0){return;}if(this.numCulledLayerPortions===this.numPortions){return;}var renderFlags=this.renderFlags;renderFlags.colorOpaque=this.numTransparentLayerPortions<this.numPortions;if(this.numTransparentLayerPortions>0){renderFlags.colorTransparent=true;}if(this.numXRayedLayerPortions>0){var xrayMaterial=this.scene.xrayMaterial._state;if(xrayMaterial.fill){if(xrayMaterial.fillAlpha<1.0){renderFlags.xrayedSilhouetteTransparent=true;}else{renderFlags.xrayedSilhouetteOpaque=true;}}if(xrayMaterial.edges){if(xrayMaterial.edgeAlpha<1.0){renderFlags.xrayedEdgesTransparent=true;}else{renderFlags.xrayedEdgesOpaque=true;}}}if(this.numEdgesLayerPortions>0){var edgeMaterial=this.scene.edgeMaterial._state;if(edgeMaterial.edges){renderFlags.edgesOpaque=this.numTransparentLayerPortions<this.numPortions;if(this.numTransparentLayerPortions>0){renderFlags.edgesTransparent=true;}}}if(this.numSelectedLayerPortions>0){var selectedMaterial=this.scene.selectedMaterial._state;if(selectedMaterial.fill){if(selectedMaterial.fillAlpha<1.0){renderFlags.selectedSilhouetteTransparent=true;}else{renderFlags.selectedSilhouetteOpaque=true;}}if(selectedMaterial.edges){if(selectedMaterial.edgeAlpha<1.0){renderFlags.selectedEdgesTransparent=true;}else{renderFlags.selectedEdgesOpaque=true;}}}if(this.numHighlightedLayerPortions>0){var highlightMaterial=this.scene.highlightMaterial._state;if(highlightMaterial.fill){if(highlightMaterial.fillAlpha<1.0){renderFlags.highlightedSilhouetteTransparent=true;}else{renderFlags.highlightedSilhouetteOpaque=true;}}if(highlightMaterial.edges){if(highlightMaterial.edgeAlpha<1.0){renderFlags.highlightedEdgesTransparent=true;}else{renderFlags.highlightedEdgesOpaque=true;}}}}// -------------- RENDERING ---------------------------------------------------------------------------------------
|
|
19258
|
+
/** @private */},{key:"drawColorOpaque",value:function drawColorOpaque(frameCtx,layerList){var renderFlags=this.renderFlags;for(var _i389=0,len=renderFlags.visibleLayers.length;_i389<len;_i389++){var layerIndex=renderFlags.visibleLayers[_i389];this.layerList[layerIndex].drawColorOpaque(renderFlags,frameCtx);}}/** @private */},{key:"drawColorTransparent",value:function drawColorTransparent(frameCtx){var renderFlags=this.renderFlags;for(var _i390=0,len=renderFlags.visibleLayers.length;_i390<len;_i390++){var layerIndex=renderFlags.visibleLayers[_i390];this.layerList[layerIndex].drawColorTransparent(renderFlags,frameCtx);}}/** @private */},{key:"drawDepth",value:function drawDepth(frameCtx){// Dedicated to SAO because it skips transparent objects
|
|
19259
|
+
var renderFlags=this.renderFlags;for(var _i391=0,len=renderFlags.visibleLayers.length;_i391<len;_i391++){var layerIndex=renderFlags.visibleLayers[_i391];this.layerList[layerIndex].drawDepth(renderFlags,frameCtx);}}/** @private */},{key:"drawNormals",value:function drawNormals(frameCtx){// Dedicated to SAO because it skips transparent objects
|
|
19260
|
+
var renderFlags=this.renderFlags;for(var _i392=0,len=renderFlags.visibleLayers.length;_i392<len;_i392++){var layerIndex=renderFlags.visibleLayers[_i392];this.layerList[layerIndex].drawNormals(renderFlags,frameCtx);}}/** @private */},{key:"drawSilhouetteXRayed",value:function drawSilhouetteXRayed(frameCtx){var renderFlags=this.renderFlags;for(var _i393=0,len=renderFlags.visibleLayers.length;_i393<len;_i393++){var layerIndex=renderFlags.visibleLayers[_i393];this.layerList[layerIndex].drawSilhouetteXRayed(renderFlags,frameCtx);}}/** @private */},{key:"drawSilhouetteHighlighted",value:function drawSilhouetteHighlighted(frameCtx){var renderFlags=this.renderFlags;for(var _i394=0,len=renderFlags.visibleLayers.length;_i394<len;_i394++){var layerIndex=renderFlags.visibleLayers[_i394];this.layerList[layerIndex].drawSilhouetteHighlighted(renderFlags,frameCtx);}}/** @private */},{key:"drawSilhouetteSelected",value:function drawSilhouetteSelected(frameCtx){var renderFlags=this.renderFlags;for(var _i395=0,len=renderFlags.visibleLayers.length;_i395<len;_i395++){var layerIndex=renderFlags.visibleLayers[_i395];this.layerList[layerIndex].drawSilhouetteSelected(renderFlags,frameCtx);}}/** @private */},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(frameCtx){var renderFlags=this.renderFlags;for(var _i396=0,len=renderFlags.visibleLayers.length;_i396<len;_i396++){var layerIndex=renderFlags.visibleLayers[_i396];this.layerList[layerIndex].drawEdgesColorOpaque(renderFlags,frameCtx);}}/** @private */},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(frameCtx){var renderFlags=this.renderFlags;for(var _i397=0,len=renderFlags.visibleLayers.length;_i397<len;_i397++){var layerIndex=renderFlags.visibleLayers[_i397];this.layerList[layerIndex].drawEdgesColorTransparent(renderFlags,frameCtx);}}/** @private */},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(frameCtx){var renderFlags=this.renderFlags;for(var _i398=0,len=renderFlags.visibleLayers.length;_i398<len;_i398++){var layerIndex=renderFlags.visibleLayers[_i398];this.layerList[layerIndex].drawEdgesXRayed(renderFlags,frameCtx);}}/** @private */},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(frameCtx){var renderFlags=this.renderFlags;for(var _i399=0,len=renderFlags.visibleLayers.length;_i399<len;_i399++){var layerIndex=renderFlags.visibleLayers[_i399];this.layerList[layerIndex].drawEdgesHighlighted(renderFlags,frameCtx);}}/** @private */},{key:"drawEdgesSelected",value:function drawEdgesSelected(frameCtx){var renderFlags=this.renderFlags;for(var _i400=0,len=renderFlags.visibleLayers.length;_i400<len;_i400++){var layerIndex=renderFlags.visibleLayers[_i400];this.layerList[layerIndex].drawEdgesSelected(renderFlags,frameCtx);}}/**
|
|
19204
19261
|
* @private
|
|
19205
|
-
*/},{key:"drawOcclusion",value:function drawOcclusion(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var
|
|
19262
|
+
*/},{key:"drawOcclusion",value:function drawOcclusion(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i401=0,len=renderFlags.visibleLayers.length;_i401<len;_i401++){var layerIndex=renderFlags.visibleLayers[_i401];this.layerList[layerIndex].drawOcclusion(renderFlags,frameCtx);}}/**
|
|
19206
19263
|
* @private
|
|
19207
|
-
*/},{key:"drawShadow",value:function drawShadow(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var
|
|
19264
|
+
*/},{key:"drawShadow",value:function drawShadow(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i402=0,len=renderFlags.visibleLayers.length;_i402<len;_i402++){var layerIndex=renderFlags.visibleLayers[_i402];this.layerList[layerIndex].drawShadow(renderFlags,frameCtx);}}/** @private */},{key:"setPickMatrices",value:function setPickMatrices(pickViewMatrix,pickProjMatrix){if(this._numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i403=0,len=renderFlags.visibleLayers.length;_i403<len;_i403++){var layerIndex=renderFlags.visibleLayers[_i403];var layer=this.layerList[layerIndex];if(layer.setPickMatrices){layer.setPickMatrices(pickViewMatrix,pickProjMatrix);}}}/** @private */},{key:"drawPickMesh",value:function drawPickMesh(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i404=0,len=renderFlags.visibleLayers.length;_i404<len;_i404++){var layerIndex=renderFlags.visibleLayers[_i404];this.layerList[layerIndex].drawPickMesh(renderFlags,frameCtx);}}/**
|
|
19208
19265
|
* Called by SceneModelMesh.drawPickDepths()
|
|
19209
19266
|
* @private
|
|
19210
|
-
*/},{key:"drawPickDepths",value:function drawPickDepths(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var
|
|
19267
|
+
*/},{key:"drawPickDepths",value:function drawPickDepths(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i405=0,len=renderFlags.visibleLayers.length;_i405<len;_i405++){var layerIndex=renderFlags.visibleLayers[_i405];this.layerList[layerIndex].drawPickDepths(renderFlags,frameCtx);}}/**
|
|
19211
19268
|
* Called by SceneModelMesh.drawPickNormals()
|
|
19212
19269
|
* @private
|
|
19213
|
-
*/},{key:"drawPickNormals",value:function drawPickNormals(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var
|
|
19270
|
+
*/},{key:"drawPickNormals",value:function drawPickNormals(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i406=0,len=renderFlags.visibleLayers.length;_i406<len;_i406++){var layerIndex=renderFlags.visibleLayers[_i406];this.layerList[layerIndex].drawPickNormals(renderFlags,frameCtx);}}/**
|
|
19214
19271
|
* @private
|
|
19215
|
-
*/},{key:"drawSnapInit",value:function drawSnapInit(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var
|
|
19272
|
+
*/},{key:"drawSnapInit",value:function drawSnapInit(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i407=0,len=renderFlags.visibleLayers.length;_i407<len;_i407++){var layerIndex=renderFlags.visibleLayers[_i407];var layer=this.layerList[layerIndex];if(layer.drawSnapInit){frameCtx.snapPickOrigin=[0,0,0];frameCtx.snapPickCoordinateScale=[1,1,1];frameCtx.snapPickLayerNumber++;layer.drawSnapInit(renderFlags,frameCtx);frameCtx.snapPickLayerParams[frameCtx.snapPickLayerNumber]={origin:frameCtx.snapPickOrigin.slice(),coordinateScale:frameCtx.snapPickCoordinateScale.slice()};}}}/**
|
|
19216
19273
|
* @private
|
|
19217
|
-
*/},{key:"drawSnap",value:function drawSnap(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var
|
|
19274
|
+
*/},{key:"drawSnap",value:function drawSnap(frameCtx){if(this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i408=0,len=renderFlags.visibleLayers.length;_i408<len;_i408++){var layerIndex=renderFlags.visibleLayers[_i408];var layer=this.layerList[layerIndex];if(layer.drawSnap){frameCtx.snapPickOrigin=[0,0,0];frameCtx.snapPickCoordinateScale=[1,1,1];frameCtx.snapPickLayerNumber++;layer.drawSnap(renderFlags,frameCtx);frameCtx.snapPickLayerParams[frameCtx.snapPickLayerNumber]={origin:frameCtx.snapPickOrigin.slice(),coordinateScale:frameCtx.snapPickCoordinateScale.slice()};}}}/**
|
|
19218
19275
|
* Destroys this SceneModel.
|
|
19219
|
-
*/},{key:"destroy",value:function destroy(){for(var layerId in this._vboBatchingLayers){if(this._vboBatchingLayers.hasOwnProperty(layerId)){this._vboBatchingLayers[layerId].destroy();}}this._vboBatchingLayers={};for(var _layerId in this._vboInstancingLayers){if(this._vboInstancingLayers.hasOwnProperty(_layerId)){this._vboInstancingLayers[_layerId].destroy();}}this._vboInstancingLayers={};this.scene.camera.off(this._onCameraViewMatrix);this.scene.off(this._onTick);for(var
|
|
19276
|
+
*/},{key:"destroy",value:function destroy(){for(var layerId in this._vboBatchingLayers){if(this._vboBatchingLayers.hasOwnProperty(layerId)){this._vboBatchingLayers[layerId].destroy();}}this._vboBatchingLayers={};for(var _layerId in this._vboInstancingLayers){if(this._vboInstancingLayers.hasOwnProperty(_layerId)){this._vboInstancingLayers[_layerId].destroy();}}this._vboInstancingLayers={};this.scene.camera.off(this._onCameraViewMatrix);this.scene.off(this._onTick);for(var _i409=0,len=this.layerList.length;_i409<len;_i409++){this.layerList[_i409].destroy();}this.layerList=[];for(var _i410=0,_len60=this._entityList.length;_i410<_len60;_i410++){this._entityList[_i410]._destroy();}this._layersToFinalize={};// Object.entries(this._geometries).forEach(([id, geometry]) => {
|
|
19220
19277
|
// geometry.destroy();
|
|
19221
19278
|
// });
|
|
19222
19279
|
this._geometries={};this._dtxBuckets={};this._textures={};this._textureSets={};this._meshes={};this._entities={};this.scene._aabbDirty=true;if(this._isModel){this.scene._deregisterModel(this);}putScratchMemory();_superPropGet(SceneModel,"destroy",this,3)([]);}}]);}(Component);/**
|
|
@@ -19308,7 +19365,7 @@ var _uniquifyPositions=uniquifyPositions({positionsCompressed:geometry.positions
|
|
|
19308
19365
|
* @param {Number[]} [cfg.color=[0,0,0]] The color of this ````LineSet````. This is both emissive and diffuse.
|
|
19309
19366
|
* @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
|
|
19310
19367
|
* @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
|
|
19311
|
-
*/function LineSet(owner){var _this76;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LineSet);_this76=_callSuper(this,LineSet,[owner,cfg]);_this76._positions=cfg.positions||[];if(cfg.indices){_this76._indices=cfg.indices;}else{_this76._indices=[];for(var
|
|
19368
|
+
*/function LineSet(owner){var _this76;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LineSet);_this76=_callSuper(this,LineSet,[owner,cfg]);_this76._positions=cfg.positions||[];if(cfg.indices){_this76._indices=cfg.indices;}else{_this76._indices=[];for(var _i411=0,len=_this76._positions.length/3-1;_i411<len;_i411+=2){_this76._indices.push(_i411);_this76._indices.push(_i411+1);}}_this76._sceneModel=new SceneModel(_this76,{isModel:false// Don't register in Scene.models
|
|
19312
19369
|
});_this76._sceneModel.createMesh({id:"linesMesh",primitive:"lines",positions:_this76._positions,indices:_this76._indices});_this76._sceneModel.createEntity({meshIds:["linesMesh"],visible:cfg.visible,clippable:cfg.clippable,collidable:cfg.collidable});_this76._sceneModel.finalize();_this76.scene._lineSetCreated(_this76);return _this76;}/**
|
|
19313
19370
|
* Sets if this ````LineSet```` is visible.
|
|
19314
19371
|
*
|
|
@@ -19669,11 +19726,11 @@ var lookDirection=math.normalizeVec3(math.subVec3(camera.look,camera.eye,math.ve
|
|
|
19669
19726
|
lookDirection=YToZ(lookDirection);eye=YToZ(eye);up=YToZ(up);}var camera_view_point=xyzArrayToObject(math.addVec3(eye,realWorldOffset));if(camera.projection==="ortho"){bcfViewpoint.orthogonal_camera={camera_view_point:camera_view_point,camera_direction:xyzArrayToObject(lookDirection),camera_up_vector:xyzArrayToObject(up),view_to_world_scale:camera.ortho.scale};}else{bcfViewpoint.perspective_camera={camera_view_point:camera_view_point,camera_direction:xyzArrayToObject(lookDirection),camera_up_vector:xyzArrayToObject(up),field_of_view:camera.perspective.fov};}// Section planes
|
|
19670
19727
|
var sectionPlanes=scene.sectionPlanes;for(var id in sectionPlanes){if(sectionPlanes.hasOwnProperty(id)){var sectionPlane=sectionPlanes[id];if(!sectionPlane.active){continue;}var location=sectionPlane.pos;var _direction=void 0;if(reverseClippingPlanes){_direction=math.negateVec3(sectionPlane.dir,math.vec3());}else{_direction=sectionPlane.dir;}if(camera.yUp){// BCF is Z up
|
|
19671
19728
|
location=YToZ(location);_direction=YToZ(_direction);}math.addVec3(location,realWorldOffset);location=xyzArrayToObject(location);_direction=xyzArrayToObject(_direction);if(!bcfViewpoint.clipping_planes){bcfViewpoint.clipping_planes=[];}bcfViewpoint.clipping_planes.push({location:location,direction:_direction});}}// Lines
|
|
19672
|
-
var lineSets=scene.lineSets;for(var _id2 in lineSets){if(lineSets.hasOwnProperty(_id2)){var lineSet=lineSets[_id2];if(!bcfViewpoint.lines){bcfViewpoint.lines=[];}var positions=lineSet.positions;var indices=lineSet.indices;for(var
|
|
19729
|
+
var lineSets=scene.lineSets;for(var _id2 in lineSets){if(lineSets.hasOwnProperty(_id2)){var lineSet=lineSets[_id2];if(!bcfViewpoint.lines){bcfViewpoint.lines=[];}var positions=lineSet.positions;var indices=lineSet.indices;for(var _i412=0,len=indices.length/2;_i412<len;_i412++){var _a6=indices[_i412*2];var b=indices[_i412*2+1];bcfViewpoint.lines.push({start_point:{x:positions[_a6*3+0],y:positions[_a6*3+1],z:positions[_a6*3+2]},end_point:{x:positions[b*3+0],y:positions[b*3+1],z:positions[b*3+2]}});}}}// Bitmaps
|
|
19673
19730
|
var bitmaps=scene.bitmaps;for(var _id3 in bitmaps){if(bitmaps.hasOwnProperty(_id3)){var bitmap=bitmaps[_id3];var _location=bitmap.pos;var normal=bitmap.normal;var _up=bitmap.up;if(camera.yUp){// BCF is Z up
|
|
19674
19731
|
_location=YToZ(_location);normal=YToZ(normal);_up=YToZ(_up);}math.addVec3(_location,realWorldOffset);if(!bcfViewpoint.bitmaps){bcfViewpoint.bitmaps=[];}bcfViewpoint.bitmaps.push({bitmap_type:bitmap.type,bitmap_data:bitmap.imageData,location:xyzArrayToObject(_location),normal:xyzArrayToObject(normal),up:xyzArrayToObject(_up),height:bitmap.height});}}// Entity states
|
|
19675
19732
|
bcfViewpoint.components={view_setup_hints:{spaces_visible:!!options.spacesVisible,space_boundaries_visible:!!options.spaceBoundariesVisible,openings_visible:!!options.openingsVisible,spaces_translucent:!!options.spaces_translucent,space_boundaries_translucent:!!options.space_boundaries_translucent,openings_translucent:!!options.openings_translucent},visibility:{}};var opacityObjectIds=new Set(scene.opacityObjectIds);var xrayedObjectIds=new Set(scene.xrayedObjectIds);var colorizedObjectIds=new Set(scene.colorizedObjectIds);var coloringMap=Object.values(scene.objects).filter(function(entity){return opacityObjectIds.has(entity.id)||colorizedObjectIds.has(entity.id)||xrayedObjectIds.has(entity.id);}).reduce(function(coloringMap,entity){var color=colorizeToRGB(entity.colorize);var alpha;if(entity.xrayed){if(scene.xrayMaterial.fillAlpha===0.0&&scene.xrayMaterial.edgeAlpha!==0.0){// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
|
19676
|
-
alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this78.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref12){var _ref13=_slicedToArray(_ref12,2),color=_ref13[0],components=_ref13[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);bcfViewpoint.components.translucency=this._createBCFComponents(scene.xrayedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var
|
|
19733
|
+
alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this78.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref12){var _ref13=_slicedToArray(_ref12,2),color=_ref13[0],components=_ref13[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);bcfViewpoint.components.translucency=this._createBCFComponents(scene.xrayedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i413=0,len=objectIds.length;_i413<len;_i413++){var objectId=objectIds[_i413];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
|
|
19677
19734
|
* Sets viewer state to the given BCF viewpoint.
|
|
19678
19735
|
*
|
|
19679
19736
|
* Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
|
|
@@ -19695,7 +19752,7 @@ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).
|
|
|
19695
19752
|
* @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
|
|
19696
19753
|
* @param {Boolean} [options.updateCompositeObjects=false] When ````true````, then when visibility and selection updates refer to composite objects (eg. an IfcBuildingStorey),
|
|
19697
19754
|
* then this method will apply the updates to objects within those composites.
|
|
19698
|
-
*/},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this79=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$4);var dir=xyzObjectToArray(e.direction,tempVec3$4);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var
|
|
19755
|
+
*/},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this79=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$4);var dir=xyzObjectToArray(e.direction,tempVec3$4);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var _i414=0;bcfViewpoint.lines.forEach(function(e){if(!e.start_point){return;}if(!e.end_point){return;}positions.push(e.start_point.x);positions.push(e.start_point.y);positions.push(e.start_point.z);positions.push(e.end_point.x);positions.push(e.end_point.y);positions.push(e.end_point.z);indices.push(_i414++);indices.push(_i414++);});new LineSet(scene,{positions:positions,indices:indices,clippable:false,collidable:true});}scene.clearBitmaps();if(bcfViewpoint.bitmaps&&bcfViewpoint.bitmaps.length>0){bcfViewpoint.bitmaps.forEach(function(e){var bitmap_type=e.bitmap_type||"jpg";// "jpg" | "png"
|
|
19699
19756
|
var bitmap_data=e.bitmap_data;// base64
|
|
19700
19757
|
var location=xyzObjectToArray(e.location,tempVec3a$6);var normal=xyzObjectToArray(e.normal,tempVec3b$5);var up=xyzObjectToArray(e.up,tempVec3c$3);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.spaces_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"),true);}if(view_setup_hints.space_boundaries_visible!==undefined);if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}if(view_setup_hints.space_boundaries_translucent!==undefined);if(view_setup_hints.openings_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.translucency){scene.setObjectsXRayed(scene.xrayedObjectIds,false);bcfViewpoint.components.translucency.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.xrayed=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/256;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/256,parseInt(color.substring(2,4),16)/256,parseInt(color.substring(4,6),16)/256];coloring.components.map(function(component){return _this79._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){entity.opacity=alpha;}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var up;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$4);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$4);up=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$4);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$4);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$4);up=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$4);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);up=ZToY(up);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
|
|
19701
19758
|
origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3$4);}else{look=math.addVec3(eye,look,tempVec3$4);}if(immediate){camera.eye=eye;camera.look=look;camera.up=up;camera.projection=projection;}else{viewer.cameraFlight.flyTo({eye:eye,look:look,up:up,duration:options.duration,projection:projection});}}}},{key:"_withBCFComponent",value:function _withBCFComponent(options,component,callback){var viewer=this.viewer;var scene=viewer.scene;if(component.authoring_tool_id&&component.originating_system===this.originatingSystem){var id=component.authoring_tool_id;var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var metaObject=viewer.metaScene.metaObjects[id];if(metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);return;}}}if(component.ifc_guid){var originalSystemId=component.ifc_guid;var _entity2=scene.objects[originalSystemId];if(_entity2){callback(_entity2);return;}if(options.updateCompositeObjects){var _metaObject=viewer.metaScene.metaObjects[originalSystemId];if(_metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId),callback);return;}}Object.keys(scene.models).forEach(function(modelId){var id=math.globalizeObjectId(modelId,originalSystemId);var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var _metaObject2=viewer.metaScene.metaObjects[id];if(_metaObject2){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);}}});}}},{key:"getUUID",value:function getUUID(){return math.createUUID();}/**
|
|
@@ -20357,14 +20414,14 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
20357
20414
|
* Shows all or hides the angle label of each {@link DistanceMeasurement}.
|
|
20358
20415
|
*
|
|
20359
20416
|
* @param {Boolean} labelsShown Whether or not to show the labels.
|
|
20360
|
-
*/},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var
|
|
20417
|
+
*/},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i415=0,_Object$entries2=Object.entries(this.measurements);_i415<_Object$entries2.length;_i415++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i415],2),key=_Object$entries2$_i[0],measurement=_Object$entries2$_i[1];measurement.labelShown=labelsShown;}}/**
|
|
20361
20418
|
* 控制所有测量对象显示隐藏
|
|
20362
20419
|
* @param {*} visible
|
|
20363
20420
|
*/},{key:"setMeasurementsShown",value:function setMeasurementsShown(visible){for(var key in this.measurements){this.measurements[key].visible=visible;}}/**
|
|
20364
20421
|
* Shows all or hides the axis wires of each {@link DistanceMeasurement}.
|
|
20365
20422
|
*
|
|
20366
20423
|
* @param {Boolean} labelsShown Whether or not to show the axis wires.
|
|
20367
|
-
*/},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var
|
|
20424
|
+
*/},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var _i416=0,_Object$entries3=Object.entries(this.measurements);_i416<_Object$entries3.length;_i416++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i416],2),key=_Object$entries3$_i[0],measurement=_Object$entries3$_i[1];measurement.axisVisible=axisVisible;}this.defaultAxisVisible=axisVisible;}/**
|
|
20368
20425
|
* Gets if the axis wires of each {@link DistanceMeasurement} are visible.
|
|
20369
20426
|
*
|
|
20370
20427
|
* @returns {Boolean} Whether or not the axis wires are visible.
|
|
@@ -20834,7 +20891,7 @@ subs[subId]={callback:callback};this._eventSubEvents[subId]=event;var value=this
|
|
|
20834
20891
|
*
|
|
20835
20892
|
* @param {String} subId Subscription ID
|
|
20836
20893
|
*/},{key:"off",value:function off(subId){if(subId===undefined||subId===null){return;}if(!this._eventSubEvents){return;}var event=this._eventSubEvents[subId];if(event){delete this._eventSubEvents[subId];var subs=this._eventSubs[event];if(subs){delete subs[subId];}this._eventSubIDMap.removeItem(subId);// Release subId
|
|
20837
|
-
}}}]);}();function resolvePath$1(key,json){if(json[key]){return json[key];}var parts=key.split(".");var obj=json;for(var
|
|
20894
|
+
}}}]);}();function resolvePath$1(key,json){if(json[key]){return json[key];}var parts=key.split(".");var obj=json;for(var _i417=0,len=parts.length;obj&&_i417<len;_i417++){var part=parts[_i417];obj=obj[part];}return obj;}function vsprintf(msg){var args=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return msg.replace(/\{\{|\}\}|\{(\d+)\}/g,function(m,n){if(m==="{{"){return"{";}if(m==="}}"){return"}";}return args[n];});}/**
|
|
20838
20895
|
* @desc Abstract base class for curve classes.
|
|
20839
20896
|
*/var Curve=/*#__PURE__*/function(_Component29){/**
|
|
20840
20897
|
* @constructor
|
|
@@ -20979,7 +21036,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
|
|
|
20979
21036
|
* Adds multiple frames to this CameraPath, each frame specified as a set of values for eye, look and up vectors at a given time instant.
|
|
20980
21037
|
*
|
|
20981
21038
|
* @param {{t:Number, eye:Object, look:Object, up: Object}[]} frames Frames to add to this CameraPath.
|
|
20982
|
-
*/},{key:"addFrames",value:function addFrames(frames){var frame;for(var
|
|
21039
|
+
*/},{key:"addFrames",value:function addFrames(frames){var frame;for(var _i418=0,len=frames.length;_i418<len;_i418++){frame=frames[_i418];this.addFrame(frame.t||0,frame.eye,frame.look,frame.up);}}/**
|
|
20983
21040
|
* Sets the position of the {@link Camera} to a position interpolated within this CameraPath at the given time instant.
|
|
20984
21041
|
*
|
|
20985
21042
|
* @param {Number} t Time instant.
|
|
@@ -20995,7 +21052,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
|
|
|
20995
21052
|
* when animated by {@link CameraPathAnimation}, the {@link Camera} will move along the path at a constant rate.
|
|
20996
21053
|
*
|
|
20997
21054
|
* @param {Number} duration The total duration for this CameraPath.
|
|
20998
|
-
*/},{key:"smoothFrameTimes",value:function smoothFrameTimes(duration){var numFrames=this._frames.length;if(numFrames===0){return;}var vec=math.vec3();var totalLen=0;this._frames[0].t=0;var lens=[];for(var
|
|
21055
|
+
*/},{key:"smoothFrameTimes",value:function smoothFrameTimes(duration){var numFrames=this._frames.length;if(numFrames===0){return;}var vec=math.vec3();var totalLen=0;this._frames[0].t=0;var lens=[];for(var _i419=1,len=this._frames.length;_i419<len;_i419++){var lenVec=math.lenVec3(math.subVec3(this._frames[_i419].eye,this._frames[_i419-1].eye,vec));lens[_i419]=lenVec;totalLen+=lenVec;}for(var _i420=1,_len61=this._frames.length;_i420<_len61;_i420++){var interFrameRate=lens[_i420]/totalLen*duration;this._frames[_i420].t=this._frames[_i420-1].t+interFrameRate;}}/**
|
|
20999
21056
|
* Removes all frames from this CameraPath.
|
|
21000
21057
|
*/},{key:"clearFrames",value:function clearFrames(){this._frames=[];this._eyeCurve.points=[];this._lookCurve.points=[];this._upCurve.points=[];}}]);}(Component);var tempVec3$3=math.vec3();var newLook=math.vec3();var newEye=math.vec3();var newUp=math.vec3();var newLookEyeVec=math.vec3();/**
|
|
21001
21058
|
* @desc Jumps or flies the {@link Scene}'s {@link Camera} to a given target.
|
|
@@ -21819,7 +21876,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
|
|
|
21819
21876
|
* @returns {Boolean} ````true```` if this PointLight casts shadows.
|
|
21820
21877
|
*/function get(){return this._state.castsShadow;}/**
|
|
21821
21878
|
* Destroys this PointLight.
|
|
21822
|
-
*/,set:function set(castsShadow){castsShadow=!!castsShadow;if(this._state.castsShadow===castsShadow){return;}this._state.castsShadow=castsShadow;this._shadowViewMatrixDirty=true;this.glRedraw();}},{key:"destroy",value:function destroy(){var camera=this.scene.camera;var canvas=this.scene.canvas;camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);canvas.off(this._onCanvasBoundary);_superPropGet(PointLight,"destroy",this,3)([]);this._state.destroy();if(this._shadowRenderBuf){this._shadowRenderBuf.destroy();}this.scene._lightDestroyed(this);this.glRedraw();}}]);}(Light);function ensureImageSizePowerOfTwo(image){if(!isPowerOfTwo(image.width)||!isPowerOfTwo(image.height)){var _canvas5=document.createElement("canvas");_canvas5.width=nextHighestPowerOfTwo(image.width);_canvas5.height=nextHighestPowerOfTwo(image.height);var ctx=_canvas5.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas5.width,_canvas5.height);image=_canvas5;}return image;}function isPowerOfTwo(x){return(x&x-1)===0;}function nextHighestPowerOfTwo(x){--x;for(var
|
|
21879
|
+
*/,set:function set(castsShadow){castsShadow=!!castsShadow;if(this._state.castsShadow===castsShadow){return;}this._state.castsShadow=castsShadow;this._shadowViewMatrixDirty=true;this.glRedraw();}},{key:"destroy",value:function destroy(){var camera=this.scene.camera;var canvas=this.scene.canvas;camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);canvas.off(this._onCanvasBoundary);_superPropGet(PointLight,"destroy",this,3)([]);this._state.destroy();if(this._shadowRenderBuf){this._shadowRenderBuf.destroy();}this.scene._lightDestroyed(this);this.glRedraw();}}]);}(Light);function ensureImageSizePowerOfTwo(image){if(!isPowerOfTwo(image.width)||!isPowerOfTwo(image.height)){var _canvas5=document.createElement("canvas");_canvas5.width=nextHighestPowerOfTwo(image.width);_canvas5.height=nextHighestPowerOfTwo(image.height);var ctx=_canvas5.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas5.width,_canvas5.height);image=_canvas5;}return image;}function isPowerOfTwo(x){return(x&x-1)===0;}function nextHighestPowerOfTwo(x){--x;for(var _i421=1;_i421<32;_i421<<=1){x=x|x>>_i421;}return x+1;}/**
|
|
21823
21880
|
* @desc A cube texture map.
|
|
21824
21881
|
*/var CubeTexture=/*#__PURE__*/function(_Component34){/**
|
|
21825
21882
|
* @constructor
|
|
@@ -21836,7 +21893,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
|
|
|
21836
21893
|
// this._state.texture.setImage(this._images, this._state);
|
|
21837
21894
|
// this._state.texture.setProps(this._state);
|
|
21838
21895
|
// } else
|
|
21839
|
-
if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadSrc(src){var self=this;var gl=this.scene.canvas.gl;this._images=[];var loadFailed=false;var numLoaded=0;var _loop2=function _loop2(
|
|
21896
|
+
if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadSrc(src){var self=this;var gl=this.scene.canvas.gl;this._images=[];var loadFailed=false;var numLoaded=0;var _loop2=function _loop2(_i422){var image=new Image();image.onload=function(){var _image=image;var index=_i422;return function(){if(loadFailed){return;}_image=ensureImageSizePowerOfTwo(_image);self._images[index]=_image;numLoaded++;if(numLoaded===6){var texture=self._state.texture;if(!texture){texture=new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP});self._state.texture=texture;}texture.setImage(self._images,self._state);self.fire("loaded",self._src,false);self.glRedraw();}};}();image.onerror=function(){loadFailed=true;};image.src=src[_i422];};for(var _i422=0;_i422<src.length;_i422++){_loop2(_i422);}}/**
|
|
21840
21897
|
* Destroys this CubeTexture
|
|
21841
21898
|
*
|
|
21842
21899
|
*/},{key:"destroy",value:function destroy(){_superPropGet(CubeTexture,"destroy",this,3)([]);if(this._state.texture){this._state.texture.destroy();}stats.memory.textures--;this._state.destroy();}}]);}(Component);/**
|
|
@@ -22255,14 +22312,14 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
|
|
|
22255
22312
|
* @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.
|
|
22256
22313
|
* @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.
|
|
22257
22314
|
* @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.
|
|
22258
|
-
*/return _createClass(ModelMemento,[{key:"saveObjects",value:function saveObjects(scene,metaModel,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var
|
|
22315
|
+
*/return _createClass(ModelMemento,[{key:"saveObjects",value:function saveObjects(scene,metaModel,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i423=0,len=metaObjects.length;_i423<len;_i423++){var metaObject=metaObjects[_i423];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){this.objectsVisible[_i423]=object.visible;}if(edges){this.objectsEdges[_i423]=object.edges;}if(xrayed){this.objectsXrayed[_i423]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i423]=object.highlighted;}if(selected){this.objectsSelected[_i423]=object.selected;}if(clippable){this.objectsClippable[_i423]=object.clippable;}if(pickable){this.objectsPickable[_i423]=object.pickable;}if(colorize){var objectColor=object.colorize;this.objectsColorize[_i423*3+0]=objectColor[0];this.objectsColorize[_i423*3+1]=objectColor[1];this.objectsColorize[_i423*3+2]=objectColor[2];}if(opacity){this.objectsOpacity[_i423]=object.opacity;}this.numObjects++;}}/**
|
|
22259
22316
|
* Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ModelMemento#saveObjects}.
|
|
22260
22317
|
*
|
|
22261
22318
|
* Assumes that the model has not been destroyed or modified since saving.
|
|
22262
22319
|
*
|
|
22263
22320
|
* @param {Scene} scene The scene that was given to {@link ModelMemento#saveObjects}.
|
|
22264
22321
|
* @param {MetaModel} metaModel The metamodel that was given to {@link ModelMemento#saveObjects}.
|
|
22265
|
-
*/},{key:"restoreObjects",value:function restoreObjects(scene,metaModel){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var
|
|
22322
|
+
*/},{key:"restoreObjects",value:function restoreObjects(scene,metaModel){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i424=0,len=metaObjects.length;_i424<len;_i424++){var metaObject=metaObjects[_i424];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){object.visible=this.objectsVisible[_i424];}if(edges){object.edges=this.objectsEdges[_i424];}if(xrayed){object.xrayed=this.objectsXrayed[_i424];}if(highlighted){object.highlighted=this.objectsHighlighted[_i424];}if(selected){object.selected=this.objectsSelected[_i424];}if(clippable){object.clippable=this.objectsClippable[_i424];}if(pickable){object.pickable=this.objectsPickable[_i424];}if(colorize){color$3[0]=this.objectsColorize[_i424*3+0];color$3[1]=this.objectsColorize[_i424*3+1];color$3[2]=this.objectsColorize[_i424*3+2];object.colorize=color$3;}if(opacity){object.opacity=this.objectsOpacity[_i424];}}}}]);}();var color$2=math.vec3();/**
|
|
22266
22323
|
* @desc Saves and restores a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}.
|
|
22267
22324
|
*
|
|
22268
22325
|
* * An Entity represents an object when {@link Entity#isObject} is ````true````.
|
|
@@ -22348,7 +22405,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
|
|
|
22348
22405
|
* @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.
|
|
22349
22406
|
* @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.
|
|
22350
22407
|
* @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.
|
|
22351
|
-
*/return _createClass(ObjectsMemento,[{key:"saveObjects",value:function saveObjects(scene,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var objects=scene.objects;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;for(var objectId in objects){if(objects.hasOwnProperty(objectId)){var object=objects[objectId];var
|
|
22408
|
+
*/return _createClass(ObjectsMemento,[{key:"saveObjects",value:function saveObjects(scene,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var objects=scene.objects;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;for(var objectId in objects){if(objects.hasOwnProperty(objectId)){var object=objects[objectId];var _i425=this.numObjects;if(visible){this.objectsVisible[_i425]=object.visible;}if(edges){this.objectsEdges[_i425]=object.edges;}if(xrayed){this.objectsXrayed[_i425]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i425]=object.highlighted;}if(selected){this.objectsSelected[_i425]=object.selected;}if(clippable){this.objectsClippable[_i425]=object.clippable;}if(pickable){this.objectsPickable[_i425]=object.pickable;}if(colorize){var objectColor=object.colorize;if(objectColor){this.objectsColorize[_i425*3+0]=objectColor[0];this.objectsColorize[_i425*3+1]=objectColor[1];this.objectsColorize[_i425*3+2]=objectColor[2];this.objectsHasColorize[_i425]=true;}else{this.objectsHasColorize[_i425]=false;}}if(opacity){this.objectsOpacity[_i425]=object.opacity;}this.numObjects++;}}}/**
|
|
22352
22409
|
* Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ObjectsMemento#saveObjects}.
|
|
22353
22410
|
* @param {Scene} scene The scene.
|
|
22354
22411
|
*/},{key:"restoreObjects",value:function restoreObjects(scene){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var i=0;var objects=scene.objects;for(var objectId in objects){if(objects.hasOwnProperty(objectId)){var object=objects[objectId];if(visible){object.visible=this.objectsVisible[i];}if(edges){object.edges=this.objectsEdges[i];}if(xrayed){object.xrayed=this.objectsXrayed[i];}if(highlighted){object.highlighted=this.objectsHighlighted[i];}if(selected){object.selected=this.objectsSelected[i];}if(clippable){object.clippable=this.objectsClippable[i];}if(pickable){object.pickable=this.objectsPickable[i];}if(colorize){if(this.objectsHasColorize[i]){color$2[0]=this.objectsColorize[i*3+0];color$2[1]=this.objectsColorize[i*3+1];color$2[2]=this.objectsColorize[i*3+2];object.colorize=color$2;}else{object.colorize=null;}}if(opacity){object.opacity=this.objectsOpacity[i];}i++;}}}}]);}();/**
|
|
@@ -22878,7 +22935,7 @@ if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEn
|
|
|
22878
22935
|
* @private
|
|
22879
22936
|
*/var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this110=this;_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;this._cameraControl=cameraControl;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();this._dollyspeed=1;this._panspeed=1;var lastCanvasTouchPosList=[];this.canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});this._resetGesture=function(){numTouches=0;waitForTick=false;lastCanvasTouchPosList.length=0;if(pivotController.getPivoting())pivotController.endPivot();pivotController.hidePivot();};this.canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}if(!event.isTrusted)return;event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){states.touchStartTime;getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();pivotController.setPivotPos(scene.camera.look);if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){// pivotController.setPivotPos(pickController.pickResult.worldPos);
|
|
22880
22937
|
pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
|
|
22881
|
-
}else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var
|
|
22938
|
+
}else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i426=0,len=touches.length;_i426<len;++_i426){getCanvasPosFromEvent$1(touches[_i426],lastCanvasTouchPosList[_i426]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}_this110._cameraControl.fire("touchmoveCanvas");event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
|
|
22882
22939
|
return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
|
|
22883
22940
|
var canvasBoundary=scene.canvas.boundary;var canvasWidth=canvasBoundary[2];var canvasHeight=canvasBoundary[3];var touches=event.touches;if(event.touches.length!==numTouches){// Two fingers were pressed, then one of them is removed
|
|
22884
22941
|
// We don't want to rotate in this case (weird behavior)
|
|
@@ -22903,7 +22960,7 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
|
|
|
22903
22960
|
// }
|
|
22904
22961
|
}}else if(numTouches===2){pivotController.hidePivot();var touch0=touches[0];var touch1=touches[1];getCanvasPosFromEvent$1(touch0,tapCanvasPos0);getCanvasPosFromEvent$1(touch1,tapCanvasPos1);var lastMiddleTouch=math.geometricMeanVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var currentMiddleTouch=math.geometricMeanVec2(tapCanvasPos0,tapCanvasPos1);var touchDelta=math.vec2();math.subVec2(lastMiddleTouch,currentMiddleTouch,touchDelta);var _xPanDelta=touchDelta[0];var _yPanDelta=touchDelta[1];var _camera2=scene.camera;// Dollying
|
|
22905
22962
|
var d1=math.distVec2([touch0.pageX,touch0.pageY],[touch1.pageX,touch1.pageY]);var d2=math.distVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var dollyDelta=(d2-d1)*configs.touchDollyRate*_this110._dollyspeed;updates.dollyDelta=dollyDelta;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
|
|
22906
|
-
if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this110._panspeed;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this110._panspeed;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;}}states.pointerCanvasPos=currentMiddleTouch;}for(var
|
|
22963
|
+
if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this110._panspeed;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this110._panspeed;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i427=0;_i427<numTouches;++_i427){getCanvasPosFromEvent$1(touches[_i427],lastCanvasTouchPosList[_i427]);}});}return _createClass(TouchPanRotateAndDollyHandler,[{key:"dollyspeed",get:function get(){return this._dollyspeed;},set:function set(speed){if(speed<=0)return;this._dollyspeed=+speed.toFixed(1);this._cameraControl.fire("touchDollySpeed",this._dollyspeed);}},{key:"panspeed",get:function get(){return this._panspeed;},set:function set(speed){if(speed<=0)return;this._panspeed=+speed.toFixed(1);this._cameraControl.fire("touchPanSpeed",this._panspeed);}},{key:"reset",value:function reset(){this._resetGesture();}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);}this._scene.off(this._onTick);}}]);}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=1000;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
|
|
22907
22964
|
* @private
|
|
22908
22965
|
*/var TouchPickHandler=/*#__PURE__*/function(){function TouchPickHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPickHandler);this._scene=scene;var pickController=controllers.pickController;var cameraControl=controllers.cameraControl;var touchStartTime;var activeTouches=[];var tapStartPos=new Float32Array(2);var tapStartTime=-1;var lastTapTime=-1;this.canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
|
|
22909
22966
|
var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.cameraFlight.flyTo({aabb:aabb});// TODO: Option to back off to fit AABB in view
|
|
@@ -22912,7 +22969,7 @@ controllers.cameraFlight.flyTo({aabb:aabb});}};this.canvas.addEventListener("tou
|
|
|
22912
22969
|
var rightClickClientX=tapStartPos[0];var rightClickClientY=tapStartPos[1];var rightClickPageX=touches[0].pageX;var rightClickPageY=touches[0].pageY;states.longTouchTimeout=setTimeout(function(){controllers.cameraControl.fire("rightClick",{// For context menus
|
|
22913
22970
|
pagePos:[Math.round(rightClickPageX),Math.round(rightClickPageY)],canvasPos:[Math.round(rightClickClientX),Math.round(rightClickClientY)],event:e},true);states.longTouchTimeout=null;},configs.longTapTimeout);//////////
|
|
22914
22971
|
var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");getCanvasPosFromEvent(touches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("touchEntity",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("touchSurface",pickController.pickResult);}}else{cameraControl.fire("touchNothing");}}else{tapStartTime=-1;}///////////
|
|
22915
|
-
while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var
|
|
22972
|
+
while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var _i428=0,len=touches.length;_i428<len;++_i428){getCanvasPosFromEvent(touches[_i428],activeTouches[_i428]);}activeTouches.length=touches.length;},{passive:true});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var currentTime=Date.now();var touches=e.touches;var changedTouches=e.changedTouches;var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");if(states.longTouchTimeout!==null){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}// process tap
|
|
22916
22973
|
if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&¤tTime-tapStartTime<TAP_INTERVAL){// Double-tap
|
|
22917
22974
|
if(lastTapTime>-1&&tapStartTime-lastTapTime<DBL_TAP_INTERVAL){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;// cameraControl.fire("doublePicked", pickController.pickResult);
|
|
22918
22975
|
cameraControl.fire("touchDoublePicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("doublePickedSurface", pickController.pickResult);
|
|
@@ -22920,7 +22977,7 @@ cameraControl.fire("touchDoublePickedSurface",pickController.pickResult);}if(con
|
|
|
22920
22977
|
else if(math.distVec2(activeTouches[0],tapStartPos)<TAP_DISTANCE_THRESHOLD){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;// cameraControl.fire("picked", pickController.pickResult);
|
|
22921
22978
|
cameraControl.fire("touchPicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("pickedSurface", pickController.pickResult);
|
|
22922
22979
|
cameraControl.fire("touchPickedSurface",pickController.pickResult);}}else{// cameraControl.fire("pickedNothing");
|
|
22923
|
-
cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var
|
|
22980
|
+
cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var _i429=0,len=touches.length;_i429<len;++_i429){activeTouches[_i429][0]=touches[_i429].pageX;activeTouches[_i429][1]=touches[_i429].pageY;}e.stopPropagation();},{passive:true});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);}return _createClass(TouchPickHandler,[{key:"reset",value:function reset(){// TODO
|
|
22924
22981
|
// tapStartTime = -1;
|
|
22925
22982
|
// lastTapTime = -1;
|
|
22926
22983
|
}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);}}}]);}();var DEFAULT_SNAP_PICK_RADIUS=20;var DEFAULT_SNAP_VERTEX=true;var DEFAULT_SNAP_EDGE=true;/**
|
|
@@ -23522,7 +23579,7 @@ case"qwerty":keyMap[this.PAN_UP]=[input.KEY_E];keyMap[this.PAN_DOWN]=[input.KEY_
|
|
|
23522
23579
|
// keyMap[this.ROTATE_Y_NEG] = [input.KEY_RIGHT_ARROW];
|
|
23523
23580
|
// keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
|
|
23524
23581
|
// keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
|
|
23525
|
-
keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[input.KEY_J];keyMap[this.PAN_FORWARDS]=[input.KEY_K];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var
|
|
23582
|
+
keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[input.KEY_J];keyMap[this.PAN_FORWARDS]=[input.KEY_K];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i430=0,len=keys.length;_i430<len;_i430++){var key=keys[_i430];if(keyDownMap[key]){return true;}}return false;}/**
|
|
23526
23583
|
* Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
|
|
23527
23584
|
*
|
|
23528
23585
|
* See class comments for an example.
|
|
@@ -23619,7 +23676,7 @@ keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[inpu
|
|
|
23619
23676
|
* See class comments for more info.
|
|
23620
23677
|
*
|
|
23621
23678
|
* @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
|
|
23622
|
-
*/,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var
|
|
23679
|
+
*/,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var _i431=0,len=this._handlers.length;_i431<len;_i431++){var handler=this._handlers[_i431];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.panDeltaZ=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dollyDelta=0;}},{key:"followPointer",get:/**
|
|
23623
23680
|
* Sets whether the {@link Camera} follows the mouse/touch pointer.
|
|
23624
23681
|
*
|
|
23625
23682
|
* In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
|
|
@@ -24024,7 +24081,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
|
|
|
24024
24081
|
*/function get(){return this._configs.zoomOnMouseWheel;}/**
|
|
24025
24082
|
* Destroys this ````CameraControl````.
|
|
24026
24083
|
* @private
|
|
24027
|
-
*/,set:function set(enabled){this._configs.zoomOnMouseWheel=!!enabled;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_superPropGet(CameraControl,"destroy",this,3)([]);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var
|
|
24084
|
+
*/,set:function set(enabled){this._configs.zoomOnMouseWheel=!!enabled;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_superPropGet(CameraControl,"destroy",this,3)([]);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i432=0,len=this._handlers.length;_i432<len;_i432++){var handler=this._handlers[_i432];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i433=0,len=this._controllers.length;_i433<len;_i433++){var controller=this._controllers[_i433];if(controller.destroy){controller.destroy();}}}}]);}(Component);/**
|
|
24028
24085
|
* @desc A set of properties associated with one or more {@link MetaObject}s.
|
|
24029
24086
|
*
|
|
24030
24087
|
* A PropertySet is created within {@link MetaScene#createMetaModel} and belongs to a {@link MetaModel}.
|
|
@@ -24167,7 +24224,7 @@ if(params.external!==undefined&¶ms.external!==null){/**
|
|
|
24167
24224
|
*
|
|
24168
24225
|
* 不做归一化时,数组会被 for...in 按索引注册成 "0".."N" 的伪对象,
|
|
24169
24226
|
* 既污染 metaScene,也会生成下标键的伪根节点。
|
|
24170
|
-
*/function normalizeMetaModelData(metaModelData){if(!metaModelData||_typeof2(metaModelData)!=="object"){return metaModelData;}var hasArrayMetaObjects=Array.isArray(metaModelData.metaObjects);var hasArrayPropertySets=Array.isArray(metaModelData.propertySets);if(!hasArrayMetaObjects&&!hasArrayPropertySets){return metaModelData;}var normalized=_objectSpread({},metaModelData);if(hasArrayMetaObjects){var metaObjects={};for(var
|
|
24227
|
+
*/function normalizeMetaModelData(metaModelData){if(!metaModelData||_typeof2(metaModelData)!=="object"){return metaModelData;}var hasArrayMetaObjects=Array.isArray(metaModelData.metaObjects);var hasArrayPropertySets=Array.isArray(metaModelData.propertySets);if(!hasArrayMetaObjects&&!hasArrayPropertySets){return metaModelData;}var normalized=_objectSpread({},metaModelData);if(hasArrayMetaObjects){var metaObjects={};for(var _i434=0,len=metaModelData.metaObjects.length;_i434<len;_i434++){var objectData=metaModelData.metaObjects[_i434];if(!objectData){continue;}var id=objectData.id!==undefined&&objectData.id!==null?String(objectData.id):String(_i434);metaObjects[id]=objectData;}normalized.metaObjects=metaObjects;}if(hasArrayPropertySets){var propertySets={};for(var _i435=0,_len62=metaModelData.propertySets.length;_i435<_len62;_i435++){var propertySetData=metaModelData.propertySets[_i435];if(!propertySetData){continue;}var _id4=propertySetData.id!==undefined&&propertySetData.id!==null?String(propertySetData.id):String(_i435);propertySets[_id4]=propertySetData;}normalized.propertySets=propertySets;}return normalized;}/**
|
|
24171
24228
|
* @desc Metadata corresponding to an {@link Entity} that represents a model.
|
|
24172
24229
|
*
|
|
24173
24230
|
* An {@link Entity} represents a model when {@link Entity#isModel} is ````true````
|
|
@@ -24288,7 +24345,7 @@ this.propertySets.push(propertySet);}}if(metaModelData.metaObjects){// for (let
|
|
|
24288
24345
|
for(var _metaId in metaModelData.metaObjects){var objectData=metaModelData.metaObjects[_metaId];var metaObject=new MetaObject({id:_metaId,originalSystemId:_metaId,parentId:objectData.parent,type:objectData.type,name:objectData.name,propertySetIds:objectData.propertySetIds,external:objectData.external});metaObject.children=[];metaObject.metaModels=[];metaObject.metaModels.push(this);// 幂等:同名 id 重复注入(如内嵌 lite 元数据 → XTS 全量数据)时,
|
|
24289
24346
|
// 先把旧对象的树引用/列表引用清理干净再覆盖,避免
|
|
24290
24347
|
// children、rootMetaObjects、metaObjects、metaObjectsByType 中残留重复引用。
|
|
24291
|
-
var existingMetaObject=metaScene.metaObjects[_metaId];if(existingMetaObject&&existingMetaObject.metaModels&&existingMetaObject.metaModels.indexOf(this)!==-1){if(existingMetaObject.parent&&existingMetaObject.parent.children){var existingChildIndex=existingMetaObject.parent.children.indexOf(existingMetaObject);if(existingChildIndex!==-1){existingMetaObject.parent.children.splice(existingChildIndex,1);}}var existingRootIndex=this.rootMetaObjects.indexOf(existingMetaObject);if(existingRootIndex!==-1){this.rootMetaObjects.splice(existingRootIndex,1);}var existingObjectIndex=this.metaObjects.indexOf(existingMetaObject);if(existingObjectIndex!==-1){this.metaObjects.splice(existingObjectIndex,1);}delete metaScene.rootMetaObjects[_metaId];if(metaScene.metaObjectsByType){var typeBucket=metaScene.metaObjectsByType[existingMetaObject.type];if(typeBucket){delete typeBucket[_metaId];}}}metaScene.metaObjects[_metaId]=metaObject;this.metaObjects.push(metaObject);if(!objectData.parent){this.rootMetaObjects.push(metaObject);metaScene.rootMetaObjects[_metaId]=metaObject;}}}if(typeof done==="function")done();}catch(error){if(typeof err==="function")err(error);else this.log(err);}}},{key:"_decompressProperties",value:function _decompressProperties(propertyLookup,properties){for(var
|
|
24348
|
+
var existingMetaObject=metaScene.metaObjects[_metaId];if(existingMetaObject&&existingMetaObject.metaModels&&existingMetaObject.metaModels.indexOf(this)!==-1){if(existingMetaObject.parent&&existingMetaObject.parent.children){var existingChildIndex=existingMetaObject.parent.children.indexOf(existingMetaObject);if(existingChildIndex!==-1){existingMetaObject.parent.children.splice(existingChildIndex,1);}}var existingRootIndex=this.rootMetaObjects.indexOf(existingMetaObject);if(existingRootIndex!==-1){this.rootMetaObjects.splice(existingRootIndex,1);}var existingObjectIndex=this.metaObjects.indexOf(existingMetaObject);if(existingObjectIndex!==-1){this.metaObjects.splice(existingObjectIndex,1);}delete metaScene.rootMetaObjects[_metaId];if(metaScene.metaObjectsByType){var typeBucket=metaScene.metaObjectsByType[existingMetaObject.type];if(typeBucket){delete typeBucket[_metaId];}}}metaScene.metaObjects[_metaId]=metaObject;this.metaObjects.push(metaObject);if(!objectData.parent){this.rootMetaObjects.push(metaObject);metaScene.rootMetaObjects[_metaId]=metaObject;}}}if(typeof done==="function")done();}catch(error){if(typeof err==="function")err(error);else this.log(err);}}},{key:"_decompressProperties",value:function _decompressProperties(propertyLookup,properties){for(var _i436=0,len=properties.length;_i436<len;_i436++){var property=properties[_i436];if(Number.isInteger(property)){var lookupProperty=propertyLookup[property];if(lookupProperty){properties[_i436]=lookupProperty;}}}}},{key:"finalize",value:function finalize(){if(this._finalized){throw"MetaScene already finalized - can't re-finalize";}// Re-link MetaScene's entire MetaObject parent/child hierarchy
|
|
24292
24349
|
var metaScene=this.metaScene;metaScene.metaObjectsByType={};// 第一段:统一清空 children、重连属性集、重建 type 索引
|
|
24293
24350
|
//
|
|
24294
24351
|
// 注意:清空 children 与"挂到父节点"必须分成两段执行。for...in 枚举 JS 对象时,
|
|
@@ -24296,7 +24353,7 @@ var metaScene=this.metaScene;metaScene.metaObjectsByType={};// 第一段:统
|
|
|
24296
24353
|
// 若在同一次循环里同时做这两件事,父节点会在其子节点之后被处理、
|
|
24297
24354
|
// 把自己的 children 又清空一遍,导致整棵树连接全部丢失(结构树只剩根节点)。
|
|
24298
24355
|
for(var objectId in metaScene.metaObjects){var metaObject=metaScene.metaObjects[objectId];if(metaObject.children){metaObject.children=[];}metaObject.parent=null;// Re-link each MetaObject's property sets
|
|
24299
|
-
if(metaObject.propertySets){metaObject.propertySets=[];}if(metaObject.propertySetIds){for(var
|
|
24356
|
+
if(metaObject.propertySets){metaObject.propertySets=[];}if(metaObject.propertySetIds){for(var _i437=0,len=metaObject.propertySetIds.length;_i437<len;_i437++){var propertySetId=metaObject.propertySetIds[_i437];var propertySet=metaScene.propertySets[propertySetId];if(propertySet){metaObject.propertySets.push(propertySet);}}}var type=metaObject.type;(metaScene.metaObjectsByType[type]||(metaScene.metaObjectsByType[type]={}))[objectId]=metaObject;}// 第二段:统一按 parentId 连边(必须在所有 children 清空完成之后执行,消除处理顺序依赖)
|
|
24300
24357
|
for(var _objectId in metaScene.metaObjects){var _metaObject3=metaScene.metaObjects[_objectId];if(_metaObject3.parentId){var parentMetaObject=metaScene.metaObjects[_metaObject3.parentId];if(parentMetaObject){_metaObject3.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject3);}}}// Relink MetaObjects to their MetaModels
|
|
24301
24358
|
// for (let objectId in metaScene.metaObjects) {
|
|
24302
24359
|
// const metaObject = metaScene.metaObjects[objectId];
|
|
@@ -24319,10 +24376,10 @@ for(var _objectId in metaScene.metaObjects){var _metaObject3=metaScene.metaObjec
|
|
|
24319
24376
|
this._finalized=true;this.metaScene.fire("metaModelCreated",this.id);}/**
|
|
24320
24377
|
* Gets this MetaModel as JSON.
|
|
24321
24378
|
* @returns {{schema: (String|string|*), createdAt: (String|string|*), metaObjects: *[], author: (String|string|*), id: (String|Number|string|number|*), creatingApplication: (String|string|*), projectId: (String|Number|string|number|*), propertySets: *[]}}
|
|
24322
|
-
*/},{key:"getJSON",value:function getJSON(){var json={id:this.id,projectId:this.projectId,author:this.author,createdAt:this.createdAt,schema:this.schema,creatingApplication:this.creatingApplication,metaObjects:[],propertySets:[]};for(var
|
|
24379
|
+
*/},{key:"getJSON",value:function getJSON(){var json={id:this.id,projectId:this.projectId,author:this.author,createdAt:this.createdAt,schema:this.schema,creatingApplication:this.creatingApplication,metaObjects:[],propertySets:[]};for(var _i438=0,len=this.metaObjects.length;_i438<len;_i438++){var metaObject=this.metaObjects[_i438];var metaObjectCfg={id:metaObject.id,originalSystemId:metaObject.originalSystemId,extId:metaObject.extId,type:metaObject.type,name:metaObject.name};if(metaObject.parent){metaObjectCfg.parent=metaObject.parent.id;}if(metaObject.attributes){metaObjectCfg.attributes=metaObject.attributes;}if(metaObject.propertySetIds){metaObjectCfg.propertySetIds=metaObject.propertySetIds;}json.metaObjects.push(metaObjectCfg);}for(var _i439=0,_len63=this.propertySets.length;_i439<_len63;_i439++){var propertySet=this.propertySets[_i439];var propertySetCfg={id:propertySet.id,originalSystemId:propertySet.originalSystemId,extId:propertySet.extId,type:propertySet.type,name:propertySet.name,propertyies:[]};for(var j=0,lenj=propertySet.properties.length;j<lenj;j++){var property=propertySet.properties[j];var propertyCfg={id:property.id,description:property.description,type:property.type,name:property.name,value:property.value,valueType:property.valueType};propertySetCfg.properties.push(propertyCfg);}json.propertySets.push(propertySetCfg);}return json;}},{key:"_globalizeIDs",value:function _globalizeIDs(metaModelData,options){var globalize=!!options.globalizeObjectIds;if(metaModelData.metaObjects){for(var _i440=0,len=metaModelData.metaObjects.length;_i440<len;_i440++){var metaObjectData=metaModelData.metaObjects[_i440];// Globalize MetaObject IDs and parent IDs
|
|
24323
24380
|
metaObjectData.originalSystemId=metaObjectData.id;if(metaObjectData.parent){metaObjectData.originalParentSystemId=metaObjectData.parent;}if(globalize){metaObjectData.id=math.globalizeObjectId(this.id,metaObjectData.id);if(metaObjectData.parent){metaObjectData.parent=math.globalizeObjectId(this.id,metaObjectData.parent);}}// Globalize MetaObject property set IDs
|
|
24324
24381
|
if(globalize){var propertySetIds=metaObjectData.propertySetIds;if(propertySetIds){var propertySetGlobalIds=[];for(var j=0,lenj=propertySetIds.length;j<lenj;j++){propertySetGlobalIds.push(math.globalizeObjectId(this.id,propertySetIds[j]));}metaObjectData.propertySetIds=propertySetGlobalIds;metaObjectData.originalSystemPropertySetIds=propertySetIds;}}else{metaObjectData.originalSystemPropertySetIds=metaObjectData.propertySetIds;}}}// Globalize global PropertySet IDs
|
|
24325
|
-
if(metaModelData.propertySets){for(var
|
|
24382
|
+
if(metaModelData.propertySets){for(var _i441=0,_len64=metaModelData.propertySets.length;_i441<_len64;_i441++){var propertySet=metaModelData.propertySets[_i441];propertySet.originalSystemId=propertySet.id;if(globalize){propertySet.id=math.globalizeObjectId(this.id,propertySet.id);}}}}}]);}();/**
|
|
24326
24383
|
* @desc Metadata corresponding to a {@link Scene}.
|
|
24327
24384
|
*
|
|
24328
24385
|
* * Located in {@link Viewer#metaScene}.
|
|
@@ -24371,7 +24428,7 @@ if(metaModelData.propertySets){for(var _i440=0,_len64=metaModelData.propertySets
|
|
|
24371
24428
|
*
|
|
24372
24429
|
* @param {String} event Event name
|
|
24373
24430
|
* @param {Object} value Event parameters
|
|
24374
|
-
*/},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var
|
|
24431
|
+
*/},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i442=0,len=subs.length;_i442<len;_i442++){subs[_i442](value);}}}/**
|
|
24375
24432
|
* Unsubscribes from an event fired at this Viewer.
|
|
24376
24433
|
* @param event
|
|
24377
24434
|
*/},{key:"off",value:function off(event){// TODO
|
|
@@ -24402,12 +24459,12 @@ metaScene:this,id:modelId,projectId:metaModelData.projectId||"none",revisionId:m
|
|
|
24402
24459
|
*
|
|
24403
24460
|
* @param {String} metaModelId ID of the target {@link MetaModel}.
|
|
24404
24461
|
*/},{key:"destroyMetaModel",value:function destroyMetaModel(metaModelId){var metaModel=this.metaModels[metaModelId];if(!metaModel){return;}// Remove global PropertySets
|
|
24405
|
-
if(metaModel.propertySets){for(var
|
|
24462
|
+
if(metaModel.propertySets){for(var _i443=0,len=metaModel.propertySets.length;_i443<len;_i443++){var propertySet=metaModel.propertySets[_i443];if(propertySet.metaModels.length===1&&propertySet.metaModels[0].id===metaModelId){// Property set owned only by this model, delete
|
|
24406
24463
|
delete this.propertySets[propertySet.id];}else{var newMetaModels=[];for(var j=0,lenj=propertySet.metaModels.length;j<lenj;j++){if(propertySet.metaModels[j].id!==metaModelId){newMetaModels.push(propertySet.metaModels[j]);}}propertySet.metaModels=newMetaModels;}}}// Remove MetaObjects
|
|
24407
|
-
if(metaModel.metaObjects){for(var
|
|
24464
|
+
if(metaModel.metaObjects){for(var _i444=0,_len65=metaModel.metaObjects.length;_i444<_len65;_i444++){var metaObject=metaModel.metaObjects[_i444];metaObject.type;var id=metaObject.id;if(metaObject.metaModels.length===1&&metaObject.metaModels[0].id===metaModelId){// MetaObject owned only by this model, delete
|
|
24408
24465
|
delete this.metaObjects[id];if(!metaObject.parent){delete this.rootMetaObjects[id];}}}}// Re-link entire MetaObject parent/child hierarchy
|
|
24409
24466
|
for(var objectId in this.metaObjects){var _metaObject4=this.metaObjects[objectId];if(_metaObject4.children){_metaObject4.children=[];}// Re-link each MetaObject's property sets
|
|
24410
|
-
if(_metaObject4.propertySets){_metaObject4.propertySets=[];}if(_metaObject4.propertySetIds){for(var
|
|
24467
|
+
if(_metaObject4.propertySets){_metaObject4.propertySets=[];}if(_metaObject4.propertySetIds){for(var _i445=0,_len66=_metaObject4.propertySetIds.length;_i445<_len66;_i445++){var propertySetId=_metaObject4.propertySetIds[_i445];var _propertySet=this.propertySets[propertySetId];_metaObject4.propertySets.push(_propertySet);}}}this.metaObjectsByType={};for(var _objectId2 in this.metaObjects){var _metaObject5=this.metaObjects[_objectId2];var type=_metaObject5.type;if(_metaObject5.children){_metaObject5.children=null;}(this.metaObjectsByType[type]||(this.metaObjectsByType[type]={}))[_objectId2]=_metaObject5;}for(var _objectId3 in this.metaObjects){var _metaObject6=this.metaObjects[_objectId3];if(_metaObject6.parentId){var parentMetaObject=this.metaObjects[_metaObject6.parentId];if(parentMetaObject){_metaObject6.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject6);}}}delete this.metaModels[metaModelId];// Relink MetaObjects to their MetaModels
|
|
24411
24468
|
// for (let objectId in this.metaObjects) {
|
|
24412
24469
|
// const metaObject = this.metaObjects[objectId];
|
|
24413
24470
|
// metaObject.metaModels = [];
|
|
@@ -24429,7 +24486,7 @@ this.fire("metaModelDestroyed",metaModelId);}/**
|
|
|
24429
24486
|
*
|
|
24430
24487
|
* @param {String[]} types The array of type name.
|
|
24431
24488
|
* @returns {String[]} Array of {@link MetaObject#id}s.
|
|
24432
|
-
*/},{key:"getObjectIDsByTypes",value:function getObjectIDsByTypes(types){var metaObjects=[];for(var
|
|
24489
|
+
*/},{key:"getObjectIDsByTypes",value:function getObjectIDsByTypes(types){var metaObjects=[];for(var _i446=0;_i446<types.length;_i446++){var type=types[_i446];metaObjects=metaObjects.concat(this.getObjectIDsByType(type));}return metaObjects;}/**
|
|
24433
24490
|
* Gets the {@link MetaObject#id}s of the {@link MetaObject}s within the given subtree.
|
|
24434
24491
|
*
|
|
24435
24492
|
* @param {String} id ID of the root {@link MetaObject} of the given subtree.
|
|
@@ -24815,6 +24872,10 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
|
|
|
24815
24872
|
* @param {Boolean} [cfg.logarithmicDepthBufferEnabled=false] Whether to enable logarithmic depth buffer. When this is true,
|
|
24816
24873
|
* you can set huge values for {@link Perspective#far} and {@link Ortho#far}, to push the far clipping plane back so
|
|
24817
24874
|
* that it does not clip huge models.
|
|
24875
|
+
* @param {Boolean} [cfg.autoFarPlaneFitEnabled=true] Whether to automatically fit the perspective {@link Camera}'s far clipping plane to the whole
|
|
24876
|
+
* {@link Scene} on each tick, so that large models are never clipped by the far plane when the camera moves away from them. The far plane
|
|
24877
|
+
* also shrinks back (with hysteresis) once the camera moves close again, to preserve depth precision. Set ````false```` to manage
|
|
24878
|
+
* {@link Perspective#far} manually.
|
|
24818
24879
|
* @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.
|
|
24819
24880
|
* @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.
|
|
24820
24881
|
* @param {Boolean} [cfg.edgesEnabled] Whether to show edges
|
|
@@ -24850,7 +24911,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
|
|
|
24850
24911
|
* The Viewer's {@link Scene}.
|
|
24851
24912
|
* @property scene
|
|
24852
24913
|
* @type {Scene}
|
|
24853
|
-
*/this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,lightIntensity:cfg.lightIntensity,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,readableGeometryEnabled:!!cfg.readableGeometryEnabled,logarithmicDepthBufferEnabled:!!cfg.logarithmicDepthBufferEnabled,pbrEnabled:!!cfg.pbrEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false,dtxEnabled:!!cfg.dtxEnabled,edgesEnabled:cfg.edgesEnabled,markerZOffset:cfg.markerZOffset,numCachedSectionPlanes:cfg.numCachedSectionPlanes,lodEnabled:!!cfg.lodEnabled,resolutionScale:cfg.resolutionScale,offset:cfg.offset,worldAxis:cfg.worldAxis});/**
|
|
24914
|
+
*/this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,lightIntensity:cfg.lightIntensity,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,readableGeometryEnabled:!!cfg.readableGeometryEnabled,logarithmicDepthBufferEnabled:!!cfg.logarithmicDepthBufferEnabled,autoFarPlaneFitEnabled:cfg.autoFarPlaneFitEnabled,pbrEnabled:!!cfg.pbrEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false,dtxEnabled:!!cfg.dtxEnabled,edgesEnabled:cfg.edgesEnabled,markerZOffset:cfg.markerZOffset,numCachedSectionPlanes:cfg.numCachedSectionPlanes,lodEnabled:!!cfg.lodEnabled,resolutionScale:cfg.resolutionScale,offset:cfg.offset,worldAxis:cfg.worldAxis});/**
|
|
24854
24915
|
* Metadata about the {@link Scene} and the models and objects within it.
|
|
24855
24916
|
* @property metaScene
|
|
24856
24917
|
* @type {MetaScene}
|
|
@@ -24899,7 +24960,7 @@ if(duration!==undefined){this.cameraFlight.duration=duration;}this.cameraFlight.
|
|
|
24899
24960
|
*
|
|
24900
24961
|
* @param {String} event Event name
|
|
24901
24962
|
* @param {Object} value Event parameters
|
|
24902
|
-
*/},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var
|
|
24963
|
+
*/},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i447=0,len=subs.length;_i447<len;_i447++){subs[_i447](value);}}}/**
|
|
24903
24964
|
* Unsubscribes from an event fired at this Viewer.
|
|
24904
24965
|
* @param event
|
|
24905
24966
|
*/},{key:"off",value:function off(event){// TODO
|
|
@@ -24919,12 +24980,12 @@ if(duration!==undefined){this.cameraFlight.duration=duration;}this.cameraFlight.
|
|
|
24919
24980
|
* Uninstalls a Plugin, clearing content from it first.
|
|
24920
24981
|
*
|
|
24921
24982
|
* @private
|
|
24922
|
-
*/},{key:"removePlugin",value:function removePlugin(plugin){for(var
|
|
24983
|
+
*/},{key:"removePlugin",value:function removePlugin(plugin){for(var _i448=0,len=this._plugins.length;_i448<len;_i448++){var _p2=this._plugins[_i448];if(_p2===plugin){if(_p2.clear){_p2.clear();}this._plugins.splice(_i448,1);return;}}}/**
|
|
24923
24984
|
* Sends a message to installed Plugins.
|
|
24924
24985
|
*
|
|
24925
24986
|
* The message can optionally be accompanied by a value.
|
|
24926
24987
|
* @private
|
|
24927
|
-
*/},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var
|
|
24988
|
+
*/},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var _i449=0,len=this._plugins.length;_i449<len;_i449++){var _p3=this._plugins[_i449];if(_p3.send){_p3.send(name,value);}}}/**
|
|
24928
24989
|
* @private
|
|
24929
24990
|
* @deprecated
|
|
24930
24991
|
*/},{key:"clear",value:function clear(){throw'Viewer#clear() no longer implemented - use \'#sendToPlugins("clear") instead';}/**
|
|
@@ -24955,7 +25016,7 @@ if(duration!==undefined){this.cameraFlight.duration=duration;}this.cameraFlight.
|
|
|
24955
25016
|
* @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
|
|
24956
25017
|
* @returns {String} String-encoded image data URI.
|
|
24957
25018
|
*/},{key:"getSnapshot",value:function getSnapshot(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var needFinishSnapshot=!this._snapshotBegun;var resize=params.width!==undefined&¶ms.height!==undefined;var canvas=this.scene.canvas.canvas;var saveWidth=canvas.clientWidth;var saveHeight=canvas.clientHeight;var width=params.width?Math.floor(params.width):canvas.width;var height=params.height?Math.floor(params.height):canvas.height;if(resize){canvas.width=width;canvas.height=height;}if(!this._snapshotBegun){this.beginSnapshot({width:width,height:height});}if(!params.includeGizmos){this.sendToPlugins("snapshotStarting");// Tells plugins to hide things that shouldn't be in snapshot
|
|
24958
|
-
}var captured={};for(var
|
|
25019
|
+
}var captured={};for(var _i450=0,len=this._plugins.length;_i450<len;_i450++){var plugin=this._plugins[_i450];if(plugin.getContainerElement){var container=plugin.getContainerElement();if(container!==document.body){if(!captured[container.id]){captured[container.id]=true;html2canvas(container).then(function(canvas){document.body.appendChild(canvas);setTimeout(function(){document.body.removeChild(canvas);},200);});}}}}// firing "rendering" is necessary to trigger DTX{Lines,Triangles}Layer::_uploadDeferredFlags
|
|
24959
25020
|
this.scene.fire("rendering",{},true);this.scene._renderer.renderSnapshot();var imageDataURI=this.scene._renderer.readSnapshot(params);if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}return imageDataURI;}/**
|
|
24960
25021
|
* Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes
|
|
24961
25022
|
* the HTML elements created by various plugins.
|
|
@@ -24981,7 +25042,7 @@ this.scene.fire("rendering",{},true);this.scene._renderer.renderSnapshot();var i
|
|
|
24981
25042
|
* @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
|
|
24982
25043
|
* @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
|
|
24983
25044
|
* @returns {Promise} Promise which returns a string-encoded image data URI.
|
|
24984
|
-
*/},{key:"getSnapshotWithPlugins",value:(function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var params,needFinishSnapshot,resize,canvas,saveWidth,saveHeight,snapshotWidth,snapshotHeight,snapshotCanvas,pluginToCapture,pluginContainerElements,
|
|
25045
|
+
*/},{key:"getSnapshotWithPlugins",value:(function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var params,needFinishSnapshot,resize,canvas,saveWidth,saveHeight,snapshotWidth,snapshotHeight,snapshotCanvas,pluginToCapture,pluginContainerElements,_i451,len,plugin,containerElement,_i452,_len67,_containerElement,_scale6,off,format,_args=arguments;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:params=_args.length>0&&_args[0]!==undefined?_args[0]:{};// We use gl.readPixels to get the WebGL canvas snapshot in a new
|
|
24985
25046
|
// HTMLCanvas element, scaled to the target snapshot size, then
|
|
24986
25047
|
// use html2canvas to render each plugin's container element into
|
|
24987
25048
|
// that HTMLCanvas. Finally, we save the HTMLCanvas to a bitmap.
|
|
@@ -24991,11 +25052,11 @@ this.scene.fire("rendering",{},true);this.scene._renderer.renderSnapshot();var i
|
|
|
24991
25052
|
// canvas ourselves, in order to allow the Viewer to render the
|
|
24992
25053
|
// right amount of pixels, for a sharper image.
|
|
24993
25054
|
needFinishSnapshot=!this._snapshotBegun;resize=params.width!==undefined&¶ms.height!==undefined;canvas=this.scene.canvas.canvas;saveWidth=canvas.clientWidth;saveHeight=canvas.clientHeight;snapshotWidth=params.width?Math.floor(params.width):canvas.width;snapshotHeight=params.height?Math.floor(params.height):canvas.height;if(resize){canvas.width=snapshotWidth;canvas.height=snapshotHeight;}if(!this._snapshotBegun){this.beginSnapshot();}if(!params.includeGizmos){this.sendToPlugins("snapshotStarting");// Tells plugins to hide things that shouldn't be in snapshot
|
|
24994
|
-
}this.scene._renderer.renderSnapshot();snapshotCanvas=this.scene._renderer.readSnapshotAsCanvas();if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}pluginToCapture={};pluginContainerElements=[];for(
|
|
24995
|
-
plugin=this._plugins[
|
|
25055
|
+
}this.scene._renderer.renderSnapshot();snapshotCanvas=this.scene._renderer.readSnapshotAsCanvas();if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}pluginToCapture={};pluginContainerElements=[];for(_i451=0,len=this._plugins.length;_i451<len;_i451++){// Find plugin container elements
|
|
25056
|
+
plugin=this._plugins[_i451];if(plugin.getContainerElement){containerElement=plugin.getContainerElement();if(containerElement!==document.body){if(!pluginToCapture[containerElement.id]){pluginToCapture[containerElement.id]=true;pluginContainerElements.push(containerElement);}}}}_i452=0,_len67=pluginContainerElements.length;case 1:if(!(_i452<_len67)){_context2.n=3;break;}_containerElement=pluginContainerElements[_i452];//only calculate the scale for first plugin
|
|
24996
25057
|
//for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
|
|
24997
25058
|
//resulting in increase/decreased size for the the canvas that is being overlapped
|
|
24998
|
-
_scale6=
|
|
25059
|
+
_scale6=_i452==0?snapshotCanvas.width/_containerElement.clientWidth:1;off=math.vec2([0,0]);transformToNode(canvas,_containerElement,off);_context2.n=2;return html2canvas(_containerElement,{canvas:snapshotCanvas,backgroundColor:null,x:off[0],y:off[1],scale:_scale6});case 2:_i452++;_context2.n=1;break;case 3:if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}format=params.format||"png";if(format!=="jpeg"&&format!=="png"&&format!=="bmp"){console.error("Unsupported image format: '"+format+"' - supported types are 'jpeg', 'bmp' and 'png' - defaulting to 'png'");format="png";}if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}return _context2.a(2,snapshotCanvas.toDataURL("image/".concat(format)));}},_callee,this);}));function getSnapshotWithPlugins(){return _getSnapshotWithPlugins.apply(this,arguments);}return getSnapshotWithPlugins;}()/**
|
|
24999
25060
|
* Exits snapshot mode.
|
|
25000
25061
|
*
|
|
25001
25062
|
* Switches rendering back to the main canvas.
|
|
@@ -25003,8 +25064,8 @@ _scale6=_i451==0?snapshotCanvas.width/_containerElement.clientWidth:1;off=math.v
|
|
|
25003
25064
|
*/)},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/**
|
|
25004
25065
|
* Destroys this Viewer.
|
|
25005
25066
|
*/},{key:"destroy",value:function destroy(callback){var plugins=this._plugins.slice();// Array will modify as we delete plugins
|
|
25006
|
-
if(plugins.length>0){for(var _i452=0,len=plugins.length;_i452<len;_i452++){var plugin=plugins[_i452];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$2=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$1&&parseFloat(matches$1[1])||0;var VERSION$8="3.4.15";function assert$4(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof __webpack_require__.g!=='undefined'&&__webpack_require__.g,document:typeof document!=='undefined'&&document};var global_=globals$1.global||globals$1.self||globals$1.window||{};var isBrowser$1=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[1])||0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _defineProperty(e,r,t){return(r=toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}var WorkerJob=/*#__PURE__*/function(){function WorkerJob(jobName,workerThread){var _this113=this;_classCallCheck(this,WorkerJob);_defineProperty(this,"name",void 0);_defineProperty(this,"workerThread",void 0);_defineProperty(this,"isRunning",true);_defineProperty(this,"result",void 0);_defineProperty(this,"_resolve",function(){});_defineProperty(this,"_reject",function(){});this.name=jobName;this.workerThread=workerThread;this.result=new Promise(function(resolve,reject){_this113._resolve=resolve;_this113._reject=reject;});}return _createClass(WorkerJob,[{key:"postMessage",value:function postMessage(type,payload){this.workerThread.postMessage({source:'loaders.gl',type:type,payload:payload});}},{key:"done",value:function done(value){assert$4(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$4(this.isRunning);this.isRunning=false;this._reject(_error);}}]);}();var Worker$1=/*#__PURE__*/function(){function Worker$1(){_classCallCheck(this,Worker$1);}return _createClass(Worker$1,[{key:"terminate",value:function terminate(){}}]);}();var workerURLCache=new Map();function getLoadableWorkerURL(props){assert$4(props.source&&!props.url||!props.source&&props.url);var workerURL=workerURLCache.get(props.source||props.url);if(!workerURL){if(props.url){workerURL=getLoadableWorkerURLFromURL(props.url);workerURLCache.set(props.url,workerURL);}if(props.source){workerURL=getLoadableWorkerURLFromSource(props.source);workerURLCache.set(props.source,workerURL);}}assert$4(workerURL);return workerURL;}function getLoadableWorkerURLFromURL(url){if(!url.startsWith('http')){return url;}var workerSource=buildScriptSource(url);return getLoadableWorkerURLFromSource(workerSource);}function getLoadableWorkerURLFromSource(workerSource){var blob=new Blob([workerSource],{type:'application/javascript'});return URL.createObjectURL(blob);}function buildScriptSource(workerUrl){return"try {\n importScripts('".concat(workerUrl,"');\n} catch (error) {\n console.error(error);\n throw error;\n}");}function getTransferList(object){var recursive=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var transfers=arguments.length>2?arguments[2]:undefined;var transfersSet=transfers||new Set();if(!object);else if(isTransferable(object)){transfersSet.add(object);}else if(isTransferable(object.buffer)){transfersSet.add(object.buffer);}else if(ArrayBuffer.isView(object));else if(recursive&&_typeof2(object)==='object'){for(var key in object){getTransferList(object[key],recursive,transfersSet);}}return transfers===undefined?Array.from(transfersSet):[];}function isTransferable(object){if(!object){return false;}if(object instanceof ArrayBuffer){return true;}if(typeof MessagePort!=='undefined'&&object instanceof MessagePort){return true;}if(typeof ImageBitmap!=='undefined'&&object instanceof ImageBitmap){return true;}if(typeof OffscreenCanvas!=='undefined'&&object instanceof OffscreenCanvas){return true;}return false;}var NOOP=function NOOP(){};var WorkerThread=/*#__PURE__*/function(){function WorkerThread(props){_classCallCheck(this,WorkerThread);_defineProperty(this,"name",void 0);_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"terminated",false);_defineProperty(this,"worker",void 0);_defineProperty(this,"onMessage",void 0);_defineProperty(this,"onError",void 0);_defineProperty(this,"_loadableURL",'');var name=props.name,source=props.source,url=props.url;assert$4(source||url);this.name=name;this.source=source;this.url=url;this.onMessage=NOOP;this.onError=function(error){return console.log(error);};this.worker=isBrowser$1?this._createBrowserWorker():this._createNodeWorker();}return _createClass(WorkerThread,[{key:"destroy",value:function destroy(){this.onMessage=NOOP;this.onError=NOOP;this.worker.terminate();this.terminated=true;}},{key:"isRunning",get:function get(){return Boolean(this.onMessage);}},{key:"postMessage",value:function postMessage(data,transferList){transferList=transferList||getTransferList(data);this.worker.postMessage(data,transferList);}},{key:"_getErrorFromErrorEvent",value:function _getErrorFromErrorEvent(event){var message='Failed to load ';message+="worker ".concat(this.name," from ").concat(this.url,". ");if(event.message){message+="".concat(event.message," in ");}if(event.lineno){message+=":".concat(event.lineno,":").concat(event.colno);}return new Error(message);}},{key:"_createBrowserWorker",value:function _createBrowserWorker(){var _this114=this;this._loadableURL=getLoadableWorkerURL({source:this.source,url:this.url});var worker=new Worker(this._loadableURL,{name:this.name});worker.onmessage=function(event){if(!event.data){_this114.onError(new Error('No data received'));}else{_this114.onMessage(event.data);}};worker.onerror=function(error){_this114.onError(_this114._getErrorFromErrorEvent(error));_this114.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this115=this;var worker;if(this.url){var absolute=this.url.includes(':/')||this.url.startsWith('/');var url=absolute?this.url:"./".concat(this.url);worker=new Worker$1(url,{eval:false});}else if(this.source){worker=new Worker$1(this.source,{eval:true});}else{throw new Error('no worker');}worker.on('message',function(data){_this115.onMessage(data);});worker.on('error',function(error){_this115.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$1||typeof Worker$1!=='undefined'&&!isBrowser$1;}}]);}();var WorkerPool=/*#__PURE__*/function(){function WorkerPool(props){_classCallCheck(this,WorkerPool);_defineProperty(this,"name",'unnamed');_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"maxConcurrency",1);_defineProperty(this,"maxMobileConcurrency",1);_defineProperty(this,"onDebug",function(){});_defineProperty(this,"reuseWorkers",true);_defineProperty(this,"props",{});_defineProperty(this,"jobQueue",[]);_defineProperty(this,"idleQueue",[]);_defineProperty(this,"count",0);_defineProperty(this,"isDestroyed",false);this.source=props.source;this.url=props.url;this.setProps(props);}return _createClass(WorkerPool,[{key:"destroy",value:function destroy(){this.idleQueue.forEach(function(worker){return worker.destroy();});this.isDestroyed=true;}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);if(props.name!==undefined){this.name=props.name;}if(props.maxConcurrency!==undefined){this.maxConcurrency=props.maxConcurrency;}if(props.maxMobileConcurrency!==undefined){this.maxMobileConcurrency=props.maxMobileConcurrency;}if(props.reuseWorkers!==undefined){this.reuseWorkers=props.reuseWorkers;}if(props.onDebug!==undefined){this.onDebug=props.onDebug;}}},{key:"startJob",value:function(){var _startJob=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(name){var _this116=this;var onMessage,onError,startPromise,_args2=arguments;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:onMessage=_args2.length>1&&_args2[1]!==undefined?_args2[1]:function(job,type,data){return job.done(data);};onError=_args2.length>2&&_args2[2]!==undefined?_args2[2]:function(job,error){return job.error(error);};startPromise=new Promise(function(onStart){_this116.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this116;});this._startQueuedJob();_context3.n=1;return startPromise;case 1:return _context3.a(2,_context3.v);}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(){var workerThread,queuedJob,job;return _regenerator().w(function(_context4){while(1)switch(_context4.p=_context4.n){case 0:if(this.jobQueue.length){_context4.n=1;break;}return _context4.a(2);case 1:workerThread=this._getAvailableWorker();if(workerThread){_context4.n=2;break;}return _context4.a(2);case 2:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.n=5;break;}this.onDebug({message:'Starting job',name:queuedJob.name,workerThread:workerThread,backlog:this.jobQueue.length});job=new WorkerJob(queuedJob.name,workerThread);workerThread.onMessage=function(data){return queuedJob.onMessage(job,data.type,data.payload);};workerThread.onError=function(error){return queuedJob.onError(job,error);};queuedJob.onStart(job);_context4.p=3;_context4.n=4;return job.result;case 4:_context4.p=4;this.returnWorkerToQueue(workerThread);return _context4.f(4);case 5:return _context4.a(2);}},_callee3,this,[[3,,4,5]]);}));function _startQueuedJob(){return _startQueuedJob2.apply(this,arguments);}return _startQueuedJob;}()},{key:"returnWorkerToQueue",value:function returnWorkerToQueue(worker){var shouldDestroyWorker=this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency();if(shouldDestroyWorker){worker.destroy();this.count--;}else{this.idleQueue.push(worker);}if(!this.isDestroyed){this._startQueuedJob();}}},{key:"_getAvailableWorker",value:function _getAvailableWorker(){if(this.idleQueue.length>0){return this.idleQueue.shift()||null;}if(this.count<this._getMaxConcurrency()){this.count++;var _name5="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new WorkerThread({name:_name5,source:this.source,url:this.url});}return null;}},{key:"_getMaxConcurrency",value:function _getMaxConcurrency(){return isMobile?this.maxMobileConcurrency:this.maxConcurrency;}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}}]);}();var DEFAULT_PROPS={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:true,onDebug:function onDebug(){}};var WorkerFarm=/*#__PURE__*/function(){function WorkerFarm(props){_classCallCheck(this,WorkerFarm);_defineProperty(this,"props",void 0);_defineProperty(this,"workerPools",new Map());this.props=_objectSpread({},DEFAULT_PROPS);this.setProps(props);this.workerPools=new Map();}return _createClass(WorkerFarm,[{key:"destroy",value:function destroy(){var _iterator7=_createForOfIteratorHelper(this.workerPools.values()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var workerPool=_step7.value;workerPool.destroy();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}this.workerPools=new Map();}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);var _iterator8=_createForOfIteratorHelper(this.workerPools.values()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var workerPool=_step8.value;workerPool.setProps(this._getWorkerPoolProps());}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}},{key:"getWorkerPool",value:function getWorkerPool(options){var name=options.name,source=options.source,url=options.url;var workerPool=this.workerPools.get(name);if(!workerPool){workerPool=new WorkerPool({name:name,source:source,url:url});workerPool.setProps(this._getWorkerPoolProps());this.workerPools.set(name,workerPool);}return workerPool;}},{key:"_getWorkerPoolProps",value:function _getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug};}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}},{key:"getWorkerFarm",value:function getWorkerFarm(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);}();_defineProperty(WorkerFarm,"_workerFarm",void 0);var NPM_TAG='latest';function getWorkerURL(worker){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var workerOptions=options[worker.id]||{};var workerFile="".concat(worker.id,"-worker.js");var url=workerOptions.workerUrl;if(!url&&worker.id==='compression'){url=options.workerUrl;}if(options._workerType==='test'){url="modules/".concat(worker.module,"/dist/").concat(workerFile);}if(!url){var version=worker.version;if(version==='latest'){version=NPM_TAG;}var versionTag=version?"@".concat(version):'';url="https://unpkg.com/@loaders.gl/".concat(worker.module).concat(versionTag,"/dist/").concat(workerFile);}assert$4(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$8;assert$4(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}var readFileAsArrayBuffer=null;var readFileAsText=null;var requireFromFile=null;var requireFromString=null;var node=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer,readFileAsText:readFileAsText,requireFromFile:requireFromFile,requireFromString:requireFromString});var VERSION$7="3.4.15";var loadLibraryPromises={};function loadLibrary(_x8){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(libraryUrl){var moduleName,options,_args5=arguments;return _regenerator().w(function(_context10){while(1)switch(_context10.n){case 0:moduleName=_args5.length>1&&_args5[1]!==undefined?_args5[1]:null;options=_args5.length>2&&_args5[2]!==undefined?_args5[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context10.n=1;return loadLibraryPromises[libraryUrl];case 1:return _context10.a(2,_context10.v);}},_callee9);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser$1){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$4(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$7,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x9){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(libraryUrl){var _response,response,scriptSource,_t1,_t10;return _regenerator().w(function(_context11){while(1)switch(_context11.p=_context11.n){case 0:if(!libraryUrl.endsWith('wasm')){_context11.n=3;break;}_context11.n=1;return fetch(libraryUrl);case 1:_response=_context11.v;_context11.n=2;return _response.arrayBuffer();case 2:return _context11.a(2,_context11.v);case 3:if(isBrowser$1){_context11.n=8;break;}_context11.p=4;_t1=node&&requireFromFile;if(!_t1){_context11.n=6;break;}_context11.n=5;return requireFromFile(libraryUrl);case 5:_t1=_context11.v;case 6:return _context11.a(2,_t1);case 7:_context11.p=7;_t10=_context11.v;return _context11.a(2,null);case 8:if(!isWorker){_context11.n=9;break;}return _context11.a(2,importScripts(libraryUrl));case 9:_context11.n=10;return fetch(libraryUrl);case 10:response=_context11.v;_context11.n=11;return response.text();case 11:scriptSource=_context11.v;return _context11.a(2,loadLibraryFromString(scriptSource,libraryUrl));}},_callee0,null,[[4,7]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser$1){return requireFromString;}if(isWorker){eval.call(global_,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$1&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x0,_x1,_x10,_x11,_x12){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regenerator().w(function(_context12){while(1)switch(_context12.n){case 0:name=loader.id;url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context12.n=1;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 1:job=_context12.v;job.postMessage('process',{input:data,options:options,context:context});_context12.n=2;return job.result;case 2:result=_context12.v;_context12.n=3;return result.result;case 3:return _context12.a(2,_context12.v);}},_callee1);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x13,_x14,_x15,_x16){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(parseOnMainThread,job,type,payload){var id,input,options,result,message,_t11,_t12;return _regenerator().w(function(_context13){while(1)switch(_context13.p=_context13.n){case 0:_t11=type;_context13.n=_t11==='done'?1:_t11==='error'?2:_t11==='process'?3:8;break;case 1:job.done(payload);return _context13.a(3,9);case 2:job.error(new Error(payload.error));return _context13.a(3,9);case 3:id=payload.id,input=payload.input,options=payload.options;_context13.p=4;_context13.n=5;return parseOnMainThread(input,options);case 5:result=_context13.v;job.postMessage('done',{id:id,result:result});_context13.n=7;break;case 6:_context13.p=6;_t12=_context13.v;message=_t12 instanceof Error?_t12.message:'unknown error';job.postMessage('error',{id:id,error:message});case 7:return _context13.a(3,9);case 8:console.warn("parse-with-worker unknown message ".concat(type));case 9:return _context13.a(2);}},_callee10,null,[[4,6]]);}));return _onMessage2.apply(this,arguments);}function getFirstCharacters$1(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i453=0;_i453<length;_i453++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i453));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters$1(string),"\""));}}function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i454=0;_i454<array1.length;++_i454){if(array1[_i454]!==array2[_i454]){return false;}}return true;}function concatenateArrayBuffers(){for(var _len=arguments.length,sources=new Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}var sourceArrays=sources.map(function(source2){return source2 instanceof ArrayBuffer?new Uint8Array(source2):source2;});var byteLength=sourceArrays.reduce(function(length,typedArray){return length+typedArray.byteLength;},0);var result=new Uint8Array(byteLength);var offset=0;var _iterator9=_createForOfIteratorHelper(sourceArrays),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var sourceArray=_step9.value;result.set(sourceArray,offset);offset+=sourceArray.byteLength;}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return result.buffer;}function sliceArrayBuffer(arrayBuffer,byteOffset,byteLength){var subArray=byteLength!==undefined?new Uint8Array(arrayBuffer).subarray(byteOffset,byteOffset+byteLength):new Uint8Array(arrayBuffer).subarray(byteOffset);var arrayCopy=new Uint8Array(subArray);return arrayCopy.buffer;}function padToNBytes(byteLength,padding){assert$5(byteLength>=0);assert$5(padding>0);return byteLength+(padding-1)&~(padding-1);}function copyToArray(source,target,targetOffset){var sourceArray;if(source instanceof ArrayBuffer){sourceArray=new Uint8Array(source);}else{var srcByteOffset=source.byteOffset;var srcByteLength=source.byteLength;sourceArray=new Uint8Array(source.buffer||source.arrayBuffer,srcByteOffset,srcByteLength);}target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray.byteLength,4);}function concatenateArrayBuffersAsync(_x17){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk,_t13;return _regenerator().w(function(_context14){while(1)switch(_context14.p=_context14.n){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context14.p=1;_iterator=_asyncIterator(asyncIterator);case 2:_context14.n=3;return _iterator.next();case 3:if(!(_iteratorAbruptCompletion=!(_step=_context14.v).done)){_context14.n=5;break;}chunk=_step.value;arrayBuffers.push(chunk);case 4:_iteratorAbruptCompletion=false;_context14.n=2;break;case 5:_context14.n=7;break;case 6:_context14.p=6;_t13=_context14.v;_didIteratorError=true;_iteratorError=_t13;case 7:_context14.p=7;_context14.p=8;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context14.n=9;break;}_context14.n=9;return _iterator["return"]();case 9:_context14.p=9;if(!_didIteratorError){_context14.n=10;break;}throw _iteratorError;case 10:return _context14.f(9);case 11:return _context14.f(7);case 12:return _context14.a(2,concatenateArrayBuffers.apply(void 0,arrayBuffers));}},_callee11,null,[[8,,9,11],[1,6,7,12]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};function resolvePath(filename){for(var alias in fileAliases){if(filename.startsWith(alias)){var replacement=fileAliases[alias];filename=filename.replace(alias,replacement);}}if(!filename.startsWith('http://')&&!filename.startsWith('https://')){filename="".concat(pathPrefix).concat(filename);}return filename;}function toArrayBuffer$1(buffer){return buffer;}function isBuffer$1(value){return value&&_typeof2(value)==='object'&&value.isBuffer;}function toArrayBuffer(data){if(isBuffer$1(data)){return toArrayBuffer$1(data);}if(data instanceof ArrayBuffer){return data;}if(ArrayBuffer.isView(data)){if(data.byteOffset===0&&data.byteLength===data.buffer.byteLength){return data.buffer;}return data.buffer.slice(data.byteOffset,data.byteOffset+data.byteLength);}if(typeof data==='string'){var text=data;var uint8Array=new TextEncoder().encode(text);return uint8Array.buffer;}if(data&&_typeof2(data)==='object'&&data._toArrayBuffer){return data._toArrayBuffer();}throw new Error('toArrayBuffer');}function filename(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(slashIndex+1):'';}function dirname(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(0,slashIndex):'';}var isBoolean=function isBoolean(x){return typeof x==='boolean';};var isFunction=function isFunction(x){return typeof x==='function';};var isObject=function isObject(x){return x!==null&&_typeof2(x)==='object';};var isPureObject=function isPureObject(x){return isObject(x)&&x.constructor==={}.constructor;};var isIterable=function isIterable(x){return x&&typeof x[Symbol.iterator]==='function';};var isAsyncIterable=function isAsyncIterable(x){return x&&typeof x[Symbol.asyncIterator]==='function';};var isResponse=function isResponse(x){return typeof Response!=='undefined'&&x instanceof Response||x&&x.arrayBuffer&&x.text&&x.json;};var isBlob=function isBlob(x){return typeof Blob!=='undefined'&&x instanceof Blob;};var isBuffer=function isBuffer(x){return x&&_typeof2(x)==='object'&&x.isBuffer;};var isReadableDOMStream=function isReadableDOMStream(x){return typeof ReadableStream!=='undefined'&&x instanceof ReadableStream||isObject(x)&&isFunction(x.tee)&&isFunction(x.cancel)&&isFunction(x.getReader);};var isReadableNodeStream=function isReadableNodeStream(x){return isObject(x)&&isFunction(x.read)&&isFunction(x.pipe)&&isBoolean(x.readable);};var isReadableStream=function isReadableStream(x){return isReadableDOMStream(x)||isReadableNodeStream(x);};var DATA_URL_PATTERN=/^data:([-\w.]+\/[-\w.+]+)(;|,)/;var MIME_TYPE_PATTERN=/^([-\w.]+\/[-\w.+]+)/;function parseMIMEType(mimeString){var matches=MIME_TYPE_PATTERN.exec(mimeString);if(matches){return matches[1];}return mimeString;}function parseMIMETypeFromURL(url){var matches=DATA_URL_PATTERN.exec(url);if(matches){return matches[1];}return'';}var QUERY_STRING_PATTERN=/\?.*/;function extractQueryString(url){var matches=url.match(QUERY_STRING_PATTERN);return matches&&matches[0];}function stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function getResourceUrl(resource){if(isResponse(resource)){var response=resource;return response.url;}if(isBlob(resource)){var blob=resource;return blob.name||'';}if(typeof resource==='string'){return resource;}return'';}function getResourceMIMEType(resource){if(isResponse(resource)){var response=resource;var contentTypeHeader=response.headers.get('content-type')||'';var noQueryUrl=stripQueryString(response.url);return parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(noQueryUrl);}if(isBlob(resource)){var blob=resource;return blob.type||'';}if(typeof resource==='string'){return parseMIMETypeFromURL(resource);}return'';}function getResourceContentLength(resource){if(isResponse(resource)){var response=resource;return response.headers['content-length']||-1;}if(isBlob(resource)){var blob=resource;return blob.size;}if(typeof resource==='string'){return resource.length;}if(resource instanceof ArrayBuffer){return resource.byteLength;}if(ArrayBuffer.isView(resource)){return resource.byteLength;}return-1;}function makeResponse(_x18){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regenerator().w(function(_context15){while(1)switch(_context15.n){case 0:if(!isResponse(resource)){_context15.n=1;break;}return _context15.a(2,resource);case 1:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}_context15.n=2;return getInitialDataUrl(resource);case 2:initialDataUrl=_context15.v;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}if(typeof resource==='string'){resource=new TextEncoder().encode(resource);}response=new Response(resource,{headers:headers});Object.defineProperty(response,'url',{value:url});return _context15.a(2,response);}},_callee12);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x19){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(response){var message;return _regenerator().w(function(_context16){while(1)switch(_context16.n){case 0:if(response.ok){_context16.n=2;break;}_context16.n=1;return getResponseError(response);case 1:message=_context16.v;throw new Error(message);case 2:return _context16.a(2);}},_callee13);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x20){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(response){var message,contentType,text,_t14,_t15,_t16;return _regenerator().w(function(_context17){while(1)switch(_context17.p=_context17.n){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context17.p=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context17.n=3;break;}_t14=text;_t15=" ";_context17.n=2;return response.text();case 2:text=_t14+=_t15.concat.call(_t15,_context17.v);case 3:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context17.n=5;break;case 4:_context17.p=4;_t16=_context17.v;case 5:return _context17.a(2,message);}},_callee14,null,[[1,4]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x21){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regenerator().w(function(_context18){while(1)switch(_context18.n){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context18.n=1;break;}return _context18.a(2,"data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 1:if(!(resource instanceof Blob)){_context18.n=3;break;}blobSlice=resource.slice(0,5);_context18.n=2;return new Promise(function(resolve){var reader=new FileReader();reader.onload=function(event){var _event$target;return resolve(event===null||event===void 0?void 0:(_event$target=event.target)===null||_event$target===void 0?void 0:_event$target.result);};reader.readAsDataURL(blobSlice);});case 2:return _context18.a(2,_context18.v);case 3:if(!(resource instanceof ArrayBuffer)){_context18.n=4;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context18.a(2,"data:base64,".concat(_base));case 4:return _context18.a(2,null);}},_callee15);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i455=0;_i455<bytes.byteLength;_i455++){binary+=String.fromCharCode(bytes[_i455]);}return btoa(binary);}function fetchFile(_x22,_x23){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(url,options){var fetchOptions;return _regenerator().w(function(_context19){while(1)switch(_context19.n){case 0:if(!(typeof url==='string')){_context19.n=2;break;}url=resolvePath(url);fetchOptions=options;if(options!==null&&options!==void 0&&options.fetch&&typeof(options===null||options===void 0?void 0:options.fetch)!=='function'){fetchOptions=options.fetch;}_context19.n=1;return fetch(url,fetchOptions);case 1:return _context19.a(2,_context19.v);case 2:_context19.n=3;return makeResponse(url);case 3:return _context19.a(2,_context19.v);}},_callee16);}));return _fetchFile.apply(this,arguments);}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof2(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof2(process.versions)==='object'&&Boolean(process.versions['electron'])){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof2(navigator))==='object'&&typeof navigator.userAgent==='string'&&navigator.userAgent;var userAgent=mockUserAgent||realUserAgent;if(userAgent&&userAgent.indexOf('Electron')>=0){return true;}return false;}function isBrowser(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var globals={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof __webpack_require__.g!=='undefined'&&__webpack_require__.g,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&process};var window_=globals.window||globals.self||globals.global;var process_=globals.process||{};var VERSION$6=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser();function getStorage(type){try{var storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return storage;}catch(e){return null;}}var LocalStorage=/*#__PURE__*/function(){function LocalStorage(id,defaultConfig){_classCallCheck(this,LocalStorage);var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",void 0);this.storage=getStorage(type);this.id=id;this.config=defaultConfig;this._loadConfiguration();}return _createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}}},{key:"_loadConfiguration",value:function _loadConfiguration(){var configuration={};if(this.storage){var serializedConfiguration=this.storage.getItem(this.id);configuration=serializedConfiguration?JSON.parse(serializedConfiguration):{};}Object.assign(this.config,configuration);return this;}}]);}();function formatTime(ms){var formatted;if(ms<10){formatted="".concat(ms.toFixed(2),"ms");}else if(ms<100){formatted="".concat(ms.toFixed(1),"ms");}else if(ms<1000){formatted="".concat(ms.toFixed(0),"ms");}else{formatted="".concat((ms/1000).toFixed(2),"s");}return formatted;}function leftPad(string){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var padLength=Math.max(length-string.length,0);return"".concat(' '.repeat(padLength)).concat(string);}function formatImage(image,message,scale){var maxWidth=arguments.length>3&&arguments[3]!==undefined?arguments[3]:600;var imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29');if(image.width>maxWidth){scale=Math.min(scale,maxWidth/image.width);}var width=image.width*scale;var height=image.height*scale;var style=['font-size:1px;',"padding:".concat(Math.floor(height/2),"px ").concat(Math.floor(width/2),"px;"),"line-height:".concat(height,"px;"),"background:url(".concat(imageUrl,");"),"background-size:".concat(width,"px ").concat(height,"px;"),'color:transparent;'].join('');return["".concat(message," %c+"),style];}var COLOR;(function(COLOR){COLOR[COLOR["BLACK"]=30]="BLACK";COLOR[COLOR["RED"]=31]="RED";COLOR[COLOR["GREEN"]=32]="GREEN";COLOR[COLOR["YELLOW"]=33]="YELLOW";COLOR[COLOR["BLUE"]=34]="BLUE";COLOR[COLOR["MAGENTA"]=35]="MAGENTA";COLOR[COLOR["CYAN"]=36]="CYAN";COLOR[COLOR["WHITE"]=37]="WHITE";COLOR[COLOR["BRIGHT_BLACK"]=90]="BRIGHT_BLACK";COLOR[COLOR["BRIGHT_RED"]=91]="BRIGHT_RED";COLOR[COLOR["BRIGHT_GREEN"]=92]="BRIGHT_GREEN";COLOR[COLOR["BRIGHT_YELLOW"]=93]="BRIGHT_YELLOW";COLOR[COLOR["BRIGHT_BLUE"]=94]="BRIGHT_BLUE";COLOR[COLOR["BRIGHT_MAGENTA"]=95]="BRIGHT_MAGENTA";COLOR[COLOR["BRIGHT_CYAN"]=96]="BRIGHT_CYAN";COLOR[COLOR["BRIGHT_WHITE"]=97]="BRIGHT_WHITE";})(COLOR||(COLOR={}));function getColor(color){return typeof color==='string'?COLOR[color.toUpperCase()]||COLOR.WHITE:color;}function addColor(string,color,background){if(!isBrowser&&typeof string==='string'){if(color){color=getColor(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator0=_createForOfIteratorHelper(propNames),_step0;try{var _loop3=function _loop3(){var key=_step0.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator0.s();!(_step0=_iterator0.n()).done;){_loop3();}}catch(err){_iterator0.e(err);}finally{_iterator0.f();}}function assert$3(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser&&'performance'in window_){var _window$performance,_window$performance$n;timestamp=window_===null||window_===void 0?void 0:(_window$performance=window_.performance)===null||_window$performance===void 0?void 0:(_window$performance$n=_window$performance.now)===null||_window$performance$n===void 0?void 0:_window$performance$n.call(_window$performance);}else if('hrtime'in process_){var _process$hrtime;var timeParts=process_===null||process_===void 0?void 0:(_process$hrtime=process_.hrtime)===null||_process$hrtime===void 0?void 0:_process$hrtime.call(process_);timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole={debug:isBrowser?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS={enabled:true,level:0};function noop(){}var cache={};var ONCE={once:true};var Log=/*#__PURE__*/function(){function Log(){_classCallCheck(this,Log);var _ref14=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref14.id;_defineProperty(this,"id",void 0);_defineProperty(this,"VERSION",VERSION$6);_defineProperty(this,"_startTs",getHiResTimestamp());_defineProperty(this,"_deltaTs",getHiResTimestamp());_defineProperty(this,"_storage",void 0);_defineProperty(this,"userData",{});_defineProperty(this,"LOG_THROTTLE_TIMEOUT",0);this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}return _createClass(Log,[{key:"level",get:function get(){return this.getLevel();},set:function set(newLevel){this.setLevel(newLevel);}},{key:"isEnabled",value:function isEnabled(){return this._storage.config.enabled;}},{key:"getLevel",value:function getLevel(){return this._storage.config.level;}},{key:"getTotal",value:function getTotal(){return Number((getHiResTimestamp()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp()-this._deltaTs).toPrecision(10));}},{key:"priority",get:function get(){return this.level;},set:function set(newPriority){this.level=newPriority;}},{key:"getPriority",value:function getPriority(){return this.level;}},{key:"enable",value:function enable(){var enabled=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this._storage.setConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.setConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.setConfiguration(_defineProperty2({},setting,value));}},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"assert",value:function assert(condition,message){assert$3(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole.warn,arguments,ONCE);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole.error,arguments);}},{key:"deprecated",value:function deprecated(oldUsage,newUsage){return this.warn("`".concat(oldUsage,"` is deprecated and will be removed in a later version. Use `").concat(newUsage,"` instead"));}},{key:"removed",value:function removed(oldUsage,newUsage){return this.error("`".concat(oldUsage,"` has been removed. Use `").concat(newUsage,"` instead"));}},{key:"probe",value:function probe(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return this._getLogFunction(logLevel,message,originalConsole.debug||originalConsole.info,arguments,ONCE);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop,columns&&[columns],{tag:getTableHeader(_table)});}return noop;}},{key:"image",value:function image(_ref){var logLevel=_ref.logLevel,priority=_ref.priority,image=_ref.image,_ref$message=_ref.message,message=_ref$message===void 0?'':_ref$message,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale;if(!this._shouldLog(logLevel||priority)){return noop;}return isBrowser?logImageInBrowser({image:image,message:message,scale:scale}):logImageInNode();}},{key:"time",value:function time(logLevel,message){return this._getLogFunction(logLevel,message,console.time?console.time:console.info);}},{key:"timeEnd",value:function timeEnd(logLevel,message){return this._getLogFunction(logLevel,message,console.timeEnd?console.timeEnd:console.info);}},{key:"timeStamp",value:function timeStamp(logLevel,message){return this._getLogFunction(logLevel,message,console.timeStamp||noop);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};var options=normalizeArguments({logLevel:logLevel,message:message,opts:opts});var collapsed=opts.collapsed;options.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(options);}},{key:"groupCollapsed",value:function groupCollapsed(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.group(logLevel,message,Object.assign({},opts,{collapsed:true}));}},{key:"groupEnd",value:function groupEnd(logLevel){return this._getLogFunction(logLevel,'',console.groupEnd||noop);}},{key:"withGroup",value:function withGroup(logLevel,message,func){this.group(logLevel,message)();try{func();}finally{this.groupEnd(logLevel)();}}},{key:"trace",value:function trace(){if(console.trace){console.trace();}}},{key:"_shouldLog",value:function _shouldLog(logLevel){return this.isEnabled()&&this.getLevel()>=normalizeLogLevel(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method,args,opts){if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$3(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once){if(!cache[tag]){cache[tag]=getHiResTimestamp();}else{return noop;}}message=decorateMessage(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);}();_defineProperty(Log,"VERSION",VERSION$6);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof2(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$3(Number.isFinite(resolvedLevel)&&resolvedLevel>=0);return resolvedLevel;}function normalizeArguments(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}switch(_typeof2(logLevel)){case'string':case'function':if(message!==undefined){args.unshift(message);}opts.message=logLevel;break;case'object':Object.assign(opts,logLevel);break;}if(typeof opts.message==='function'){opts.message=opts.message();}var messageType=_typeof2(opts.message);assert$3(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){console.warn('removed');return noop;}function logImageInBrowser(_ref3){var image=_ref3.image,_ref3$message=_ref3.message,message=_ref3$message===void 0?'':_ref3$message,_ref3$scale=_ref3.scale,scale=_ref3$scale===void 0?1:_ref3$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage(_img,message,scale)));};_img.src=image.toDataURL();return noop;}return noop;}function getTableHeader(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var probeLog=new Log({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}return _createClass(NullLog,[{key:"log",value:function log(){return function(){};}},{key:"info",value:function info(){return function(){};}},{key:"warn",value:function warn(){return function(){};}},{key:"error",value:function error(){return function(){};}}]);}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}return _createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return(_this$console$log=this.console.log).bind.apply(_this$console$log,[this.console].concat(args));}},{key:"info",value:function info(){var _this$console$info;for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}return(_this$console$info=this.console.info).bind.apply(_this$console$info,[this.console].concat(args));}},{key:"warn",value:function warn(){var _this$console$warn;for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}return(_this$console$warn=this.console.warn).bind.apply(_this$console$warn,[this.console].concat(args));}},{key:"error",value:function error(){var _this$console$error;for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);}();var DEFAULT_LOADER_OPTIONS={fetch:null,mimeType:undefined,nothrow:false,log:new ConsoleLog(),CDN:'https://unpkg.com/@loaders.gl',worker:true,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:isBrowser$2,_nodeWorkers:false,_workerType:'',limit:0,_limitMB:0,batchSize:'auto',batchDebounceMs:0,metadata:false,transforms:[]};var REMOVED_LOADER_OPTIONS={"throws":'nothrow',dataType:'(no longer used)',uri:'baseUri',method:'fetch.method',headers:'fetch.headers',body:'fetch.body',mode:'fetch.mode',credentials:'fetch.credentials',cache:'fetch.cache',redirect:'fetch.redirect',referrer:'fetch.referrer',referrerPolicy:'fetch.referrerPolicy',integrity:'fetch.integrity',keepalive:'fetch.keepalive',signal:'fetch.signal'};function getGlobalLoaderState(){globalThis.loaders=globalThis.loaders||{};var loaders=globalThis.loaders;loaders._state=loaders._state||{};return loaders._state;}var getGlobalLoaderOptions=function getGlobalLoaderOptions(){var state=getGlobalLoaderState();state.globalOptions=state.globalOptions||_objectSpread({},DEFAULT_LOADER_OPTIONS);return state.globalOptions;};function normalizeOptions(options,loader,loaders,url){loaders=loaders||[];loaders=Array.isArray(loaders)?loaders:[loaders];validateOptions(options,loaders);return normalizeOptionsInternal(loader,options,url);}function validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator1=_createForOfIteratorHelper(loaders),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var loader=_step1.value;var idOptions=options&&options[loader.id]||{};var loaderOptions=loader.options&&loader.options[loader.id]||{};var deprecatedOptions=loader.deprecatedOptions&&loader.deprecatedOptions[loader.id]||{};validateOptionsObject(idOptions,loader.id,loaderOptions,deprecatedOptions,loaders);}}catch(err){_iterator1.e(err);}finally{_iterator1.f();}}function validateOptionsObject(options,id,defaultOptions,deprecatedOptions,loaders){var loaderName=id||'Top level';var prefix=id?"".concat(id,"."):'';for(var key in options){var isSubOptions=!id&&isObject(options[key]);var isBaseUriOption=key==='baseUri'&&!id;var isWorkerUrlOption=key==='workerUrl'&&id;if(!(key in defaultOptions)&&!isBaseUriOption&&!isWorkerUrlOption){if(key in deprecatedOptions){probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' no longer supported, use '").concat(deprecatedOptions[key],"'"))();}else if(!isSubOptions){var suggestion=findSimilarOption(key,loaders);probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' not recognized. ").concat(suggestion))();}}}}function findSimilarOption(optionKey,loaders){var lowerCaseOptionKey=optionKey.toLowerCase();var bestSuggestion='';var _iterator10=_createForOfIteratorHelper(loaders),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var loader=_step10.value;for(var key in loader.options){if(optionKey===key){return"Did you mean '".concat(loader.id,".").concat(key,"'?");}var lowerCaseKey=key.toLowerCase();var isPartialMatch=lowerCaseOptionKey.startsWith(lowerCaseKey)||lowerCaseKey.startsWith(lowerCaseOptionKey);if(isPartialMatch){bestSuggestion=bestSuggestion||"Did you mean '".concat(loader.id,".").concat(key,"'?");}}}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}return bestSuggestion;}function normalizeOptionsInternal(loader,options,url){var loaderDefaultOptions=loader.options||{};var mergedOptions=_objectSpread({},loaderDefaultOptions);addUrlOptions(mergedOptions,url);if(mergedOptions.log===null){mergedOptions.log=new NullLog();}mergeNestedFields(mergedOptions,getGlobalLoaderOptions());mergeNestedFields(mergedOptions,options);return mergedOptions;}function mergeNestedFields(mergedOptions,options){for(var key in options){if(key in options){var value=options[key];if(isPureObject(value)&&isPureObject(mergedOptions[key])){mergedOptions[key]=_objectSpread(_objectSpread({},mergedOptions[key]),options[key]);}else{mergedOptions[key]=options[key];}}}}function addUrlOptions(options,url){if(url&&!('baseUri'in options)){options.baseUri=url;}}function isLoaderObject(loader){var _loader;if(!loader){return false;}if(Array.isArray(loader)){loader=loader[0];}var hasExtensions=Array.isArray((_loader=loader)===null||_loader===void 0?void 0:_loader.extensions);return hasExtensions;}function normalizeLoader(loader){var _loader2,_loader3;assert$5(loader,'null loader');assert$5(isLoaderObject(loader),'invalid loader');var options;if(Array.isArray(loader)){options=loader[1];loader=loader[0];loader=_objectSpread(_objectSpread({},loader),{},{options:_objectSpread(_objectSpread({},loader.options),options)});}if((_loader2=loader)!==null&&_loader2!==void 0&&_loader2.parseTextSync||(_loader3=loader)!==null&&_loader3!==void 0&&_loader3.parseText){loader.text=true;}if(!loader.text){loader.binary=true;}return loader;}var getGlobalLoaderRegistry=function getGlobalLoaderRegistry(){var state=getGlobalLoaderState();state.loaderRegistry=state.loaderRegistry||[];return state.loaderRegistry;};function getRegisteredLoaders(){return getGlobalLoaderRegistry();}var log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x24){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(data){var loaders,options,context,loader,_args13=arguments;return _regenerator().w(function(_context20){while(1)switch(_context20.n){case 0:loaders=_args13.length>1&&_args13[1]!==undefined?_args13[1]:[];options=_args13.length>2?_args13[2]:undefined;context=_args13.length>3?_args13[3]:undefined;if(validHTTPResponse(data)){_context20.n=1;break;}return _context20.a(2,null);case 1:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context20.n=2;break;}return _context20.a(2,loader);case 2:if(!isBlob(data)){_context20.n=4;break;}_context20.n=3;return data.slice(0,10).arrayBuffer();case 3:data=_context20.v;loader=selectLoaderSync(data,loaders,options,context);case 4:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context20.n=5;break;}throw new Error(getNoValidLoaderMessage(data));case 5:return _context20.a(2,loader);}},_callee17);}));return _selectLoader.apply(this,arguments);}function selectLoaderSync(data){var loaders=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var options=arguments.length>2?arguments[2]:undefined;var context=arguments.length>3?arguments[3]:undefined;if(!validHTTPResponse(data)){return null;}if(loaders&&!Array.isArray(loaders)){return normalizeLoader(loaders);}var candidateLoaders=[];if(loaders){candidateLoaders=candidateLoaders.concat(loaders);}if(!(options!==null&&options!==void 0&&options.ignoreRegisteredLoaders)){var _candidateLoaders;(_candidateLoaders=candidateLoaders).push.apply(_candidateLoaders,_toConsumableArray(getRegisteredLoaders()));}normalizeLoaders(candidateLoaders);var loader=selectLoaderInternal(data,candidateLoaders,options,context);if(!loader&&!(options!==null&&options!==void 0&&options.nothrow)){throw new Error(getNoValidLoaderMessage(data));}return loader;}function selectLoaderInternal(data,loaders,options,context){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var testUrl=stripQueryString(url)||(context===null||context===void 0?void 0:context.url);var loader=null;var reason='';if(options!==null&&options!==void 0&&options.mimeType){loader=findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.mimeType);reason="match forced by supplied MIME type ".concat(options===null||options===void 0?void 0:options.mimeType);}loader=loader||findLoaderByUrl(loaders,testUrl);reason=reason||(loader?"matched url ".concat(testUrl):'');loader=loader||findLoaderByMIMEType(loaders,type);reason=reason||(loader?"matched MIME type ".concat(type):'');loader=loader||findLoaderByInitialBytes(loaders,data);reason=reason||(loader?"matched initial data ".concat(getFirstCharacters(data)):'');loader=loader||findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.fallbackMimeType);reason=reason||(loader?"matched fallback MIME type ".concat(type):'');if(reason){var _loader;log.log(1,"selectLoader selected ".concat((_loader=loader)===null||_loader===void 0?void 0:_loader.name,": ").concat(reason,"."));}return loader;}function validHTTPResponse(data){if(data instanceof Response){if(data.status===204){return false;}}return true;}function getNoValidLoaderMessage(data){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var message='No valid loader found (';message+=url?"".concat(filename(url),", "):'no url provided, ';message+="MIME type: ".concat(type?"\"".concat(type,"\""):'not provided',", ");var firstCharacters=data?getFirstCharacters(data):'';message+=firstCharacters?" first bytes: \"".concat(firstCharacters,"\""):'first bytes: not available';message+=')';return message;}function normalizeLoaders(loaders){var _iterator11=_createForOfIteratorHelper(loaders),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var loader=_step11.value;normalizeLoader(loader);}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}function findLoaderByUrl(loaders,url){var match=url&&EXT_PATTERN.exec(url);var extension=match&&match[1];return extension?findLoaderByExtension(loaders,extension):null;}function findLoaderByExtension(loaders,extension){extension=extension.toLowerCase();var _iterator12=_createForOfIteratorHelper(loaders),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var loader=_step12.value;var _iterator13=_createForOfIteratorHelper(loader.extensions),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var loaderExtension=_step13.value;if(loaderExtension.toLowerCase()===extension){return loader;}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return null;}function findLoaderByMIMEType(loaders,mimeType){var _iterator14=_createForOfIteratorHelper(loaders),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var loader=_step14.value;if(loader.mimeTypes&&loader.mimeTypes.includes(mimeType)){return loader;}if(mimeType==="application/x.".concat(loader.id)){return loader;}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}return null;}function findLoaderByInitialBytes(loaders,data){if(!data){return null;}var _iterator15=_createForOfIteratorHelper(loaders),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var loader=_step15.value;if(typeof data==='string'){if(testDataAgainstText(data,loader)){return loader;}}else if(ArrayBuffer.isView(data)){if(testDataAgainstBinary(data.buffer,data.byteOffset,loader)){return loader;}}else if(data instanceof ArrayBuffer){var byteOffset=0;if(testDataAgainstBinary(data,byteOffset,loader)){return loader;}}}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}return null;}function testDataAgainstText(data,loader){if(loader.testText){return loader.testText(data);}var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return data.startsWith(test);});}function testDataAgainstBinary(data,byteOffset,loader){var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return testBinary(data,byteOffset,loader,test);});}function testBinary(data,byteOffset,loader,test){if(test instanceof ArrayBuffer){return compareArrayBuffers(test,data,test.byteLength);}switch(_typeof2(test)){case'function':return test(data,loader);case'string':var magic=getMagicString$1(data,byteOffset,test.length);return test===magic;default:return false;}}function getFirstCharacters(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i456=0;_i456<length;_i456++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i456));}return magic;}var DEFAULT_CHUNK_SIZE$2=256*1024;function makeStringIterator(string,options){var chunkSize,offset,textEncoder,chunkLength,chunk;return _regenerator().w(function(_context5){while(1)switch(_context5.n){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE$2;offset=0;textEncoder=new TextEncoder();case 1:if(!(offset<string.length)){_context5.n=3;break;}chunkLength=Math.min(string.length-offset,chunkSize);chunk=string.slice(offset,offset+chunkLength);offset+=chunkLength;_context5.n=2;return textEncoder.encode(chunk);case 2:_context5.n=1;break;case 3:return _context5.a(2);}},_marked);}var DEFAULT_CHUNK_SIZE$1=256*1024;function makeArrayBufferIterator(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return/*#__PURE__*/_regenerator().m(function _callee4(){var _options$chunkSize,chunkSize,byteOffset,chunkByteLength,chunk,sourceArray,_chunkArray;return _regenerator().w(function(_context6){while(1)switch(_context6.n){case 0:_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 1:if(!(byteOffset<arrayBuffer.byteLength)){_context6.n=3;break;}chunkByteLength=Math.min(arrayBuffer.byteLength-byteOffset,chunkSize);chunk=new ArrayBuffer(chunkByteLength);sourceArray=new Uint8Array(arrayBuffer,byteOffset,chunkByteLength);_chunkArray=new Uint8Array(chunk);_chunkArray.set(sourceArray);byteOffset+=chunkByteLength;_context6.n=2;return chunk;case 2:_context6.n=1;break;case 3:return _context6.a(2);}},_callee4);})();}var DEFAULT_CHUNK_SIZE=1024*1024;function makeBlobIterator(_x,_x2){return _makeBlobIterator.apply(this,arguments);}function _makeBlobIterator(){_makeBlobIterator=_wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee5(blob,options){var chunkSize,offset,end,chunk;return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE;offset=0;case 1:if(!(offset<blob.size)){_context7.n=4;break;}end=offset+chunkSize;_context7.n=2;return _awaitAsyncGenerator(blob.slice(offset,end).arrayBuffer());case 2:chunk=_context7.v;offset=end;_context7.n=3;return chunk;case 3:_context7.n=1;break;case 4:return _context7.a(2);}},_callee5);}));return _makeBlobIterator.apply(this,arguments);}function makeStreamIterator(stream,options){return isBrowser$2?makeBrowserStreamIterator(stream,options):makeNodeStreamIterator(stream);}function makeBrowserStreamIterator(_x3,_x4){return _makeBrowserStreamIterator.apply(this,arguments);}function _makeBrowserStreamIterator(){_makeBrowserStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee6(stream,options){var reader,nextBatchPromise,currentBatchPromise,_yield$_awaitAsyncGen,done,value,_t2;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:reader=stream.getReader();_context8.p=1;case 2:if(false)// removed by dead control flow
|
|
25007
|
-
{}currentBatchPromise=nextBatchPromise||reader.read();if(options!==null&&options!==void 0&&options._streamReadAhead){nextBatchPromise=reader.read();}_context8.n=3;return _awaitAsyncGenerator(currentBatchPromise);case 3:_yield$_awaitAsyncGen=_context8.v;done=_yield$_awaitAsyncGen.done;value=_yield$_awaitAsyncGen.value;if(!done){_context8.n=4;break;}return _context8.a(2);case 4:_context8.n=5;return toArrayBuffer(value);case 5:_context8.n=2;break;case 6:_context8.n=8;break;case 7:_context8.p=7;_t2=_context8.v;reader.releaseLock();case 8:return _context8.a(2);}},_callee6,null,[[1,7]]);}));return _makeBrowserStreamIterator.apply(this,arguments);}function makeNodeStreamIterator(_x5,_x6){return _makeNodeStreamIterator.apply(this,arguments);}function _makeNodeStreamIterator(){_makeNodeStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee7(stream,options){var _iteratorAbruptCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,chunk,_t3;return _regenerator().w(function(_context9){while(1)switch(_context9.p=_context9.n){case 0:_iteratorAbruptCompletion2=false;_didIteratorError2=false;_context9.p=1;_iterator2=_asyncIterator(stream);case 2:_context9.n=3;return _awaitAsyncGenerator(_iterator2.next());case 3:if(!(_iteratorAbruptCompletion2=!(_step2=_context9.v).done)){_context9.n=5;break;}chunk=_step2.value;_context9.n=4;return toArrayBuffer(chunk);case 4:_iteratorAbruptCompletion2=false;_context9.n=2;break;case 5:_context9.n=7;break;case 6:_context9.p=6;_t3=_context9.v;_didIteratorError2=true;_iteratorError2=_t3;case 7:_context9.p=7;_context9.p=8;if(!(_iteratorAbruptCompletion2&&_iterator2["return"]!=null)){_context9.n=9;break;}_context9.n=9;return _awaitAsyncGenerator(_iterator2["return"]());case 9:_context9.p=9;if(!_didIteratorError2){_context9.n=10;break;}throw _iteratorError2;case 10:return _context9.f(9);case 11:return _context9.f(7);case 12:return _context9.a(2);}},_callee7,null,[[8,,9,11],[1,6,7,12]]);}));return _makeNodeStreamIterator.apply(this,arguments);}function makeIterator(data,options){if(typeof data==='string'){return makeStringIterator(data,options);}if(data instanceof ArrayBuffer){return makeArrayBufferIterator(data,options);}if(isBlob(data)){return makeBlobIterator(data,options);}if(isReadableStream(data)){return makeStreamIterator(data,options);}if(isResponse(data)){var response=data;return makeStreamIterator(response.body,options);}throw new Error('makeIterator');}var ERR_DATA='Cannot convert supplied data type';function getArrayBufferOrStringFromDataSync(data,loader,options){if(loader.text&&typeof data==='string'){return data;}if(isBuffer(data)){data=data.buffer;}if(data instanceof ArrayBuffer){var arrayBuffer=data;if(loader.text&&!loader.binary){var textDecoder=new TextDecoder('utf8');return textDecoder.decode(arrayBuffer);}return arrayBuffer;}if(ArrayBuffer.isView(data)){if(loader.text&&!loader.binary){var _textDecoder=new TextDecoder('utf8');return _textDecoder.decode(data);}var _arrayBuffer=data.buffer;var byteLength=data.byteLength||data.length;if(data.byteOffset!==0||byteLength!==_arrayBuffer.byteLength){_arrayBuffer=_arrayBuffer.slice(data.byteOffset,data.byteOffset+byteLength);}return _arrayBuffer;}throw new Error(ERR_DATA);}function getArrayBufferOrStringFromData(_x25,_x26,_x27){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(data,loader,options){var isArrayBuffer,response,_t17;return _regenerator().w(function(_context21){while(1)switch(_context21.n){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context21.n=1;break;}return _context21.a(2,getArrayBufferOrStringFromDataSync(data,loader));case 1:if(!isBlob(data)){_context21.n=3;break;}_context21.n=2;return makeResponse(data);case 2:data=_context21.v;case 3:if(!isResponse(data)){_context21.n=9;break;}response=data;_context21.n=4;return checkResponse(response);case 4:if(!loader.binary){_context21.n=6;break;}_context21.n=5;return response.arrayBuffer();case 5:_t17=_context21.v;_context21.n=8;break;case 6:_context21.n=7;return response.text();case 7:_t17=_context21.v;case 8:return _context21.a(2,_t17);case 9:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context21.n=10;break;}return _context21.a(2,concatenateArrayBuffersAsync(data));case 10:throw new Error(ERR_DATA);case 11:return _context21.a(2);}},_callee18);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var fetchOptions=options||globalOptions;if(typeof fetchOptions.fetch==='function'){return fetchOptions.fetch;}if(isObject(fetchOptions.fetch)){return function(url){return fetchFile(url,fetchOptions);};}if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}return fetchFile;}function getLoaderContext(context,options,parentContext){if(parentContext){return parentContext;}var newContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(newContext.url){var baseUrl=stripQueryString(newContext.url);newContext.baseUrl=baseUrl;newContext.queryString=extractQueryString(newContext.url);newContext.filename=filename(baseUrl);newContext.baseUrl=dirname(baseUrl);}if(!Array.isArray(newContext.loaders)){newContext.loaders=null;}return newContext;}function getLoadersFromContext(loaders,context){if(!context&&loaders&&!Array.isArray(loaders)){return loaders;}var candidateLoaders;if(loaders){candidateLoaders=Array.isArray(loaders)?loaders:[loaders];}if(context&&context.loaders){var contextLoaders=Array.isArray(context.loaders)?context.loaders:[context.loaders];candidateLoaders=candidateLoaders?[].concat(_toConsumableArray(candidateLoaders),_toConsumableArray(contextLoaders)):contextLoaders;}return candidateLoaders&&candidateLoaders.length?candidateLoaders:null;}function parse$2(_x28,_x29,_x30,_x31){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regenerator().w(function(_context22){while(1)switch(_context22.n){case 0:assert$4(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context22.n=1;return data;case 1:data=_context22.v;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context22.n=2;return selectLoader(data,candidateLoaders,options);case 2:loader=_context22.v;if(loader){_context22.n=3;break;}return _context22.a(2,null);case 3:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context22.n=4;return parseWithLoader(loader,data,options,context);case 4:return _context22.a(2,_context22.v);}},_callee19);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x32,_x33,_x34,_x35){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regenerator().w(function(_context23){while(1)switch(_context23.n){case 0:validateWorkerVersion(loader);if(isResponse(data)){response=data;ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;headers=Object.fromEntries(response.headers.entries());context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context23.n=1;return getArrayBufferOrStringFromData(data,loader,options);case 1:data=_context23.v;if(!(loader.parseTextSync&&typeof data==='string')){_context23.n=2;break;}options.dataType='text';return _context23.a(2,loader.parseTextSync(data,options,context,loader));case 2:if(!canParseWithWorker(loader,options)){_context23.n=4;break;}_context23.n=3;return parseWithWorker(loader,data,options,context,parse$2);case 3:return _context23.a(2,_context23.v);case 4:if(!(loader.parseText&&typeof data==='string')){_context23.n=6;break;}_context23.n=5;return loader.parseText(data,options,context,loader);case 5:return _context23.a(2,_context23.v);case 6:if(!loader.parse){_context23.n=8;break;}_context23.n=7;return loader.parse(data,options,context,loader);case 7:return _context23.a(2,_context23.v);case 8:assert$4(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 9:return _context23.a(2);}},_callee20);}));return _parseWithLoader.apply(this,arguments);}var VERSION$5="3.4.15";var VERSION$4="3.4.15";var VERSION$3="3.4.15";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/dist/libs/basis_encoder.js");var loadBasisTranscoderPromise;function loadBasisTrascoderModule(_x36){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(options){var modules;return _regenerator().w(function(_context24){while(1)switch(_context24.n){case 0:modules=options.modules||{};if(!modules.basis){_context24.n=1;break;}return _context24.a(2,modules.basis);case 1:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context24.n=2;return loadBasisTranscoderPromise;case 2:return _context24.a(2,_context24.v);}},_callee21);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x37){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2,_t18,_t19,_t20;return _regenerator().w(function(_context25){while(1)switch(_context25.n){case 0:BASIS=null;wasmBinary=null;_t18=Promise;_context25.n=1;return loadLibrary('basis_transcoder.js','textures',options);case 1:_t19=_context25.v;_context25.n=2;return loadLibrary('basis_transcoder.wasm','textures',options);case 2:_t20=_context25.v;_context25.n=3;return _t18.all.call(_t18,[_t19,_t20]);case 3:_yield$Promise$all=_context25.v;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context25.n=4;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 4:return _context25.a(2,_context25.v);}},_callee22);}));return _loadBasisTrascoder.apply(this,arguments);}function initializeBasisTrascoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;function loadBasisEncoderModule(_x38){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(options){var modules;return _regenerator().w(function(_context26){while(1)switch(_context26.n){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context26.n=1;break;}return _context26.a(2,modules.basisEncoder);case 1:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context26.n=2;return loadBasisEncoderPromise;case 2:return _context26.a(2,_context26.v);}},_callee23);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x39){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4,_t21,_t22,_t23;return _regenerator().w(function(_context27){while(1)switch(_context27.n){case 0:BASIS_ENCODER=null;wasmBinary=null;_t21=Promise;_context27.n=1;return loadLibrary(BASIS_CDN_ENCODER_JS,'textures',options);case 1:_t22=_context27.v;_context27.n=2;return loadLibrary(BASIS_CDN_ENCODER_WASM,'textures',options);case 2:_t23=_context27.v;_context27.n=3;return _t21.all.call(_t21,[_t22,_t23]);case 3:_yield$Promise$all3=_context27.v;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS_ENCODER=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context27.n=4;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 4:return _context27.a(2,_context27.v);}},_callee24);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisEncoderModule(options).then(function(module){var BasisFile=module.BasisFile,KTX2File=module.KTX2File,initializeBasis=module.initializeBasis,BasisEncoder=module.BasisEncoder;initializeBasis();resolve({BasisFile:BasisFile,KTX2File:KTX2File,BasisEncoder:BasisEncoder});});});}var GL_EXTENSIONS_CONSTANTS={COMPRESSED_RGB_S3TC_DXT1_EXT:0x83f0,COMPRESSED_RGBA_S3TC_DXT1_EXT:0x83f1,COMPRESSED_RGBA_S3TC_DXT3_EXT:0x83f2,COMPRESSED_RGBA_S3TC_DXT5_EXT:0x83f3,COMPRESSED_R11_EAC:0x9270,COMPRESSED_SIGNED_R11_EAC:0x9271,COMPRESSED_RG11_EAC:0x9272,COMPRESSED_SIGNED_RG11_EAC:0x9273,COMPRESSED_RGB8_ETC2:0x9274,COMPRESSED_RGBA8_ETC2_EAC:0x9275,COMPRESSED_SRGB8_ETC2:0x9276,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:0x9277,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9278,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9279,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:0x8c00,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:0x8c02,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:0x8c01,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:0x8c03,COMPRESSED_RGB_ETC1_WEBGL:0x8d64,COMPRESSED_RGB_ATC_WEBGL:0x8c92,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:0x8c93,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:0x87ee,COMPRESSED_RGBA_ASTC_4X4_KHR:0x93b0,COMPRESSED_RGBA_ASTC_5X4_KHR:0x93b1,COMPRESSED_RGBA_ASTC_5X5_KHR:0x93b2,COMPRESSED_RGBA_ASTC_6X5_KHR:0x93b3,COMPRESSED_RGBA_ASTC_6X6_KHR:0x93b4,COMPRESSED_RGBA_ASTC_8X5_KHR:0x93b5,COMPRESSED_RGBA_ASTC_8X6_KHR:0x93b6,COMPRESSED_RGBA_ASTC_8X8_KHR:0x93b7,COMPRESSED_RGBA_ASTC_10X5_KHR:0x93b8,COMPRESSED_RGBA_ASTC_10X6_KHR:0x93b9,COMPRESSED_RGBA_ASTC_10X8_KHR:0x93ba,COMPRESSED_RGBA_ASTC_10X10_KHR:0x93bb,COMPRESSED_RGBA_ASTC_12X10_KHR:0x93bc,COMPRESSED_RGBA_ASTC_12X12_KHR:0x93bd,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:0x93d0,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:0x93d1,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:0x93d2,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:0x93d3,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:0x93d4,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:0x93d5,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:0x93d6,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:0x93d7,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:0x93d8,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:0x93d9,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:0x93da,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:0x93db,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:0x93dc,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:0x93dd,COMPRESSED_RED_RGTC1_EXT:0x8dbb,COMPRESSED_SIGNED_RED_RGTC1_EXT:0x8dbc,COMPRESSED_RED_GREEN_RGTC2_EXT:0x8dbd,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:0x8dbe,COMPRESSED_SRGB_S3TC_DXT1_EXT:0x8c4c,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:0x8c4d,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:0x8c4e,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:0x8c4f};var BROWSER_PREFIXES=['','WEBKIT_','MOZ_'];var WEBGL_EXTENSIONS={WEBGL_compressed_texture_s3tc:'dxt',WEBGL_compressed_texture_s3tc_srgb:'dxt-srgb',WEBGL_compressed_texture_etc1:'etc1',WEBGL_compressed_texture_etc:'etc2',WEBGL_compressed_texture_pvrtc:'pvrtc',WEBGL_compressed_texture_atc:'atc',WEBGL_compressed_texture_astc:'astc',EXT_texture_compression_rgtc:'rgtc'};var formats=null;function getSupportedGPUTextureFormats(gl){if(!formats){gl=gl||getWebGLContext()||undefined;formats=new Set();var _iterator16=_createForOfIteratorHelper(BROWSER_PREFIXES),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var prefix=_step16.value;for(var extension in WEBGL_EXTENSIONS){if(gl&&gl.getExtension("".concat(prefix).concat(extension))){var gpuTextureFormat=WEBGL_EXTENSIONS[extension];formats.add(gpuTextureFormat);}}}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}}return formats;}function getWebGLContext(){try{var canvas=document.createElement('canvas');return canvas.getContext('webgl');}catch(error){return null;}}var n,i,s,a,r,o,l,f;!function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB";}(n||(n={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT";}(i||(i={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC";}(s||(s={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB";}(a||(a={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2";}(r||(r={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED";}(o||(o={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA";}(l||(l={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG";}(f||(f={}));var KTX2_ID=[0xab,0x4b,0x54,0x58,0x20,0x32,0x30,0xbb,0x0d,0x0a,0x1a,0x0a];function isKTX(data){var id=new Uint8Array(data);var notKTX=id.byteLength<KTX2_ID.length||id[0]!==KTX2_ID[0]||id[1]!==KTX2_ID[1]||id[2]!==KTX2_ID[2]||id[3]!==KTX2_ID[3]||id[4]!==KTX2_ID[4]||id[5]!==KTX2_ID[5]||id[6]!==KTX2_ID[6]||id[7]!==KTX2_ID[7]||id[8]!==KTX2_ID[8]||id[9]!==KTX2_ID[9]||id[10]!==KTX2_ID[10]||id[11]!==KTX2_ID[11];return!notKTX;}var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:true},bc1:{basisFormat:2,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:true},bc5:{basisFormat:5,compressed:true},'bc7-m6-opaque-only':{basisFormat:6,compressed:true},'bc7-m5':{basisFormat:7,compressed:true},'pvrtc1-4-rgb':{basisFormat:8,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},'pvrtc1-4-rgba':{basisFormat:9,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},'astc-4x4':{basisFormat:10,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR},'atc-rgb':{basisFormat:11,compressed:true},'atc-rgba-interpolated-alpha':{basisFormat:12,compressed:true},rgba32:{basisFormat:13,compressed:false},rgb565:{basisFormat:14,compressed:false},bgr565:{basisFormat:15,compressed:false},rgba4444:{basisFormat:16,compressed:false}};function parseBasis(_x40,_x41){return _parseBasis.apply(this,arguments);}function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(data,options){var fileConstructors,_yield$loadBasisTrasc,BasisFile,_fileConstructors,_yield$loadBasisTrasc2,_BasisFile,_t24,_t25;return _regenerator().w(function(_context28){while(1)switch(_context28.n){case 0:if(!(options.basis.containerFormat==='auto')){_context28.n=4;break;}if(!isKTX(data)){_context28.n=2;break;}_context28.n=1;return loadBasisEncoderModule(options);case 1:fileConstructors=_context28.v;return _context28.a(2,parseKTX2File(fileConstructors.KTX2File,data,options));case 2:_context28.n=3;return loadBasisTrascoderModule(options);case 3:_yield$loadBasisTrasc=_context28.v;BasisFile=_yield$loadBasisTrasc.BasisFile;return _context28.a(2,parseBasisFile(BasisFile,data,options));case 4:_t24=options.basis.module;_context28.n=_t24==='encoder'?5:_t24==='transcoder'?9:9;break;case 5:_context28.n=6;return loadBasisEncoderModule(options);case 6:_fileConstructors=_context28.v;_t25=options.basis.containerFormat;_context28.n=_t25==='ktx2'?7:_t25==='basis'?8:8;break;case 7:return _context28.a(2,parseKTX2File(_fileConstructors.KTX2File,data,options));case 8:return _context28.a(2,parseBasisFile(_fileConstructors.BasisFile,data,options));case 9:_context28.n=10;return loadBasisTrascoderModule(options);case 10:_yield$loadBasisTrasc2=_context28.v;_BasisFile=_yield$loadBasisTrasc2.BasisFile;return _context28.a(2,parseBasisFile(_BasisFile,data,options));case 11:return _context28.a(2);}},_callee25);}));return _parseBasis.apply(this,arguments);}function parseBasisFile(BasisFile,data,options){var basisFile=new BasisFile(new Uint8Array(data));try{if(!basisFile.startTranscoding()){throw new Error('Failed to start basis transcoding');}var imageCount=basisFile.getNumImages();var images=[];for(var imageIndex=0;imageIndex<imageCount;imageIndex++){var levelsCount=basisFile.getNumLevels(imageIndex);var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeImage(basisFile,imageIndex,levelIndex,options));}images.push(levels);}return images;}finally{basisFile.close();basisFile["delete"]();}}function transcodeImage(basisFile,imageIndex,levelIndex,options){var width=basisFile.getImageWidth(imageIndex,levelIndex);var height=basisFile.getImageHeight(imageIndex,levelIndex);var hasAlpha=basisFile.getHasAlpha();var _getBasisOptions=getBasisOptions(options,hasAlpha),compressed=_getBasisOptions.compressed,format=_getBasisOptions.format,basisFormat=_getBasisOptions.basisFormat;var decodedSize=basisFile.getImageTranscodedSizeInBytes(imageIndex,levelIndex,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!basisFile.transcodeImage(decodedData,imageIndex,levelIndex,basisFormat,0,0)){throw new Error('failed to start Basis transcoding');}return{width:width,height:height,data:decodedData,compressed:compressed,format:format,hasAlpha:hasAlpha};}function parseKTX2File(KTX2File,data,options){var ktx2File=new KTX2File(new Uint8Array(data));try{if(!ktx2File.startTranscoding()){throw new Error('failed to start KTX2 transcoding');}var levelsCount=ktx2File.getLevels();var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeKTX2Image(ktx2File,levelIndex,options));break;}return[levels];}finally{ktx2File.close();ktx2File["delete"]();}}function transcodeKTX2Image(ktx2File,levelIndex,options){var _ktx2File$getImageLev=ktx2File.getImageLevelInfo(levelIndex,0,0),alphaFlag=_ktx2File$getImageLev.alphaFlag,height=_ktx2File$getImageLev.height,width=_ktx2File$getImageLev.width;var _getBasisOptions2=getBasisOptions(options,alphaFlag),compressed=_getBasisOptions2.compressed,format=_getBasisOptions2.format,basisFormat=_getBasisOptions2.basisFormat;var decodedSize=ktx2File.getImageTranscodedSizeInBytes(levelIndex,0,0,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!ktx2File.transcodeImage(decodedData,levelIndex,0,0,basisFormat,0,-1,-1)){throw new Error('Failed to transcode KTX2 image');}return{width:width,height:height,data:decodedData,compressed:compressed,levelSize:decodedSize,hasAlpha:alphaFlag,format:format};}function getBasisOptions(options,hasAlpha){var format=options&&options.basis&&options.basis.format;if(format==='auto'){format=selectSupportedBasisFormat();}if(_typeof2(format)==='object'){format=hasAlpha?format.alpha:format.noAlpha;}format=format.toLowerCase();return OutputFormat[format];}function selectSupportedBasisFormat(){var supportedFormats=getSupportedGPUTextureFormats();if(supportedFormats.has('astc')){return'astc-4x4';}else if(supportedFormats.has('dxt')){return{alpha:'bc3',noAlpha:'bc1'};}else if(supportedFormats.has('pvrtc')){return{alpha:'pvrtc1-4-rgba',noAlpha:'pvrtc1-4-rgb'};}else if(supportedFormats.has('etc1')){return'etc1';}else if(supportedFormats.has('etc2')){return'etc2';}return'rgb565';}var BasisWorkerLoader={name:'Basis',id:isBrowser$1?'basis':'basis-nodejs',module:'textures',version:VERSION$4,worker:true,extensions:['basis','ktx2'],mimeTypes:['application/octet-stream','image/ktx2'],tests:['sB'],binary:true,options:{basis:{format:'auto',libraryPath:'libs/',containerFormat:'auto',module:'transcoder'}}};var BasisLoader=_objectSpread(_objectSpread({},BasisWorkerLoader),{},{parse:parseBasis});var VERSION$2="3.4.15";var _parseImageNode=globalThis._parseImageNode;var IMAGE_SUPPORTED=typeof Image!=='undefined';var IMAGE_BITMAP_SUPPORTED=typeof ImageBitmap!=='undefined';var NODE_IMAGE_SUPPORTED=Boolean(_parseImageNode);var DATA_SUPPORTED=isBrowser$2?true:NODE_IMAGE_SUPPORTED;function isImageTypeSupported(type){switch(type){case'auto':return IMAGE_BITMAP_SUPPORTED||IMAGE_SUPPORTED||DATA_SUPPORTED;case'imagebitmap':return IMAGE_BITMAP_SUPPORTED;case'image':return IMAGE_SUPPORTED;case'data':return DATA_SUPPORTED;default:throw new Error("@loaders.gl/images: image ".concat(type," not supported in this environment"));}}function getDefaultImageType(){if(IMAGE_BITMAP_SUPPORTED){return'imagebitmap';}if(IMAGE_SUPPORTED){return'image';}if(DATA_SUPPORTED){return'data';}throw new Error('Install \'@loaders.gl/polyfills\' to parse images under Node.js');}function getImageType(image){var format=getImageTypeOrNull(image);if(!format){throw new Error('Not an image');}return format;}function getImageData(image){switch(getImageType(image)){case'data':return image;case'image':case'imagebitmap':var _canvas6=document.createElement('canvas');var context=_canvas6.getContext('2d');if(!context){throw new Error('getImageData');}_canvas6.width=image.width;_canvas6.height=image.height;context.drawImage(image,0,0);return context.getImageData(0,0,image.width,image.height);default:throw new Error('getImageData');}}function getImageTypeOrNull(image){if(typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){return'imagebitmap';}if(typeof Image!=='undefined'&&image instanceof Image){return'image';}if(image&&_typeof2(image)==='object'&&image.data&&image.width&&image.height){return'data';}return null;}var SVG_DATA_URL_PATTERN=/^data:image\/svg\+xml/;var SVG_URL_PATTERN=/\.svg((\?|#).*)?$/;function isSVG(url){return url&&(SVG_DATA_URL_PATTERN.test(url)||SVG_URL_PATTERN.test(url));}function getBlobOrSVGDataUrl(arrayBuffer,url){if(isSVG(url)){var textDecoder=new TextDecoder();var xmlText=textDecoder.decode(arrayBuffer);try{if(typeof unescape==='function'&&typeof encodeURIComponent==='function'){xmlText=unescape(encodeURIComponent(xmlText));}}catch(error){throw new Error(error.message);}var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return getBlob(arrayBuffer,url);}function getBlob(arrayBuffer,url){if(isSVG(url)){throw new Error('SVG cannot be parsed directly to imagebitmap');}return new Blob([new Uint8Array(arrayBuffer)]);}function parseToImage(_x42,_x43,_x44){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regenerator().w(function(_context29){while(1)switch(_context29.p=_context29.n){case 0:blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context29.p=1;_context29.n=2;return loadToImage(objectUrl||blobOrDataUrl,options);case 2:return _context29.a(2,_context29.v);case 3:_context29.p=3;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context29.f(3);case 4:return _context29.a(2);}},_callee26,null,[[1,,3,4]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x45,_x46){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(url,options){var image;return _regenerator().w(function(_context30){while(1)switch(_context30.n){case 0:image=new Image();image.src=url;if(!(options.image&&options.image.decode&&image.decode)){_context30.n=2;break;}_context30.n=1;return image.decode();case 1:return _context30.a(2,image);case 2:_context30.n=3;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(err){return reject(new Error("Could not load image ".concat(url,": ").concat(err)));};}catch(error){reject(error);}});case 3:return _context30.a(2,_context30.v);}},_callee27);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;function parseToImageBitmap(_x47,_x48,_x49){return _parseToImageBitmap.apply(this,arguments);}function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regenerator().w(function(_context31){while(1)switch(_context31.n){case 0:if(!isSVG(url)){_context31.n=2;break;}_context31.n=1;return parseToImage(arrayBuffer,options,url);case 1:_image7=_context31.v;blob=_image7;_context31.n=3;break;case 2:blob=getBlob(arrayBuffer,url);case 3:imagebitmapOptions=options&&options.imagebitmap;_context31.n=4;return safeCreateImageBitmap(blob,imagebitmapOptions);case 4:return _context31.a(2,_context31.v);}},_callee28);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x50){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(blob){var imagebitmapOptions,_args25=arguments,_t26;return _regenerator().w(function(_context32){while(1)switch(_context32.p=_context32.n){case 0:imagebitmapOptions=_args25.length>1&&_args25[1]!==undefined?_args25[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context32.n=4;break;}_context32.p=1;_context32.n=2;return createImageBitmap(blob,imagebitmapOptions);case 2:return _context32.a(2,_context32.v);case 3:_context32.p=3;_t26=_context32.v;console.warn(_t26);imagebitmapOptionsSupported=false;case 4:_context32.n=5;return createImageBitmap(blob);case 5:return _context32.a(2,_context32.v);}},_callee29,null,[[1,3]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){return false;}return true;}function getISOBMFFMediaType(buffer){if(!checkString(buffer,'ftyp',4)){return null;}if((buffer[8]&0x60)===0x00){return null;}return decodeMajorBrand(buffer);}function decodeMajorBrand(buffer){var brandMajor=getUTF8String(buffer,8,12).replace('\0',' ').trim();switch(brandMajor){case'avif':case'avis':return{extension:'avif',mimeType:'image/avif'};default:return null;}}function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i457=0;_i457<headerBytes.length;++_i457){if(headerBytes[_i457]!==buffer[_i457+offset]){return false;}}return true;}var BIG_ENDIAN=false;var LITTLE_ENDIAN=true;function getBinaryImageMetadata(binaryData){var dataView=toDataView(binaryData);return getPngMetadata(dataView)||getJpegMetadata(dataView)||getGifMetadata(dataView)||getBmpMetadata(dataView)||getISOBMFFMetadata(dataView);}function getISOBMFFMetadata(binaryData){var buffer=new Uint8Array(binaryData instanceof DataView?binaryData.buffer:binaryData);var mediaType=getISOBMFFMediaType(buffer);if(!mediaType){return null;}return{mimeType:mediaType.mimeType,width:0,height:0};}function getPngMetadata(binaryData){var dataView=toDataView(binaryData);var isPng=dataView.byteLength>=24&&dataView.getUint32(0,BIG_ENDIAN)===0x89504e47;if(!isPng){return null;}return{mimeType:'image/png',width:dataView.getUint32(16,BIG_ENDIAN),height:dataView.getUint32(20,BIG_ENDIAN)};}function getGifMetadata(binaryData){var dataView=toDataView(binaryData);var isGif=dataView.byteLength>=10&&dataView.getUint32(0,BIG_ENDIAN)===0x47494638;if(!isGif){return null;}return{mimeType:'image/gif',width:dataView.getUint16(6,LITTLE_ENDIAN),height:dataView.getUint16(8,LITTLE_ENDIAN)};}function getBmpMetadata(binaryData){var dataView=toDataView(binaryData);var isBmp=dataView.byteLength>=14&&dataView.getUint16(0,BIG_ENDIAN)===0x424d&&dataView.getUint32(2,LITTLE_ENDIAN)===dataView.byteLength;if(!isBmp){return null;}return{mimeType:'image/bmp',width:dataView.getUint32(18,LITTLE_ENDIAN),height:dataView.getUint32(22,LITTLE_ENDIAN)};}function getJpegMetadata(binaryData){var dataView=toDataView(binaryData);var isJpeg=dataView.byteLength>=3&&dataView.getUint16(0,BIG_ENDIAN)===0xffd8&&dataView.getUint8(2)===0xff;if(!isJpeg){return null;}var _getJpegMarkers=getJpegMarkers(),tableMarkers=_getJpegMarkers.tableMarkers,sofMarkers=_getJpegMarkers.sofMarkers;var i=2;while(i+9<dataView.byteLength){var marker=dataView.getUint16(i,BIG_ENDIAN);if(sofMarkers.has(marker)){return{mimeType:'image/jpeg',height:dataView.getUint16(i+5,BIG_ENDIAN),width:dataView.getUint16(i+7,BIG_ENDIAN)};}if(!tableMarkers.has(marker)){return null;}i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i458=0xffe0;_i458<0xfff0;++_i458){tableMarkers.add(_i458);}var sofMarkers=new Set([0xffc0,0xffc1,0xffc2,0xffc3,0xffc5,0xffc6,0xffc7,0xffc9,0xffca,0xffcb,0xffcd,0xffce,0xffcf,0xffde]);return{tableMarkers:tableMarkers,sofMarkers:sofMarkers};}function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuffer.isView(data)){return new DataView(data.buffer);}if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}function parseToNodeImage(_x51,_x52){return _parseToNodeImage.apply(this,arguments);}function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(arrayBuffer,options){var _ref23,mimeType,_parseImageNode;return _regenerator().w(function(_context33){while(1)switch(_context33.n){case 0:_ref23=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref23.mimeType;_parseImageNode=globalThis._parseImageNode;assert$5(_parseImageNode);_context33.n=1;return _parseImageNode(arrayBuffer,mimeType);case 1:return _context33.a(2,_context33.v);}},_callee30);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x53,_x54,_x55){return _parseImage.apply(this,arguments);}function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(arrayBuffer,options,context){var imageOptions,imageType,_ref24,url,loadType,image,_t27;return _regenerator().w(function(_context34){while(1)switch(_context34.n){case 0:options=options||{};imageOptions=options.image||{};imageType=imageOptions.type||'auto';_ref24=context||{},url=_ref24.url;loadType=getLoadableImageType(imageType);_t27=loadType;_context34.n=_t27==='imagebitmap'?1:_t27==='image'?3:_t27==='data'?5:7;break;case 1:_context34.n=2;return parseToImageBitmap(arrayBuffer,options,url);case 2:image=_context34.v;return _context34.a(3,8);case 3:_context34.n=4;return parseToImage(arrayBuffer,options,url);case 4:image=_context34.v;return _context34.a(3,8);case 5:_context34.n=6;return parseToNodeImage(arrayBuffer);case 6:image=_context34.v;return _context34.a(3,8);case 7:assert$5(false);case 8:if(imageType==='data'){image=getImageData(image);}return _context34.a(2,image);}},_callee31);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':return getDefaultImageType();default:isImageTypeSupported(type);return type;}}var EXTENSIONS$1=['png','jpg','jpeg','gif','webp','bmp','ico','svg','avif'];var MIME_TYPES=['image/png','image/jpeg','image/gif','image/webp','image/avif','image/bmp','image/vnd.microsoft.icon','image/svg+xml'];var DEFAULT_IMAGE_LOADER_OPTIONS={image:{type:'auto',decode:true}};var ImageLoader={id:'image',module:'images',name:'Images',version:VERSION$2,mimeTypes:MIME_TYPES,extensions:EXTENSIONS$1,parse:parseImage,tests:[function(arrayBuffer){return Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)));}],options:DEFAULT_IMAGE_LOADER_OPTIONS};var mimeTypeSupportedSync={};function isImageFormatSupported(mimeType){if(mimeTypeSupportedSync[mimeType]===undefined){var supported=isBrowser$2?checkBrowserImageFormatSupport(mimeType):checkNodeImageFormatSupport(mimeType);mimeTypeSupportedSync[mimeType]=supported;}return mimeTypeSupportedSync[mimeType];}function checkNodeImageFormatSupport(mimeType){var NODE_FORMAT_SUPPORT=['image/png','image/jpeg','image/gif'];var _parseImageNode=globalThis._parseImageNode,_globalThis$_imageFor=globalThis._imageFormatsNode,_imageFormatsNode=_globalThis$_imageFor===void 0?NODE_FORMAT_SUPPORT:_globalThis$_imageFor;return Boolean(_parseImageNode)&&_imageFormatsNode.includes(mimeType);}function checkBrowserImageFormatSupport(mimeType){switch(mimeType){case'image/avif':case'image/webp':return testBrowserImageFormatSupport(mimeType);default:return true;}}function testBrowserImageFormatSupport(mimeType){try{var element=document.createElement('canvas');var dataURL=element.toDataURL(mimeType);return dataURL.indexOf("data:".concat(mimeType))===0;}catch(_unused){return false;}}function assert$2(condition,message){if(!condition){throw new Error(message||'assert failed: gltf');}}function resolveUrl(url,options){var absolute=url.startsWith('data:')||url.startsWith('http:')||url.startsWith('https:');if(absolute){return url;}var baseUrl=options.baseUri||options.uri;if(!baseUrl){throw new Error("'baseUri' must be provided to resolve relative url ".concat(url));}return baseUrl.substr(0,baseUrl.lastIndexOf('/')+1)+url;}function getTypedArrayForBufferView(json,buffers,bufferViewIndex){var bufferView=json.bufferViews[bufferViewIndex];assert$2(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$2(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}var TYPES=['SCALAR','VEC2','VEC3','VEC4'];var ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]];var ARRAY_TO_COMPONENT_TYPE=new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);var ATTRIBUTE_TYPE_TO_COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function getAccessorTypeFromSize(size){var type=TYPES[size-1];return type||TYPES[0];}function getComponentTypeFromArray(typedArray){var componentType=ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);if(!componentType){throw new Error('Illegal typed array');}return componentType;}function getAccessorArrayTypeAndLength(accessor,bufferView){var ArrayType=ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];var components=ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];var bytesPerComponent=ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];var length=accessor.count*components;var byteLength=accessor.count*components*bytesPerComponent;assert$2(byteLength>=0&&byteLength<=bufferView.byteLength);return{ArrayType:ArrayType,length:length,byteLength:byteLength};}var DEFAULT_GLTF_JSON={asset:{version:'2.0',generator:'loaders.gl'},buffers:[]};var GLTFScenegraph=/*#__PURE__*/function(){function GLTFScenegraph(gltf){_classCallCheck(this,GLTFScenegraph);_defineProperty(this,"gltf",void 0);_defineProperty(this,"sourceBuffers",void 0);_defineProperty(this,"byteLength",void 0);this.gltf=gltf||{json:_objectSpread({},DEFAULT_GLTF_JSON),buffers:[]};this.sourceBuffers=[];this.byteLength=0;if(this.gltf.buffers&&this.gltf.buffers[0]){this.byteLength=this.gltf.buffers[0].byteLength;this.sourceBuffers=[this.gltf.buffers[0]];}}return _createClass(GLTFScenegraph,[{key:"json",get:function get(){return this.gltf.json;}},{key:"getApplicationData",value:function getApplicationData(key){var data=this.json[key];return data;}},{key:"getExtraData",value:function getExtraData(key){var extras=this.json.extras||{};return extras[key];}},{key:"getExtension",value:function getExtension(extensionName){var isExtension=this.getUsedExtensions().find(function(name){return name===extensionName;});var extensions=this.json.extensions||{};return isExtension?extensions[extensionName]||true:null;}},{key:"getRequiredExtension",value:function getRequiredExtension(extensionName){var isRequired=this.getRequiredExtensions().find(function(name){return name===extensionName;});return isRequired?this.getExtension(extensionName):null;}},{key:"getRequiredExtensions",value:function getRequiredExtensions(){return this.json.extensionsRequired||[];}},{key:"getUsedExtensions",value:function getUsedExtensions(){return this.json.extensionsUsed||[];}},{key:"getRemovedExtensions",value:function getRemovedExtensions(){return this.json.extensionsRemoved||[];}},{key:"getObjectExtension",value:function getObjectExtension(object,extensionName){var extensions=object.extensions||{};return extensions[extensionName];}},{key:"getScene",value:function getScene(index){return this.getObject('scenes',index);}},{key:"getNode",value:function getNode(index){return this.getObject('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this.getObject('skins',index);}},{key:"getMesh",value:function getMesh(index){return this.getObject('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this.getObject('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this.getObject('accessors',index);}},{key:"getTexture",value:function getTexture(index){return this.getObject('textures',index);}},{key:"getSampler",value:function getSampler(index){return this.getObject('samplers',index);}},{key:"getImage",value:function getImage(index){return this.getObject('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this.getObject('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this.getObject('buffers',index);}},{key:"getObject",value:function getObject(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){throw new Error("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"getTypedArrayForBufferView",value:function getTypedArrayForBufferView(bufferView){bufferView=this.getBufferView(bufferView);var bufferIndex=bufferView.buffer;var binChunk=this.gltf.buffers[bufferIndex];assert$2(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"getTypedArrayForAccessor",value:function getTypedArrayForAccessor(accessor){accessor=this.getAccessor(accessor);var bufferView=this.getBufferView(accessor.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var _getAccessorArrayType=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType.ArrayType,length=_getAccessorArrayType.length;var byteOffset=bufferView.byteOffset+accessor.byteOffset;return new ArrayType(arrayBuffer,byteOffset,length);}},{key:"getTypedArrayForImageData",value:function getTypedArrayForImageData(image){image=this.getAccessor(image);var bufferView=this.getBufferView(image.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var byteOffset=bufferView.byteOffset||0;return new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"addApplicationData",value:function addApplicationData(key,data){this.json[key]=data;return this;}},{key:"addExtraData",value:function addExtraData(key,data){this.json.extras=this.json.extras||{};this.json.extras[key]=data;return this;}},{key:"addObjectExtension",value:function addObjectExtension(object,extensionName,data){object.extensions=object.extensions||{};object.extensions[extensionName]=data;this.registerUsedExtension(extensionName);return this;}},{key:"setObjectExtension",value:function setObjectExtension(object,extensionName,data){var extensions=object.extensions||{};extensions[extensionName]=data;}},{key:"removeObjectExtension",value:function removeObjectExtension(object,extensionName){var extensions=object.extensions||{};var extension=extensions[extensionName];delete extensions[extensionName];return extension;}},{key:"addExtension",value:function addExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$2(extensionData);this.json.extensions=this.json.extensions||{};this.json.extensions[extensionName]=extensionData;this.registerUsedExtension(extensionName);return extensionData;}},{key:"addRequiredExtension",value:function addRequiredExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$2(extensionData);this.addExtension(extensionName,extensionData);this.registerRequiredExtension(extensionName);return extensionData;}},{key:"registerUsedExtension",value:function registerUsedExtension(extensionName){this.json.extensionsUsed=this.json.extensionsUsed||[];if(!this.json.extensionsUsed.find(function(ext){return ext===extensionName;})){this.json.extensionsUsed.push(extensionName);}}},{key:"registerRequiredExtension",value:function registerRequiredExtension(extensionName){this.registerUsedExtension(extensionName);this.json.extensionsRequired=this.json.extensionsRequired||[];if(!this.json.extensionsRequired.find(function(ext){return ext===extensionName;})){this.json.extensionsRequired.push(extensionName);}}},{key:"removeExtension",value:function removeExtension(extensionName){if(!this.getExtension(extensionName)){return;}if(this.json.extensionsRequired){this._removeStringFromArray(this.json.extensionsRequired,extensionName);}if(this.json.extensionsUsed){this._removeStringFromArray(this.json.extensionsUsed,extensionName);}if(this.json.extensions){delete this.json.extensions[extensionName];}if(!Array.isArray(this.json.extensionsRemoved)){this.json.extensionsRemoved=[];}var extensionsRemoved=this.json.extensionsRemoved;if(!extensionsRemoved.includes(extensionName)){extensionsRemoved.push(extensionName);}}},{key:"setDefaultScene",value:function setDefaultScene(sceneIndex){this.json.scene=sceneIndex;}},{key:"addScene",value:function addScene(scene){var nodeIndices=scene.nodeIndices;this.json.scenes=this.json.scenes||[];this.json.scenes.push({nodes:nodeIndices});return this.json.scenes.length-1;}},{key:"addNode",value:function addNode(node){var meshIndex=node.meshIndex,matrix=node.matrix;this.json.nodes=this.json.nodes||[];var nodeData={mesh:meshIndex};if(matrix){nodeData.matrix=matrix;}this.json.nodes.push(nodeData);return this.json.nodes.length-1;}},{key:"addMesh",value:function addMesh(mesh){var attributes=mesh.attributes,indices=mesh.indices,material=mesh.material,_mesh$mode=mesh.mode,mode=_mesh$mode===void 0?4:_mesh$mode;var accessors=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessors,mode:mode}]};if(indices){var indicesAccessor=this._addIndices(indices);glTFMesh.primitives[0].indices=indicesAccessor;}if(Number.isFinite(material)){glTFMesh.primitives[0].material=material;}this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addPointCloud",value:function addPointCloud(attributes){var accessorIndices=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessorIndices,mode:0}]};this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addImage",value:function addImage(imageData,mimeTypeOpt){var metadata=getBinaryImageMetadata(imageData);var mimeType=mimeTypeOpt||(metadata===null||metadata===void 0?void 0:metadata.mimeType);var bufferViewIndex=this.addBufferView(imageData);var glTFImage={bufferView:bufferViewIndex,mimeType:mimeType};this.json.images=this.json.images||[];this.json.images.push(glTFImage);return this.json.images.length-1;}},{key:"addBufferView",value:function addBufferView(buffer){var byteLength=buffer.byteLength;assert$2(Number.isFinite(byteLength));this.sourceBuffers=this.sourceBuffers||[];this.sourceBuffers.push(buffer);var glTFBufferView={buffer:0,byteOffset:this.byteLength,byteLength:byteLength};this.byteLength+=padToNBytes(byteLength,4);this.json.bufferViews=this.json.bufferViews||[];this.json.bufferViews.push(glTFBufferView);return this.json.bufferViews.length-1;}},{key:"addAccessor",value:function addAccessor(bufferViewIndex,accessor){var glTFAccessor={bufferView:bufferViewIndex,type:getAccessorTypeFromSize(accessor.size),componentType:accessor.componentType,count:accessor.count,max:accessor.max,min:accessor.min};this.json.accessors=this.json.accessors||[];this.json.accessors.push(glTFAccessor);return this.json.accessors.length-1;}},{key:"addBinaryBuffer",value:function addBinaryBuffer(sourceBuffer){var accessor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{size:3};var bufferViewIndex=this.addBufferView(sourceBuffer);var minMax={min:accessor.min,max:accessor.max};if(!minMax.min||!minMax.max){minMax=this._getAccessorMinMax(sourceBuffer,accessor.size);}var accessorDefaults={size:accessor.size,componentType:getComponentTypeFromArray(sourceBuffer),count:Math.round(sourceBuffer.length/accessor.size),min:minMax.min,max:minMax.max};return this.addAccessor(bufferViewIndex,Object.assign(accessorDefaults,accessor));}},{key:"addTexture",value:function addTexture(texture){var imageIndex=texture.imageIndex;var glTFTexture={source:imageIndex};this.json.textures=this.json.textures||[];this.json.textures.push(glTFTexture);return this.json.textures.length-1;}},{key:"addMaterial",value:function addMaterial(pbrMaterialInfo){this.json.materials=this.json.materials||[];this.json.materials.push(pbrMaterialInfo);return this.json.materials.length-1;}},{key:"createBinaryChunk",value:function createBinaryChunk(){var _this$json,_this$json$buffers;this.gltf.buffers=[];var totalByteLength=this.byteLength;var arrayBuffer=new ArrayBuffer(totalByteLength);var targetArray=new Uint8Array(arrayBuffer);var dstByteOffset=0;var _iterator17=_createForOfIteratorHelper(this.sourceBuffers||[]),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var sourceBuffer=_step17.value;dstByteOffset=copyToArray(sourceBuffer,targetArray,dstByteOffset);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}if((_this$json=this.json)!==null&&_this$json!==void 0&&(_this$json$buffers=_this$json.buffers)!==null&&_this$json$buffers!==void 0&&_this$json$buffers[0]){this.json.buffers[0].byteLength=totalByteLength;}else{this.json.buffers=[{byteLength:totalByteLength}];}this.gltf.binary=arrayBuffer;this.sourceBuffers=[arrayBuffer];}},{key:"_removeStringFromArray",value:function _removeStringFromArray(array,string){var found=true;while(found){var index=array.indexOf(string);if(index>-1){array.splice(index,1);}else{found=false;}}}},{key:"_addAttributes",value:function _addAttributes(){var attributes=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var result={};for(var attributeKey in attributes){var attributeData=attributes[attributeKey];var attrName=this._getGltfAttributeName(attributeKey);var accessor=this.addBinaryBuffer(attributeData.value,attributeData);result[attrName]=accessor;}return result;}},{key:"_addIndices",value:function _addIndices(indices){return this.addBinaryBuffer(indices,{size:1});}},{key:"_getGltfAttributeName",value:function _getGltfAttributeName(attributeName){switch(attributeName.toLowerCase()){case'position':case'positions':case'vertices':return'POSITION';case'normal':case'normals':return'NORMAL';case'color':case'colors':return'COLOR_0';case'texcoord':case'texcoords':return'TEXCOORD_0';default:return attributeName;}}},{key:"_getAccessorMinMax",value:function _getAccessorMinMax(buffer,size){var result={min:null,max:null};if(buffer.length<size){return result;}result.min=[];result.max=[];var initValues=buffer.subarray(0,size);var _iterator18=_createForOfIteratorHelper(initValues),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var value=_step18.value;result.min.push(value);result.max.push(value);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}for(var index=size;index<buffer.length;index+=size){for(var componentIndex=0;componentIndex<size;componentIndex++){result.min[0+componentIndex]=Math.min(result.min[0+componentIndex],buffer[index+componentIndex]);result.max[0+componentIndex]=Math.max(result.max[0+componentIndex],buffer[index+componentIndex]);}}return result;}}]);}();var wasm_base='B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB';var wasm_simd='B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';var detector=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);var FILTERS={0:'',1:'meshopt_decodeFilterOct',2:'meshopt_decodeFilterQuat',3:'meshopt_decodeFilterExp',NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};function meshoptDecodeGltfBuffer(_x56,_x57,_x58,_x59,_x60){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(target,count,size,source,mode){var filter,instance,_args28=arguments;return _regenerator().w(function(_context35){while(1)switch(_context35.n){case 0:filter=_args28.length>5&&_args28[5]!==undefined?_args28[5]:'NONE';_context35.n=1;return loadWasmInstance();case 1:instance=_context35.v;decode$7(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 2:return _context35.a(2);}},_callee32);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(){return _regenerator().w(function(_context36){while(1)switch(_context36.n){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context36.a(2,wasmPromise);}},_callee33);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(){var wasm,result;return _regenerator().w(function(_context37){while(1)switch(_context37.n){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context37.n=1;return WebAssembly.instantiate(unpack(wasm),{});case 1:result=_context37.v;_context37.n=2;return result.instance.exports.__wasm_call_ctors();case 2:return _context37.a(2,result.instance);}},_callee34);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i459=0;_i459<data.length;++_i459){var ch=data.charCodeAt(_i459);result[_i459]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i460=0;_i460<data.length;++_i460){result[write++]=result[_i460]<60?wasmpack[result[_i460]]:(result[_i460]-60)*64+result[++_i460];}return result.buffer.slice(0,write);}function decode$7(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;var tp=sbrk(count4*size);var sp=sbrk(source.length);var heap=new Uint8Array(instance.exports.memory.buffer);heap.set(source,sp);var res=fun(tp,count,size,sp,source.length);if(res===0&&filter){filter(tp,count4,size);}target.set(heap.subarray(tp,tp+count*size));sbrk(tp-sbrk(0));if(res!==0){throw new Error("Malformed buffer data: ".concat(res));}}var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$8=EXT_MESHOPT_COMPRESSION;function decode$6(_x61,_x62){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(gltfData,options){var _options$gltf,scenegraph,promises,_iterator48,_step48,bufferViewIndex;return _regenerator().w(function(_context38){while(1)switch(_context38.n){case 0:scenegraph=new GLTFScenegraph(gltfData);if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context38.n=1;break;}return _context38.a(2);case 1:promises=[];_iterator48=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){bufferViewIndex=_step48.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}_context38.n=2;return Promise.all(promises);case 2:scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 3:return _context38.a(2);}},_callee35);}));return _decode$.apply(this,arguments);}function decodeMeshoptBufferView(_x63,_x64){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regenerator().w(function(_context39){while(1)switch(_context39.n){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context39.n=2;break;}_meshoptExtension$byt=meshoptExtension.byteOffset,byteOffset=_meshoptExtension$byt===void 0?0:_meshoptExtension$byt,_meshoptExtension$byt2=meshoptExtension.byteLength,byteLength=_meshoptExtension$byt2===void 0?0:_meshoptExtension$byt2,byteStride=meshoptExtension.byteStride,count=meshoptExtension.count,mode=meshoptExtension.mode,_meshoptExtension$fil=meshoptExtension.filter,filter=_meshoptExtension$fil===void 0?'NONE':_meshoptExtension$fil,bufferIndex=meshoptExtension.buffer;buffer=scenegraph.gltf.buffers[bufferIndex];source=new Uint8Array(buffer.arrayBuffer,buffer.byteOffset+byteOffset,byteLength);result=new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer,bufferView.byteOffset,bufferView.byteLength);_context39.n=1;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 1:return _context39.a(2,result);case 2:return _context39.a(2,null);}},_callee36);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$6});var EXT_TEXTURE_WEBP='EXT_texture_webp';var name$7=EXT_TEXTURE_WEBP;function preprocess$3(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);if(!isImageFormatSupported('image/webp')){if(scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)){throw new Error("gltf: Required extension ".concat(EXT_TEXTURE_WEBP," not supported by browser"));}return;}var json=scenegraph.json;var _iterator19=_createForOfIteratorHelper(json.textures||[]),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var texture=_step19.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});var KHR_TEXTURE_BASISU='KHR_texture_basisu';var name$6=KHR_TEXTURE_BASISU;function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator20=_createForOfIteratorHelper(json.textures||[]),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var texture=_step20.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){texture.source=extension.source;}scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});var VERSION$1="3.4.15";var DEFAULT_DRACO_OPTIONS={draco:{decoderType:(typeof WebAssembly==="undefined"?"undefined":_typeof2(WebAssembly))==='object'?'wasm':'js',libraryPath:'libs/',extraAttributes:{},attributeNameEntry:undefined}};var DracoLoader$1={name:'Draco',id:isBrowser$1?'draco':'draco-nodejs',module:'draco',shapes:['mesh'],version:VERSION$1,worker:true,extensions:['drc'],mimeTypes:['application/octet-stream'],binary:true,tests:['DRACO'],options:DEFAULT_DRACO_OPTIONS};function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i461=0;_i461<len;_i461+=3){var x=positions[_i461];var y=positions[_i461+1];var _z4=positions[_i461+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert$1(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var Schema=/*#__PURE__*/function(){function Schema(fields,metadata){_classCallCheck(this,Schema);_defineProperty(this,"fields",void 0);_defineProperty(this,"metadata",void 0);assert$1(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}return _createClass(Schema,[{key:"compareTo",value:function compareTo(other){if(this.metadata!==other.metadata){return false;}if(this.fields.length!==other.fields.length){return false;}for(var _i462=0;_i462<this.fields.length;++_i462){if(!this.fields[_i462].compareTo(other.fields[_i462])){return false;}}return true;}},{key:"select",value:function select(){var nameMap=Object.create(null);for(var _len=arguments.length,columnNames=new Array(_len),_key=0;_key<_len;_key++){columnNames[_key]=arguments[_key];}for(var _i463=0,_columnNames=columnNames;_i463<_columnNames.length;_i463++){var _name6=_columnNames[_i463];nameMap[_name6]=true;}var selectedFields=this.fields.filter(function(field){return nameMap[field.name];});return new Schema(selectedFields,this.metadata);}},{key:"selectAt",value:function selectAt(){var _this117=this;for(var _len2=arguments.length,columnIndices=new Array(_len2),_key2=0;_key2<_len2;_key2++){columnIndices[_key2]=arguments[_key2];}var selectedFields=columnIndices.map(function(index){return _this117.fields[index];}).filter(Boolean);return new Schema(selectedFields,this.metadata);}},{key:"assign",value:function assign(schemaOrFields){var fields;var metadata=this.metadata;if(schemaOrFields instanceof Schema){var otherSchema=schemaOrFields;fields=otherSchema.fields;metadata=mergeMaps(mergeMaps(new Map(),this.metadata),otherSchema.metadata);}else{fields=schemaOrFields;}var fieldMap=Object.create(null);var _iterator21=_createForOfIteratorHelper(this.fields),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var field=_step21.value;fieldMap[field.name]=field;}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}var _iterator22=_createForOfIteratorHelper(fields),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _field=_step22.value;fieldMap[_field.name]=_field;}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}var mergedFields=Object.values(fieldMap);return new Schema(mergedFields,metadata);}}]);}();function checkNames(fields){var usedNames={};var _iterator23=_createForOfIteratorHelper(fields),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var field=_step23.value;if(usedNames[field.name]){console.warn('Schema: duplicated field name',field.name,field);}usedNames[field.name]=true;}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}}function mergeMaps(m1,m2){return new Map([].concat(_toConsumableArray(m1||new Map()),_toConsumableArray(m2||new Map())));}var Field=/*#__PURE__*/function(){function Field(name,type){_classCallCheck(this,Field);var nullable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_defineProperty(this,"name",void 0);_defineProperty(this,"type",void 0);_defineProperty(this,"nullable",void 0);_defineProperty(this,"metadata",void 0);this.name=name;this.type=type;this.nullable=nullable;this.metadata=metadata;}return _createClass(Field,[{key:"typeId",get:function get(){return this.type&&this.type.typeId;}},{key:"clone",value:function clone(){return new Field(this.name,this.type,this.nullable,this.metadata);}},{key:"compareTo",value:function compareTo(other){return this.name===other.name&&this.type===other.type&&this.nullable===other.nullable&&this.metadata===other.metadata;}},{key:"toString",value:function toString(){return"".concat(this.type).concat(this.nullable?', nullable':'').concat(this.metadata?", metadata: ".concat(this.metadata):'');}}]);}();var Type=function(Type){Type[Type["NONE"]=0]="NONE";Type[Type["Null"]=1]="Null";Type[Type["Int"]=2]="Int";Type[Type["Float"]=3]="Float";Type[Type["Binary"]=4]="Binary";Type[Type["Utf8"]=5]="Utf8";Type[Type["Bool"]=6]="Bool";Type[Type["Decimal"]=7]="Decimal";Type[Type["Date"]=8]="Date";Type[Type["Time"]=9]="Time";Type[Type["Timestamp"]=10]="Timestamp";Type[Type["Interval"]=11]="Interval";Type[Type["List"]=12]="List";Type[Type["Struct"]=13]="Struct";Type[Type["Union"]=14]="Union";Type[Type["FixedSizeBinary"]=15]="FixedSizeBinary";Type[Type["FixedSizeList"]=16]="FixedSizeList";Type[Type["Map"]=17]="Map";Type[Type["Dictionary"]=-1]="Dictionary";Type[Type["Int8"]=-2]="Int8";Type[Type["Int16"]=-3]="Int16";Type[Type["Int32"]=-4]="Int32";Type[Type["Int64"]=-5]="Int64";Type[Type["Uint8"]=-6]="Uint8";Type[Type["Uint16"]=-7]="Uint16";Type[Type["Uint32"]=-8]="Uint32";Type[Type["Uint64"]=-9]="Uint64";Type[Type["Float16"]=-10]="Float16";Type[Type["Float32"]=-11]="Float32";Type[Type["Float64"]=-12]="Float64";Type[Type["DateDay"]=-13]="DateDay";Type[Type["DateMillisecond"]=-14]="DateMillisecond";Type[Type["TimestampSecond"]=-15]="TimestampSecond";Type[Type["TimestampMillisecond"]=-16]="TimestampMillisecond";Type[Type["TimestampMicrosecond"]=-17]="TimestampMicrosecond";Type[Type["TimestampNanosecond"]=-18]="TimestampNanosecond";Type[Type["TimeSecond"]=-19]="TimeSecond";Type[Type["TimeMillisecond"]=-20]="TimeMillisecond";Type[Type["TimeMicrosecond"]=-21]="TimeMicrosecond";Type[Type["TimeNanosecond"]=-22]="TimeNanosecond";Type[Type["DenseUnion"]=-23]="DenseUnion";Type[Type["SparseUnion"]=-24]="SparseUnion";Type[Type["IntervalDayTime"]=-25]="IntervalDayTime";Type[Type["IntervalYearMonth"]=-26]="IntervalYearMonth";return Type;}({});var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}return _createClass(DataType,[{key:"typeId",get:function get(){return Type.NONE;}},{key:"compareTo",value:function compareTo(other){return this===other;}}],[{key:"isNull",value:function isNull(x){return x&&x.typeId===Type.Null;}},{key:"isInt",value:function isInt(x){return x&&x.typeId===Type.Int;}},{key:"isFloat",value:function isFloat(x){return x&&x.typeId===Type.Float;}},{key:"isBinary",value:function isBinary(x){return x&&x.typeId===Type.Binary;}},{key:"isUtf8",value:function isUtf8(x){return x&&x.typeId===Type.Utf8;}},{key:"isBool",value:function isBool(x){return x&&x.typeId===Type.Bool;}},{key:"isDecimal",value:function isDecimal(x){return x&&x.typeId===Type.Decimal;}},{key:"isDate",value:function isDate(x){return x&&x.typeId===Type.Date;}},{key:"isTime",value:function isTime(x){return x&&x.typeId===Type.Time;}},{key:"isTimestamp",value:function isTimestamp(x){return x&&x.typeId===Type.Timestamp;}},{key:"isInterval",value:function isInterval(x){return x&&x.typeId===Type.Interval;}},{key:"isList",value:function isList(x){return x&&x.typeId===Type.List;}},{key:"isStruct",value:function isStruct(x){return x&&x.typeId===Type.Struct;}},{key:"isUnion",value:function isUnion(x){return x&&x.typeId===Type.Union;}},{key:"isFixedSizeBinary",value:function isFixedSizeBinary(x){return x&&x.typeId===Type.FixedSizeBinary;}},{key:"isFixedSizeList",value:function isFixedSizeList(x){return x&&x.typeId===Type.FixedSizeList;}},{key:"isMap",value:function isMap(x){return x&&x.typeId===Type.Map;}},{key:"isDictionary",value:function isDictionary(x){return x&&x.typeId===Type.Dictionary;}}]);}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){function Int(isSigned,bitWidth){var _this118;_classCallCheck(this,Int);_this118=_callSuper(this,Int);_defineProperty(_this118,"isSigned",void 0);_defineProperty(_this118,"bitWidth",void 0);_this118.isSigned=isSigned;_this118.bitWidth=bitWidth;return _this118;}_inherits(Int,_DataType);return _createClass(Int,[{key:"typeId",get:function get(){return Type.Int;}},{key:_Symbol$toStringTag3,get:function get(){return'Int';}},{key:"toString",value:function toString(){return"".concat(this.isSigned?'I':'Ui',"nt").concat(this.bitWidth);}}]);}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){function Int8(){_classCallCheck(this,Int8);return _callSuper(this,Int8,[true,8]);}_inherits(Int8,_Int);return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){function Int16(){_classCallCheck(this,Int16);return _callSuper(this,Int16,[true,16]);}_inherits(Int16,_Int2);return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){function Int32(){_classCallCheck(this,Int32);return _callSuper(this,Int32,[true,32]);}_inherits(Int32,_Int3);return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){function Uint8(){_classCallCheck(this,Uint8);return _callSuper(this,Uint8,[false,8]);}_inherits(Uint8,_Int4);return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){function Uint16(){_classCallCheck(this,Uint16);return _callSuper(this,Uint16,[false,16]);}_inherits(Uint16,_Int5);return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){function Uint32(){_classCallCheck(this,Uint32);return _callSuper(this,Uint32,[false,32]);}_inherits(Uint32,_Int6);return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){function Float(precision){var _this119;_classCallCheck(this,Float);_this119=_callSuper(this,Float);_defineProperty(_this119,"precision",void 0);_this119.precision=precision;return _this119;}_inherits(Float,_DataType2);return _createClass(Float,[{key:"typeId",get:function get(){return Type.Float;}},{key:_Symbol$toStringTag4,get:function get(){return'Float';}},{key:"toString",value:function toString(){return"Float".concat(this.precision);}}]);}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){function Float32(){_classCallCheck(this,Float32);return _callSuper(this,Float32,[Precision.SINGLE]);}_inherits(Float32,_Float);return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){function Float64(){_classCallCheck(this,Float64);return _callSuper(this,Float64,[Precision.DOUBLE]);}_inherits(Float64,_Float2);return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){function FixedSizeList(listSize,child){var _this120;_classCallCheck(this,FixedSizeList);_this120=_callSuper(this,FixedSizeList);_defineProperty(_this120,"listSize",void 0);_defineProperty(_this120,"children",void 0);_this120.listSize=listSize;_this120.children=[child];return _this120;}_inherits(FixedSizeList,_DataType3);return _createClass(FixedSizeList,[{key:"typeId",get:function get(){return Type.FixedSizeList;}},{key:"valueType",get:function get(){return this.children[0].type;}},{key:"valueField",get:function get(){return this.children[0];}},{key:_Symbol$toStringTag5,get:function get(){return'FixedSizeList';}},{key:"toString",value:function toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">");}}]);}(DataType,_Symbol$toStringTag7);function getArrowTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return new Int8();case Uint8Array:return new Uint8();case Int16Array:return new Int16();case Uint16Array:return new Uint16();case Int32Array:return new Int32();case Uint32Array:return new Uint32();case Float32Array:return new Float32();case Float64Array:return new Float64();default:throw new Error('array type not supported');}}function deduceMeshField(attributeName,attribute,optionalMetadata){var type=getArrowTypeFromTypedArray(attribute.value);var metadata=optionalMetadata?optionalMetadata:makeMeshAttributeMetadata(attribute);var field=new Field(attributeName,new FixedSizeList(attribute.size,new Field('value',type)),false,metadata);return field;}function makeMeshAttributeMetadata(attribute){var result=new Map();if('byteOffset'in attribute){result.set('byteOffset',attribute.byteOffset.toString(10));}if('byteStride'in attribute){result.set('byteStride',attribute.byteStride.toString(10));}if('normalized'in attribute){result.set('normalized',attribute.normalized.toString());}return result;}function getDracoSchema(attributes,loaderData,indices){var metadataMap=makeMetadata(loaderData.metadata);var fields=[];var namedLoaderDataAttributes=transformAttributesLoaderData(loaderData.attributes);for(var attributeName in attributes){var attribute=attributes[attributeName];var field=getArrowFieldFromAttribute(attributeName,attribute,namedLoaderDataAttributes[attributeName]);fields.push(field);}if(indices){var indicesField=getArrowFieldFromAttribute('indices',indices);fields.push(indicesField);}return new Schema(fields,metadataMap);}function transformAttributesLoaderData(loaderData){var result={};for(var key in loaderData){var dracoAttribute=loaderData[key];result[dracoAttribute.name||'undefined']=dracoAttribute;}return result;}function getArrowFieldFromAttribute(attributeName,attribute,loaderData){var metadataMap=loaderData?makeMetadata(loaderData.metadata):undefined;var field=deduceMeshField(attributeName,attribute,metadataMap);return field;}function makeMetadata(metadata){var metadataMap=new Map();for(var key in metadata){metadataMap.set("".concat(key,".string"),JSON.stringify(metadata[key]));}return metadataMap;}var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP={POSITION:'POSITION',NORMAL:'NORMAL',COLOR:'COLOR_0',TEX_COORD:'TEXCOORD_0'};var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};var INDEX_ITEM_SIZE=4;var DracoParser=/*#__PURE__*/function(){function DracoParser(draco){_classCallCheck(this,DracoParser);_defineProperty(this,"draco",void 0);_defineProperty(this,"decoder",void 0);_defineProperty(this,"metadataQuerier",void 0);this.draco=draco;this.decoder=new this.draco.Decoder();this.metadataQuerier=new this.draco.MetadataQuerier();}return _createClass(DracoParser,[{key:"destroy",value:function destroy(){this.draco.destroy(this.decoder);this.draco.destroy(this.metadataQuerier);}},{key:"parseSync",value:function parseSync(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var buffer=new this.draco.DecoderBuffer();buffer.Init(new Int8Array(arrayBuffer),arrayBuffer.byteLength);this._disableAttributeTransforms(options);var geometry_type=this.decoder.GetEncodedGeometryType(buffer);var dracoGeometry=geometry_type===this.draco.TRIANGULAR_MESH?new this.draco.Mesh():new this.draco.PointCloud();try{var dracoStatus;switch(geometry_type){case this.draco.TRIANGULAR_MESH:dracoStatus=this.decoder.DecodeBufferToMesh(buffer,dracoGeometry);break;case this.draco.POINT_CLOUD:dracoStatus=this.decoder.DecodeBufferToPointCloud(buffer,dracoGeometry);break;default:throw new Error('DRACO: Unknown geometry type.');}if(!dracoStatus.ok()||!dracoGeometry.ptr){var message="DRACO decompression failed: ".concat(dracoStatus.error_msg());throw new Error(message);}var loaderData=this._getDracoLoaderData(dracoGeometry,geometry_type,options);var geometry=this._getMeshData(dracoGeometry,loaderData,options);var boundingBox=getMeshBoundingBox(geometry.attributes);var schema=getDracoSchema(geometry.attributes,loaderData,geometry.indices);var data=_objectSpread(_objectSpread({loader:'draco',loaderData:loaderData,header:{vertexCount:dracoGeometry.num_points(),boundingBox:boundingBox}},geometry),{},{schema:schema});return data;}finally{this.draco.destroy(buffer);if(dracoGeometry){this.draco.destroy(dracoGeometry);}}}},{key:"_getDracoLoaderData",value:function _getDracoLoaderData(dracoGeometry,geometry_type,options){var metadata=this._getTopLevelMetadata(dracoGeometry);var attributes=this._getDracoAttributes(dracoGeometry,options);return{geometry_type:geometry_type,num_attributes:dracoGeometry.num_attributes(),num_points:dracoGeometry.num_points(),num_faces:dracoGeometry instanceof this.draco.Mesh?dracoGeometry.num_faces():0,metadata:metadata,attributes:attributes};}},{key:"_getDracoAttributes",value:function _getDracoAttributes(dracoGeometry,options){var dracoAttributes={};for(var attributeId=0;attributeId<dracoGeometry.num_attributes();attributeId++){var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attributeId);var metadata=this._getAttributeMetadata(dracoGeometry,attributeId);dracoAttributes[dracoAttribute.unique_id()]={unique_id:dracoAttribute.unique_id(),attribute_type:dracoAttribute.attribute_type(),data_type:dracoAttribute.data_type(),num_components:dracoAttribute.num_components(),byte_offset:dracoAttribute.byte_offset(),byte_stride:dracoAttribute.byte_stride(),normalized:dracoAttribute.normalized(),attribute_index:attributeId,metadata:metadata};var quantization=this._getQuantizationTransform(dracoAttribute,options);if(quantization){dracoAttributes[dracoAttribute.unique_id()].quantization_transform=quantization;}var octahedron=this._getOctahedronTransform(dracoAttribute,options);if(octahedron){dracoAttributes[dracoAttribute.unique_id()].octahedron_transform=octahedron;}}return dracoAttributes;}},{key:"_getMeshData",value:function _getMeshData(dracoGeometry,loaderData,options){var attributes=this._getMeshAttributes(loaderData,dracoGeometry,options);var positionAttribute=attributes.POSITION;if(!positionAttribute){throw new Error('DRACO: No position attribute found.');}if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'triangle-strip':return{topology:'triangle-strip',mode:4,attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}return{topology:'point-list',mode:0,attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i464=0,_Object$values=Object.values(loaderData.attributes);_i464<_Object$values.length;_i464++){var loaderAttribute=_Object$values[_i464];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var _this$_getAttributeVa=this._getAttributeValues(dracoGeometry,loaderAttribute),value=_this$_getAttributeVa.value,size=_this$_getAttributeVa.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}return attributes;}},{key:"_getTriangleListIndices",value:function _getTriangleListIndices(dracoGeometry){var numFaces=dracoGeometry.num_faces();var numIndices=numFaces*3;var byteLength=numIndices*INDEX_ITEM_SIZE;var ptr=this.draco._malloc(byteLength);try{this.decoder.GetTrianglesUInt32Array(dracoGeometry,byteLength,ptr);return new Uint32Array(this.draco.HEAPF32.buffer,ptr,numIndices).slice();}finally{this.draco._free(ptr);}}},{key:"_getTriangleStripIndices",value:function _getTriangleStripIndices(dracoGeometry){var dracoArray=new this.draco.DracoInt32Array();try{this.decoder.GetTriangleStripsFromMesh(dracoGeometry,dracoArray);return getUint32Array(dracoArray);}finally{this.draco.destroy(dracoArray);}}},{key:"_getAttributeValues",value:function _getAttributeValues(dracoGeometry,attribute){var TypedArrayCtor=DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];var numComponents=attribute.num_components;var numPoints=dracoGeometry.num_points();var numValues=numPoints*numComponents;var byteLength=numValues*TypedArrayCtor.BYTES_PER_ELEMENT;var dataType=getDracoDataType(this.draco,TypedArrayCtor);var value;var ptr=this.draco._malloc(byteLength);try{var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attribute.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry,dracoAttribute,dataType,byteLength,ptr);value=new TypedArrayCtor(this.draco.HEAPF32.buffer,ptr,numValues).slice();}finally{this.draco._free(ptr);}return{value:value,size:numComponents};}},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){var uniqueId=attribute.unique_id;for(var _i465=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i465<_Object$entries4.length;_i465++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i465],2),attributeName=_Object$entries4$_i[0],attributeUniqueId=_Object$entries4$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}var thisAttributeType=attribute.attribute_type;for(var dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP){var attributeType=this.draco[dracoAttributeConstant];if(attributeType===thisAttributeType){return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}var entryName=options.attributeNameEntry||'name';if(attribute.metadata[entryName]){return attribute.metadata[entryName].string;}return"CUSTOM_ATTRIBUTE_".concat(uniqueId);}},{key:"_getTopLevelMetadata",value:function _getTopLevelMetadata(dracoGeometry){var dracoMetadata=this.decoder.GetMetadata(dracoGeometry);return this._getDracoMetadata(dracoMetadata);}},{key:"_getAttributeMetadata",value:function _getAttributeMetadata(dracoGeometry,attributeId){var dracoMetadata=this.decoder.GetAttributeMetadata(dracoGeometry,attributeId);return this._getDracoMetadata(dracoMetadata);}},{key:"_getDracoMetadata",value:function _getDracoMetadata(dracoMetadata){if(!dracoMetadata||!dracoMetadata.ptr){return{};}var result={};var numEntries=this.metadataQuerier.NumEntries(dracoMetadata);for(var entryIndex=0;entryIndex<numEntries;entryIndex++){var entryName=this.metadataQuerier.GetEntryName(dracoMetadata,entryIndex);result[entryName]=this._getDracoMetadataField(dracoMetadata,entryName);}return result;}},{key:"_getDracoMetadataField",value:function _getDracoMetadataField(dracoMetadata,entryName){var dracoArray=new this.draco.DracoInt32Array();try{this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var intArray=getInt32Array(dracoArray);return{"int":this.metadataQuerier.GetIntEntry(dracoMetadata,entryName),string:this.metadataQuerier.GetStringEntry(dracoMetadata,entryName),"double":this.metadataQuerier.GetDoubleEntry(dracoMetadata,entryName),intArray:intArray};}finally{this.draco.destroy(dracoArray);}}},{key:"_disableAttributeTransforms",value:function _disableAttributeTransforms(options){var _options$quantizedAtt=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt===void 0?[]:_options$quantizedAtt,_options$octahedronAt=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt===void 0?[]:_options$octahedronAt;var skipAttributes=[].concat(_toConsumableArray(quantizedAttributes),_toConsumableArray(octahedronAttributes));var _iterator24=_createForOfIteratorHelper(skipAttributes),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var dracoAttributeName=_step24.value;this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}},{key:"_getQuantizationTransform",value:function _getQuantizationTransform(dracoAttribute,options){var _this121=this;var _options$quantizedAtt2=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt2===void 0?[]:_options$quantizedAtt2;var attribute_type=dracoAttribute.attribute_type();var skip=quantizedAttributes.map(function(type){return _this121.decoder[type];}).includes(attribute_type);if(skip){var _transform2=new this.draco.AttributeQuantizationTransform();try{if(_transform2.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform2.quantization_bits(),range:_transform2.range(),min_values:new Float32Array([1,2,3]).map(function(i){return _transform2.min_value(i);})};}}finally{this.draco.destroy(_transform2);}}return null;}},{key:"_getOctahedronTransform",value:function _getOctahedronTransform(dracoAttribute,options){var _this122=this;var _options$octahedronAt2=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt2===void 0?[]:_options$octahedronAt2;var attribute_type=dracoAttribute.attribute_type();var octahedron=octahedronAttributes.map(function(type){return _this122.decoder[type];}).includes(attribute_type);if(octahedron){var _transform3=new this.draco.AttributeQuantizationTransform();try{if(_transform3.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform3.quantization_bits()};}}finally{this.draco.destroy(_transform3);}}return null;}}]);}();function getDracoDataType(draco,attributeType){switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco.DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array:return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco.DT_UINT32;default:return draco.DT_INVALID;}}function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i466=0;_i466<numValues;_i466++){intArray[_i466]=dracoArray.GetValue(_i466);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i467=0;_i467<numValues;_i467++){intArray[_i467]=dracoArray.GetValue(_i467);}return intArray;}var DRACO_DECODER_VERSION='1.5.5';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_JS_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.js");var DRACO_WASM_WRAPPER_URL="".concat(STATIC_DECODER_URL,"/draco_wasm_wrapper.js");var DRACO_WASM_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.wasm");var loadDecoderPromise;function loadDracoDecoderModule(_x65){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(options){var modules;return _regenerator().w(function(_context40){while(1)switch(_context40.n){case 0:modules=options.modules||{};if(modules.draco3d){loadDecoderPromise=loadDecoderPromise||modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};});}else{loadDecoderPromise=loadDecoderPromise||loadDracoDecoder(options);}_context40.n=1;return loadDecoderPromise;case 1:return _context40.a(2,_context40.v);}},_callee37);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x66){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6,_t28,_t29,_t30,_t31;return _regenerator().w(function(_context41){while(1)switch(_context41.n){case 0:_t28=options.draco&&options.draco.decoderType;_context41.n=_t28==='js'?1:_t28==='wasm'?3:3;break;case 1:_context41.n=2;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 2:DracoDecoderModule=_context41.v;return _context41.a(3,7);case 3:_t29=Promise;_context41.n=4;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 4:_t30=_context41.v;_context41.n=5;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 5:_t31=_context41.v;_context41.n=6;return _t29.all.call(_t29,[_t30,_t31]);case 6:_yield$Promise$all5=_context41.v;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);DracoDecoderModule=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];case 7:DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context41.n=8;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 8:return _context41.a(2,_context41.v);}},_callee38);}));return _loadDracoDecoder.apply(this,arguments);}function initializeDracoDecoder(DracoDecoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){DracoDecoderModule(_objectSpread(_objectSpread({},options),{},{onModuleLoaded:function onModuleLoaded(draco){return resolve({draco:draco});}}));});}({id:isBrowser$1?'draco-writer':'draco-writer-nodejs',name:'Draco compressed geometry writer',module:'draco',version:VERSION$1,worker:true,options:{draco:{},source:null}});var DracoLoader=_objectSpread(_objectSpread({},DracoLoader$1),{},{parse:parse$1});function parse$1(_x67,_x68){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regenerator().w(function(_context42){while(1)switch(_context42.p=_context42.n){case 0:_context42.n=1;return loadDracoDecoderModule(options);case 1:_yield$loadDracoDecod=_context42.v;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context42.p=2;return _context42.a(2,dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 3:_context42.p=3;dracoParser.destroy();return _context42.f(3);case 4:return _context42.a(2);}},_callee39,null,[[2,,3,4]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name7 in attributes){var attribute=attributes[_name7];if(_name7!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name7]=glTFAccessor;}}return accessors;}function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={value:buffer,size:size,byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getComponentTypeFromArray(buffer)};return glTFAccessor;}function getAccessorData(attribute){var buffer=attribute;var size=1;var count=0;if(attribute&&attribute.value){buffer=attribute.value;size=attribute.size||1;}if(buffer){if(!ArrayBuffer.isView(buffer)){buffer=toTypedArray(buffer,Float32Array);}count=buffer.length/size;}return{buffer:buffer,size:size,count:count};}function toTypedArray(array,ArrayType){var convertTypedArrays=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!array){return null;}if(Array.isArray(array)){return new ArrayType(array);}if(convertTypedArrays&&!(array instanceof ArrayType)){return new ArrayType(array);}return array;}var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator25=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _primitive=_step25.value;if(scenegraph.getObjectExtension(_primitive,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decode$5(_x69,_x70,_x71){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator49,_step49,_primitive6;return _regenerator().w(function(_context43){while(1)switch(_context43.n){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context43.n=1;break;}return _context43.a(2);case 1:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator49=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){_primitive6=_step49.value;if(scenegraph.getObjectExtension(_primitive6,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive6,options,context));}}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}_context43.n=2;return Promise.all(promises);case 2:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 3:return _context43.a(2);}},_callee40);}));return _decode$2.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator26=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var _mesh5=_step26.value;compressMesh(_mesh5,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}}function decompressPrimitive(_x72,_x73,_x74,_x75){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i583,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regenerator().w(function(_context44){while(1)switch(_context44.n){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context44.n=1;break;}return _context44.a(2);case 1:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context44.n=2;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 2:decodedData=_context44.v;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i583=0,_Object$entries5=Object.entries(decodedAttributes);_i583<_Object$entries5.length;_i583++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i583],2),attributeName=_Object$entries5$_i[0],decodedAttribute=_Object$entries5$_i[1];if(attributeName in primitive.attributes){accessorIndex=primitive.attributes[attributeName];accessor=scenegraph.getAccessor(accessorIndex);if(accessor!==null&&accessor!==void 0&&accessor.min&&accessor!==null&&accessor!==void 0&&accessor.max){decodedAttribute.min=accessor.min;decodedAttribute.max=accessor.max;}}}primitive.attributes=decodedAttributes;if(decodedData.indices){primitive.indices=getGLTFAccessor(decodedData.indices);}checkPrimitive(primitive);case 3:return _context44.a(2);}},_callee41);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){var _context$parseSync;var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:4;var options=arguments.length>3?arguments[3]:undefined;var context=arguments.length>4?arguments[4]:undefined;if(!options.DracoWriter){throw new Error('options.gltf.DracoWriter not provided');}var compressedData=options.DracoWriter.encodeSync({attributes:attributes});var decodedData=context===null||context===void 0?void 0:(_context$parseSync=context.parseSync)===null||_context$parseSync===void 0?void 0:_context$parseSync.call(context,{attributes:attributes});var fauxAccessors=options._addFauxAttributes(decodedData.attributes);var bufferViewIndex=options.addBufferView(compressedData);var glTFMesh={primitives:[{attributes:fauxAccessors,mode:mode,extensions:_defineProperty2({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors})}]};return glTFMesh;}function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator27,_step27,_mesh6,_iterator28,_step28,_primitive2,_t4,_t5;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:_iterator27=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context0.p=1;_iterator27.s();case 2:if((_step27=_iterator27.n()).done){_context0.n=10;break;}_mesh6=_step27.value;_iterator28=_createForOfIteratorHelper(_mesh6.primitives);_context0.p=3;_iterator28.s();case 4:if((_step28=_iterator28.n()).done){_context0.n=6;break;}_primitive2=_step28.value;_context0.n=5;return _primitive2;case 5:_context0.n=4;break;case 6:_context0.n=8;break;case 7:_context0.p=7;_t4=_context0.v;_iterator28.e(_t4);case 8:_context0.p=8;_iterator28.f();return _context0.f(8);case 9:_context0.n=2;break;case 10:_context0.n=12;break;case 11:_context0.p=11;_t5=_context0.v;_iterator27.e(_t5);case 12:_context0.p=12;_iterator27.f();return _context0.f(12);case 13:return _context0.a(2);}},_marked2,null,[[3,7,8,9],[1,11,12,13]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$5,preprocess:preprocess$1,decode:decode$5,encode:encode$3});function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}var config={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true};function formatValue(value){var _ref15=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref15$precision=_ref15.precision,precision=_ref15$precision===void 0?config.precision:_ref15$precision;value=round(value);return"".concat(parseFloat(value.toPrecision(precision)));}function isArray(value){return Array.isArray(value)||ArrayBuffer.isView(value)&&!(value instanceof DataView);}function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i468=0;_i468<a.length;++_i468){if(!_equals(a[_i468],b[_i468])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}function _extendableBuiltin(cls){function ExtendableBuiltin(){var instance=Reflect.construct(cls,Array.from(arguments));Object.setPrototypeOf(instance,Object.getPrototypeOf(this));return instance;}ExtendableBuiltin.prototype=Object.create(cls.prototype,{constructor:{value:cls,enumerable:false,writable:true,configurable:true}});if(Object.setPrototypeOf){Object.setPrototypeOf(ExtendableBuiltin,cls);}else{ExtendableBuiltin.__proto__=cls;}return ExtendableBuiltin;}var MathArray=/*#__PURE__*/function(_extendableBuiltin2){function MathArray(){_classCallCheck(this,MathArray);return _callSuper(this,MathArray,arguments);}_inherits(MathArray,_extendableBuiltin2);return _createClass(MathArray,[{key:"clone",value:function clone(){return new this.constructor().copy(this);}},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i469=0;_i469<this.ELEMENTS;++_i469){this[_i469]=array[_i469+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i470=0;_i470<this.ELEMENTS;++_i470){targetArray[offset+_i470]=this[_i470];}return targetArray;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){if(arrayOrObject===this){return this;}return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}},{key:"formatString",value:function formatString(opts){var string='';for(var _i471=0;_i471<this.ELEMENTS;++_i471){string+=(_i471>0?', ':'')+formatValue(this[_i471],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i472=0;_i472<this.ELEMENTS;++_i472){if(!_equals(this[_i472],array[_i472])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i473=0;_i473<this.ELEMENTS;++_i473){if(this[_i473]!==array[_i473]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i474=0;_i474<this.ELEMENTS;++_i474){this[_i474]=-this[_i474];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i475=0;_i475<this.ELEMENTS;++_i475){var ai=a[_i475];this[_i475]=ai+t*(b[_i475]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i476=0;_i476<this.ELEMENTS;++_i476){this[_i476]=Math.min(vector[_i476],this[_i476]);}return this.check();}},{key:"max",value:function max(vector){for(var _i477=0;_i477<this.ELEMENTS;++_i477){this[_i477]=Math.max(vector[_i477],this[_i477]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i478=0;_i478<this.ELEMENTS;++_i478){this[_i478]=Math.min(Math.max(this[_i478],minVector[_i478]),maxVector[_i478]);}return this.check();}},{key:"add",value:function add(){for(var _len68=arguments.length,vectors=new Array(_len68),_key8=0;_key8<_len68;_key8++){vectors[_key8]=arguments[_key8];}for(var _i479=0,_vectors=vectors;_i479<_vectors.length;_i479++){var vector=_vectors[_i479];for(var _i480=0;_i480<this.ELEMENTS;++_i480){this[_i480]+=vector[_i480];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len69=arguments.length,vectors=new Array(_len69),_key9=0;_key9<_len69;_key9++){vectors[_key9]=arguments[_key9];}for(var _i481=0,_vectors2=vectors;_i481<_vectors2.length;_i481++){var vector=_vectors2[_i481];for(var _i482=0;_i482<this.ELEMENTS;++_i482){this[_i482]-=vector[_i482];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i483=0;_i483<this.ELEMENTS;++_i483){this[_i483]*=_scale7;}}else{for(var _i484=0;_i484<this.ELEMENTS&&_i484<_scale7.length;++_i484){this[_i484]*=_scale7[_i484];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i485=0;_i485<this.ELEMENTS;++_i485){this[_i485]*=scalar;}return this.check();}},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i486=0;_i486<this.ELEMENTS;++_i486){valid=valid&&Number.isFinite(this[_i486]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i487=0;_i487<this.ELEMENTS;++_i487){this[_i487]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i488=0;_i488<this.ELEMENTS;++_i488){this[_i488]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i489=0;_i489<this.ELEMENTS;++_i489){this[_i489]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i490=0;_i490<this.ELEMENTS;++_i490){this[_i490]=Math.min(Math.max(this[_i490],min),max);}return this.check();}},{key:"elements",get:function get(){return this;}}]);}(_extendableBuiltin(Array));function validateVector(v,length){if(v.length!==length){return false;}for(var _i491=0;_i491<v.length;++_i491){if(!Number.isFinite(v[_i491])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(value));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}var Vector=/*#__PURE__*/function(_MathArray){function Vector(){_classCallCheck(this,Vector);return _callSuper(this,Vector,arguments);}_inherits(Vector,_MathArray);return _createClass(Vector,[{key:"x",get:function get(){return this[0];},set:function set(value){this[0]=checkNumber(value);}},{key:"y",get:function get(){return this[1];},set:function set(value){this[1]=checkNumber(value);}},{key:"len",value:function len(){return Math.sqrt(this.lengthSquared());}},{key:"magnitude",value:function magnitude(){return this.len();}},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i492=0;_i492<this.ELEMENTS;++_i492){length+=this[_i492]*this[_i492];}return length;}},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i493=0;_i493<this.ELEMENTS;++_i493){var dist=this[_i493]-mathArray[_i493];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i494=0;_i494<this.ELEMENTS;++_i494){product+=this[_i494]*mathArray[_i494];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i495=0;_i495<this.ELEMENTS;++_i495){this[_i495]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len70=arguments.length,vectors=new Array(_len70),_key0=0;_key0<_len70;_key0++){vectors[_key0]=arguments[_key0];}for(var _i496=0,_vectors3=vectors;_i496<_vectors3.length;_i496++){var vector=_vectors3[_i496];for(var _i497=0;_i497<this.ELEMENTS;++_i497){this[_i497]*=vector[_i497];}}return this.check();}},{key:"divide",value:function divide(){for(var _len71=arguments.length,vectors=new Array(_len71),_key1=0;_key1<_len71;_key1++){vectors[_key1]=arguments[_key1];}for(var _i498=0,_vectors4=vectors;_i498<_vectors4.length;_i498++){var vector=_vectors4[_i498];for(var _i499=0;_i499<this.ELEMENTS;++_i499){this[_i499]/=vector[_i499];}}return this.check();}},{key:"lengthSq",value:function lengthSq(){return this.lengthSquared();}},{key:"distanceTo",value:function distanceTo(vector){return this.distance(vector);}},{key:"distanceToSquared",value:function distanceToSquared(vector){return this.distanceSquared(vector);}},{key:"getComponent",value:function getComponent(i){assert(i>=0&&i<this.ELEMENTS,'index is out of range');return checkNumber(this[i]);}},{key:"setComponent",value:function setComponent(i,value){assert(i>=0&&i<this.ELEMENTS,'index is out of range');this[i]=value;return this.check();}},{key:"addVectors",value:function addVectors(a,b){return this.copy(a).add(b);}},{key:"subVectors",value:function subVectors(a,b){return this.copy(a).subtract(b);}},{key:"multiplyVectors",value:function multiplyVectors(a,b){return this.copy(a).multiply(b);}},{key:"addScaledVector",value:function addScaledVector(a,b){return this.add(new this.constructor(a).multiplyScalar(b));}}]);}(MathArray);/**
|
|
25067
|
+
if(plugins.length>0){for(var _i453=0,len=plugins.length;_i453<len;_i453++){var plugin=plugins[_i453];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$2=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$1&&parseFloat(matches$1[1])||0;var VERSION$8="3.4.15";function assert$4(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof __webpack_require__.g!=='undefined'&&__webpack_require__.g,document:typeof document!=='undefined'&&document};var global_=globals$1.global||globals$1.self||globals$1.window||{};var isBrowser$1=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[1])||0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _defineProperty(e,r,t){return(r=toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}var WorkerJob=/*#__PURE__*/function(){function WorkerJob(jobName,workerThread){var _this113=this;_classCallCheck(this,WorkerJob);_defineProperty(this,"name",void 0);_defineProperty(this,"workerThread",void 0);_defineProperty(this,"isRunning",true);_defineProperty(this,"result",void 0);_defineProperty(this,"_resolve",function(){});_defineProperty(this,"_reject",function(){});this.name=jobName;this.workerThread=workerThread;this.result=new Promise(function(resolve,reject){_this113._resolve=resolve;_this113._reject=reject;});}return _createClass(WorkerJob,[{key:"postMessage",value:function postMessage(type,payload){this.workerThread.postMessage({source:'loaders.gl',type:type,payload:payload});}},{key:"done",value:function done(value){assert$4(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$4(this.isRunning);this.isRunning=false;this._reject(_error);}}]);}();var Worker$1=/*#__PURE__*/function(){function Worker$1(){_classCallCheck(this,Worker$1);}return _createClass(Worker$1,[{key:"terminate",value:function terminate(){}}]);}();var workerURLCache=new Map();function getLoadableWorkerURL(props){assert$4(props.source&&!props.url||!props.source&&props.url);var workerURL=workerURLCache.get(props.source||props.url);if(!workerURL){if(props.url){workerURL=getLoadableWorkerURLFromURL(props.url);workerURLCache.set(props.url,workerURL);}if(props.source){workerURL=getLoadableWorkerURLFromSource(props.source);workerURLCache.set(props.source,workerURL);}}assert$4(workerURL);return workerURL;}function getLoadableWorkerURLFromURL(url){if(!url.startsWith('http')){return url;}var workerSource=buildScriptSource(url);return getLoadableWorkerURLFromSource(workerSource);}function getLoadableWorkerURLFromSource(workerSource){var blob=new Blob([workerSource],{type:'application/javascript'});return URL.createObjectURL(blob);}function buildScriptSource(workerUrl){return"try {\n importScripts('".concat(workerUrl,"');\n} catch (error) {\n console.error(error);\n throw error;\n}");}function getTransferList(object){var recursive=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var transfers=arguments.length>2?arguments[2]:undefined;var transfersSet=transfers||new Set();if(!object);else if(isTransferable(object)){transfersSet.add(object);}else if(isTransferable(object.buffer)){transfersSet.add(object.buffer);}else if(ArrayBuffer.isView(object));else if(recursive&&_typeof2(object)==='object'){for(var key in object){getTransferList(object[key],recursive,transfersSet);}}return transfers===undefined?Array.from(transfersSet):[];}function isTransferable(object){if(!object){return false;}if(object instanceof ArrayBuffer){return true;}if(typeof MessagePort!=='undefined'&&object instanceof MessagePort){return true;}if(typeof ImageBitmap!=='undefined'&&object instanceof ImageBitmap){return true;}if(typeof OffscreenCanvas!=='undefined'&&object instanceof OffscreenCanvas){return true;}return false;}var NOOP=function NOOP(){};var WorkerThread=/*#__PURE__*/function(){function WorkerThread(props){_classCallCheck(this,WorkerThread);_defineProperty(this,"name",void 0);_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"terminated",false);_defineProperty(this,"worker",void 0);_defineProperty(this,"onMessage",void 0);_defineProperty(this,"onError",void 0);_defineProperty(this,"_loadableURL",'');var name=props.name,source=props.source,url=props.url;assert$4(source||url);this.name=name;this.source=source;this.url=url;this.onMessage=NOOP;this.onError=function(error){return console.log(error);};this.worker=isBrowser$1?this._createBrowserWorker():this._createNodeWorker();}return _createClass(WorkerThread,[{key:"destroy",value:function destroy(){this.onMessage=NOOP;this.onError=NOOP;this.worker.terminate();this.terminated=true;}},{key:"isRunning",get:function get(){return Boolean(this.onMessage);}},{key:"postMessage",value:function postMessage(data,transferList){transferList=transferList||getTransferList(data);this.worker.postMessage(data,transferList);}},{key:"_getErrorFromErrorEvent",value:function _getErrorFromErrorEvent(event){var message='Failed to load ';message+="worker ".concat(this.name," from ").concat(this.url,". ");if(event.message){message+="".concat(event.message," in ");}if(event.lineno){message+=":".concat(event.lineno,":").concat(event.colno);}return new Error(message);}},{key:"_createBrowserWorker",value:function _createBrowserWorker(){var _this114=this;this._loadableURL=getLoadableWorkerURL({source:this.source,url:this.url});var worker=new Worker(this._loadableURL,{name:this.name});worker.onmessage=function(event){if(!event.data){_this114.onError(new Error('No data received'));}else{_this114.onMessage(event.data);}};worker.onerror=function(error){_this114.onError(_this114._getErrorFromErrorEvent(error));_this114.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this115=this;var worker;if(this.url){var absolute=this.url.includes(':/')||this.url.startsWith('/');var url=absolute?this.url:"./".concat(this.url);worker=new Worker$1(url,{eval:false});}else if(this.source){worker=new Worker$1(this.source,{eval:true});}else{throw new Error('no worker');}worker.on('message',function(data){_this115.onMessage(data);});worker.on('error',function(error){_this115.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$1||typeof Worker$1!=='undefined'&&!isBrowser$1;}}]);}();var WorkerPool=/*#__PURE__*/function(){function WorkerPool(props){_classCallCheck(this,WorkerPool);_defineProperty(this,"name",'unnamed');_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"maxConcurrency",1);_defineProperty(this,"maxMobileConcurrency",1);_defineProperty(this,"onDebug",function(){});_defineProperty(this,"reuseWorkers",true);_defineProperty(this,"props",{});_defineProperty(this,"jobQueue",[]);_defineProperty(this,"idleQueue",[]);_defineProperty(this,"count",0);_defineProperty(this,"isDestroyed",false);this.source=props.source;this.url=props.url;this.setProps(props);}return _createClass(WorkerPool,[{key:"destroy",value:function destroy(){this.idleQueue.forEach(function(worker){return worker.destroy();});this.isDestroyed=true;}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);if(props.name!==undefined){this.name=props.name;}if(props.maxConcurrency!==undefined){this.maxConcurrency=props.maxConcurrency;}if(props.maxMobileConcurrency!==undefined){this.maxMobileConcurrency=props.maxMobileConcurrency;}if(props.reuseWorkers!==undefined){this.reuseWorkers=props.reuseWorkers;}if(props.onDebug!==undefined){this.onDebug=props.onDebug;}}},{key:"startJob",value:function(){var _startJob=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(name){var _this116=this;var onMessage,onError,startPromise,_args2=arguments;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:onMessage=_args2.length>1&&_args2[1]!==undefined?_args2[1]:function(job,type,data){return job.done(data);};onError=_args2.length>2&&_args2[2]!==undefined?_args2[2]:function(job,error){return job.error(error);};startPromise=new Promise(function(onStart){_this116.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this116;});this._startQueuedJob();_context3.n=1;return startPromise;case 1:return _context3.a(2,_context3.v);}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(){var workerThread,queuedJob,job;return _regenerator().w(function(_context4){while(1)switch(_context4.p=_context4.n){case 0:if(this.jobQueue.length){_context4.n=1;break;}return _context4.a(2);case 1:workerThread=this._getAvailableWorker();if(workerThread){_context4.n=2;break;}return _context4.a(2);case 2:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.n=5;break;}this.onDebug({message:'Starting job',name:queuedJob.name,workerThread:workerThread,backlog:this.jobQueue.length});job=new WorkerJob(queuedJob.name,workerThread);workerThread.onMessage=function(data){return queuedJob.onMessage(job,data.type,data.payload);};workerThread.onError=function(error){return queuedJob.onError(job,error);};queuedJob.onStart(job);_context4.p=3;_context4.n=4;return job.result;case 4:_context4.p=4;this.returnWorkerToQueue(workerThread);return _context4.f(4);case 5:return _context4.a(2);}},_callee3,this,[[3,,4,5]]);}));function _startQueuedJob(){return _startQueuedJob2.apply(this,arguments);}return _startQueuedJob;}()},{key:"returnWorkerToQueue",value:function returnWorkerToQueue(worker){var shouldDestroyWorker=this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency();if(shouldDestroyWorker){worker.destroy();this.count--;}else{this.idleQueue.push(worker);}if(!this.isDestroyed){this._startQueuedJob();}}},{key:"_getAvailableWorker",value:function _getAvailableWorker(){if(this.idleQueue.length>0){return this.idleQueue.shift()||null;}if(this.count<this._getMaxConcurrency()){this.count++;var _name5="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new WorkerThread({name:_name5,source:this.source,url:this.url});}return null;}},{key:"_getMaxConcurrency",value:function _getMaxConcurrency(){return isMobile?this.maxMobileConcurrency:this.maxConcurrency;}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}}]);}();var DEFAULT_PROPS={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:true,onDebug:function onDebug(){}};var WorkerFarm=/*#__PURE__*/function(){function WorkerFarm(props){_classCallCheck(this,WorkerFarm);_defineProperty(this,"props",void 0);_defineProperty(this,"workerPools",new Map());this.props=_objectSpread({},DEFAULT_PROPS);this.setProps(props);this.workerPools=new Map();}return _createClass(WorkerFarm,[{key:"destroy",value:function destroy(){var _iterator7=_createForOfIteratorHelper(this.workerPools.values()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var workerPool=_step7.value;workerPool.destroy();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}this.workerPools=new Map();}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);var _iterator8=_createForOfIteratorHelper(this.workerPools.values()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var workerPool=_step8.value;workerPool.setProps(this._getWorkerPoolProps());}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}},{key:"getWorkerPool",value:function getWorkerPool(options){var name=options.name,source=options.source,url=options.url;var workerPool=this.workerPools.get(name);if(!workerPool){workerPool=new WorkerPool({name:name,source:source,url:url});workerPool.setProps(this._getWorkerPoolProps());this.workerPools.set(name,workerPool);}return workerPool;}},{key:"_getWorkerPoolProps",value:function _getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug};}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}},{key:"getWorkerFarm",value:function getWorkerFarm(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);}();_defineProperty(WorkerFarm,"_workerFarm",void 0);var NPM_TAG='latest';function getWorkerURL(worker){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var workerOptions=options[worker.id]||{};var workerFile="".concat(worker.id,"-worker.js");var url=workerOptions.workerUrl;if(!url&&worker.id==='compression'){url=options.workerUrl;}if(options._workerType==='test'){url="modules/".concat(worker.module,"/dist/").concat(workerFile);}if(!url){var version=worker.version;if(version==='latest'){version=NPM_TAG;}var versionTag=version?"@".concat(version):'';url="https://unpkg.com/@loaders.gl/".concat(worker.module).concat(versionTag,"/dist/").concat(workerFile);}assert$4(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$8;assert$4(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}var readFileAsArrayBuffer=null;var readFileAsText=null;var requireFromFile=null;var requireFromString=null;var node=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer,readFileAsText:readFileAsText,requireFromFile:requireFromFile,requireFromString:requireFromString});var VERSION$7="3.4.15";var loadLibraryPromises={};function loadLibrary(_x8){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(libraryUrl){var moduleName,options,_args5=arguments;return _regenerator().w(function(_context10){while(1)switch(_context10.n){case 0:moduleName=_args5.length>1&&_args5[1]!==undefined?_args5[1]:null;options=_args5.length>2&&_args5[2]!==undefined?_args5[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context10.n=1;return loadLibraryPromises[libraryUrl];case 1:return _context10.a(2,_context10.v);}},_callee9);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser$1){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$4(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$7,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x9){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(libraryUrl){var _response,response,scriptSource,_t1,_t10;return _regenerator().w(function(_context11){while(1)switch(_context11.p=_context11.n){case 0:if(!libraryUrl.endsWith('wasm')){_context11.n=3;break;}_context11.n=1;return fetch(libraryUrl);case 1:_response=_context11.v;_context11.n=2;return _response.arrayBuffer();case 2:return _context11.a(2,_context11.v);case 3:if(isBrowser$1){_context11.n=8;break;}_context11.p=4;_t1=node&&requireFromFile;if(!_t1){_context11.n=6;break;}_context11.n=5;return requireFromFile(libraryUrl);case 5:_t1=_context11.v;case 6:return _context11.a(2,_t1);case 7:_context11.p=7;_t10=_context11.v;return _context11.a(2,null);case 8:if(!isWorker){_context11.n=9;break;}return _context11.a(2,importScripts(libraryUrl));case 9:_context11.n=10;return fetch(libraryUrl);case 10:response=_context11.v;_context11.n=11;return response.text();case 11:scriptSource=_context11.v;return _context11.a(2,loadLibraryFromString(scriptSource,libraryUrl));}},_callee0,null,[[4,7]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser$1){return requireFromString;}if(isWorker){eval.call(global_,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$1&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x0,_x1,_x10,_x11,_x12){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regenerator().w(function(_context12){while(1)switch(_context12.n){case 0:name=loader.id;url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context12.n=1;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 1:job=_context12.v;job.postMessage('process',{input:data,options:options,context:context});_context12.n=2;return job.result;case 2:result=_context12.v;_context12.n=3;return result.result;case 3:return _context12.a(2,_context12.v);}},_callee1);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x13,_x14,_x15,_x16){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(parseOnMainThread,job,type,payload){var id,input,options,result,message,_t11,_t12;return _regenerator().w(function(_context13){while(1)switch(_context13.p=_context13.n){case 0:_t11=type;_context13.n=_t11==='done'?1:_t11==='error'?2:_t11==='process'?3:8;break;case 1:job.done(payload);return _context13.a(3,9);case 2:job.error(new Error(payload.error));return _context13.a(3,9);case 3:id=payload.id,input=payload.input,options=payload.options;_context13.p=4;_context13.n=5;return parseOnMainThread(input,options);case 5:result=_context13.v;job.postMessage('done',{id:id,result:result});_context13.n=7;break;case 6:_context13.p=6;_t12=_context13.v;message=_t12 instanceof Error?_t12.message:'unknown error';job.postMessage('error',{id:id,error:message});case 7:return _context13.a(3,9);case 8:console.warn("parse-with-worker unknown message ".concat(type));case 9:return _context13.a(2);}},_callee10,null,[[4,6]]);}));return _onMessage2.apply(this,arguments);}function getFirstCharacters$1(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i454=0;_i454<length;_i454++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i454));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters$1(string),"\""));}}function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i455=0;_i455<array1.length;++_i455){if(array1[_i455]!==array2[_i455]){return false;}}return true;}function concatenateArrayBuffers(){for(var _len=arguments.length,sources=new Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}var sourceArrays=sources.map(function(source2){return source2 instanceof ArrayBuffer?new Uint8Array(source2):source2;});var byteLength=sourceArrays.reduce(function(length,typedArray){return length+typedArray.byteLength;},0);var result=new Uint8Array(byteLength);var offset=0;var _iterator9=_createForOfIteratorHelper(sourceArrays),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var sourceArray=_step9.value;result.set(sourceArray,offset);offset+=sourceArray.byteLength;}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return result.buffer;}function sliceArrayBuffer(arrayBuffer,byteOffset,byteLength){var subArray=byteLength!==undefined?new Uint8Array(arrayBuffer).subarray(byteOffset,byteOffset+byteLength):new Uint8Array(arrayBuffer).subarray(byteOffset);var arrayCopy=new Uint8Array(subArray);return arrayCopy.buffer;}function padToNBytes(byteLength,padding){assert$5(byteLength>=0);assert$5(padding>0);return byteLength+(padding-1)&~(padding-1);}function copyToArray(source,target,targetOffset){var sourceArray;if(source instanceof ArrayBuffer){sourceArray=new Uint8Array(source);}else{var srcByteOffset=source.byteOffset;var srcByteLength=source.byteLength;sourceArray=new Uint8Array(source.buffer||source.arrayBuffer,srcByteOffset,srcByteLength);}target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray.byteLength,4);}function concatenateArrayBuffersAsync(_x17){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk,_t13;return _regenerator().w(function(_context14){while(1)switch(_context14.p=_context14.n){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context14.p=1;_iterator=_asyncIterator(asyncIterator);case 2:_context14.n=3;return _iterator.next();case 3:if(!(_iteratorAbruptCompletion=!(_step=_context14.v).done)){_context14.n=5;break;}chunk=_step.value;arrayBuffers.push(chunk);case 4:_iteratorAbruptCompletion=false;_context14.n=2;break;case 5:_context14.n=7;break;case 6:_context14.p=6;_t13=_context14.v;_didIteratorError=true;_iteratorError=_t13;case 7:_context14.p=7;_context14.p=8;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context14.n=9;break;}_context14.n=9;return _iterator["return"]();case 9:_context14.p=9;if(!_didIteratorError){_context14.n=10;break;}throw _iteratorError;case 10:return _context14.f(9);case 11:return _context14.f(7);case 12:return _context14.a(2,concatenateArrayBuffers.apply(void 0,arrayBuffers));}},_callee11,null,[[8,,9,11],[1,6,7,12]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};function resolvePath(filename){for(var alias in fileAliases){if(filename.startsWith(alias)){var replacement=fileAliases[alias];filename=filename.replace(alias,replacement);}}if(!filename.startsWith('http://')&&!filename.startsWith('https://')){filename="".concat(pathPrefix).concat(filename);}return filename;}function toArrayBuffer$1(buffer){return buffer;}function isBuffer$1(value){return value&&_typeof2(value)==='object'&&value.isBuffer;}function toArrayBuffer(data){if(isBuffer$1(data)){return toArrayBuffer$1(data);}if(data instanceof ArrayBuffer){return data;}if(ArrayBuffer.isView(data)){if(data.byteOffset===0&&data.byteLength===data.buffer.byteLength){return data.buffer;}return data.buffer.slice(data.byteOffset,data.byteOffset+data.byteLength);}if(typeof data==='string'){var text=data;var uint8Array=new TextEncoder().encode(text);return uint8Array.buffer;}if(data&&_typeof2(data)==='object'&&data._toArrayBuffer){return data._toArrayBuffer();}throw new Error('toArrayBuffer');}function filename(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(slashIndex+1):'';}function dirname(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(0,slashIndex):'';}var isBoolean=function isBoolean(x){return typeof x==='boolean';};var isFunction=function isFunction(x){return typeof x==='function';};var isObject=function isObject(x){return x!==null&&_typeof2(x)==='object';};var isPureObject=function isPureObject(x){return isObject(x)&&x.constructor==={}.constructor;};var isIterable=function isIterable(x){return x&&typeof x[Symbol.iterator]==='function';};var isAsyncIterable=function isAsyncIterable(x){return x&&typeof x[Symbol.asyncIterator]==='function';};var isResponse=function isResponse(x){return typeof Response!=='undefined'&&x instanceof Response||x&&x.arrayBuffer&&x.text&&x.json;};var isBlob=function isBlob(x){return typeof Blob!=='undefined'&&x instanceof Blob;};var isBuffer=function isBuffer(x){return x&&_typeof2(x)==='object'&&x.isBuffer;};var isReadableDOMStream=function isReadableDOMStream(x){return typeof ReadableStream!=='undefined'&&x instanceof ReadableStream||isObject(x)&&isFunction(x.tee)&&isFunction(x.cancel)&&isFunction(x.getReader);};var isReadableNodeStream=function isReadableNodeStream(x){return isObject(x)&&isFunction(x.read)&&isFunction(x.pipe)&&isBoolean(x.readable);};var isReadableStream=function isReadableStream(x){return isReadableDOMStream(x)||isReadableNodeStream(x);};var DATA_URL_PATTERN=/^data:([-\w.]+\/[-\w.+]+)(;|,)/;var MIME_TYPE_PATTERN=/^([-\w.]+\/[-\w.+]+)/;function parseMIMEType(mimeString){var matches=MIME_TYPE_PATTERN.exec(mimeString);if(matches){return matches[1];}return mimeString;}function parseMIMETypeFromURL(url){var matches=DATA_URL_PATTERN.exec(url);if(matches){return matches[1];}return'';}var QUERY_STRING_PATTERN=/\?.*/;function extractQueryString(url){var matches=url.match(QUERY_STRING_PATTERN);return matches&&matches[0];}function stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function getResourceUrl(resource){if(isResponse(resource)){var response=resource;return response.url;}if(isBlob(resource)){var blob=resource;return blob.name||'';}if(typeof resource==='string'){return resource;}return'';}function getResourceMIMEType(resource){if(isResponse(resource)){var response=resource;var contentTypeHeader=response.headers.get('content-type')||'';var noQueryUrl=stripQueryString(response.url);return parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(noQueryUrl);}if(isBlob(resource)){var blob=resource;return blob.type||'';}if(typeof resource==='string'){return parseMIMETypeFromURL(resource);}return'';}function getResourceContentLength(resource){if(isResponse(resource)){var response=resource;return response.headers['content-length']||-1;}if(isBlob(resource)){var blob=resource;return blob.size;}if(typeof resource==='string'){return resource.length;}if(resource instanceof ArrayBuffer){return resource.byteLength;}if(ArrayBuffer.isView(resource)){return resource.byteLength;}return-1;}function makeResponse(_x18){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regenerator().w(function(_context15){while(1)switch(_context15.n){case 0:if(!isResponse(resource)){_context15.n=1;break;}return _context15.a(2,resource);case 1:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}_context15.n=2;return getInitialDataUrl(resource);case 2:initialDataUrl=_context15.v;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}if(typeof resource==='string'){resource=new TextEncoder().encode(resource);}response=new Response(resource,{headers:headers});Object.defineProperty(response,'url',{value:url});return _context15.a(2,response);}},_callee12);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x19){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(response){var message;return _regenerator().w(function(_context16){while(1)switch(_context16.n){case 0:if(response.ok){_context16.n=2;break;}_context16.n=1;return getResponseError(response);case 1:message=_context16.v;throw new Error(message);case 2:return _context16.a(2);}},_callee13);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x20){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(response){var message,contentType,text,_t14,_t15,_t16;return _regenerator().w(function(_context17){while(1)switch(_context17.p=_context17.n){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context17.p=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context17.n=3;break;}_t14=text;_t15=" ";_context17.n=2;return response.text();case 2:text=_t14+=_t15.concat.call(_t15,_context17.v);case 3:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context17.n=5;break;case 4:_context17.p=4;_t16=_context17.v;case 5:return _context17.a(2,message);}},_callee14,null,[[1,4]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x21){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regenerator().w(function(_context18){while(1)switch(_context18.n){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context18.n=1;break;}return _context18.a(2,"data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 1:if(!(resource instanceof Blob)){_context18.n=3;break;}blobSlice=resource.slice(0,5);_context18.n=2;return new Promise(function(resolve){var reader=new FileReader();reader.onload=function(event){var _event$target;return resolve(event===null||event===void 0?void 0:(_event$target=event.target)===null||_event$target===void 0?void 0:_event$target.result);};reader.readAsDataURL(blobSlice);});case 2:return _context18.a(2,_context18.v);case 3:if(!(resource instanceof ArrayBuffer)){_context18.n=4;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context18.a(2,"data:base64,".concat(_base));case 4:return _context18.a(2,null);}},_callee15);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i456=0;_i456<bytes.byteLength;_i456++){binary+=String.fromCharCode(bytes[_i456]);}return btoa(binary);}function fetchFile(_x22,_x23){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(url,options){var fetchOptions;return _regenerator().w(function(_context19){while(1)switch(_context19.n){case 0:if(!(typeof url==='string')){_context19.n=2;break;}url=resolvePath(url);fetchOptions=options;if(options!==null&&options!==void 0&&options.fetch&&typeof(options===null||options===void 0?void 0:options.fetch)!=='function'){fetchOptions=options.fetch;}_context19.n=1;return fetch(url,fetchOptions);case 1:return _context19.a(2,_context19.v);case 2:_context19.n=3;return makeResponse(url);case 3:return _context19.a(2,_context19.v);}},_callee16);}));return _fetchFile.apply(this,arguments);}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof2(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof2(process.versions)==='object'&&Boolean(process.versions['electron'])){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof2(navigator))==='object'&&typeof navigator.userAgent==='string'&&navigator.userAgent;var userAgent=mockUserAgent||realUserAgent;if(userAgent&&userAgent.indexOf('Electron')>=0){return true;}return false;}function isBrowser(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var globals={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof __webpack_require__.g!=='undefined'&&__webpack_require__.g,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&process};var window_=globals.window||globals.self||globals.global;var process_=globals.process||{};var VERSION$6=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser();function getStorage(type){try{var storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return storage;}catch(e){return null;}}var LocalStorage=/*#__PURE__*/function(){function LocalStorage(id,defaultConfig){_classCallCheck(this,LocalStorage);var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",void 0);this.storage=getStorage(type);this.id=id;this.config=defaultConfig;this._loadConfiguration();}return _createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}}},{key:"_loadConfiguration",value:function _loadConfiguration(){var configuration={};if(this.storage){var serializedConfiguration=this.storage.getItem(this.id);configuration=serializedConfiguration?JSON.parse(serializedConfiguration):{};}Object.assign(this.config,configuration);return this;}}]);}();function formatTime(ms){var formatted;if(ms<10){formatted="".concat(ms.toFixed(2),"ms");}else if(ms<100){formatted="".concat(ms.toFixed(1),"ms");}else if(ms<1000){formatted="".concat(ms.toFixed(0),"ms");}else{formatted="".concat((ms/1000).toFixed(2),"s");}return formatted;}function leftPad(string){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var padLength=Math.max(length-string.length,0);return"".concat(' '.repeat(padLength)).concat(string);}function formatImage(image,message,scale){var maxWidth=arguments.length>3&&arguments[3]!==undefined?arguments[3]:600;var imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29');if(image.width>maxWidth){scale=Math.min(scale,maxWidth/image.width);}var width=image.width*scale;var height=image.height*scale;var style=['font-size:1px;',"padding:".concat(Math.floor(height/2),"px ").concat(Math.floor(width/2),"px;"),"line-height:".concat(height,"px;"),"background:url(".concat(imageUrl,");"),"background-size:".concat(width,"px ").concat(height,"px;"),'color:transparent;'].join('');return["".concat(message," %c+"),style];}var COLOR;(function(COLOR){COLOR[COLOR["BLACK"]=30]="BLACK";COLOR[COLOR["RED"]=31]="RED";COLOR[COLOR["GREEN"]=32]="GREEN";COLOR[COLOR["YELLOW"]=33]="YELLOW";COLOR[COLOR["BLUE"]=34]="BLUE";COLOR[COLOR["MAGENTA"]=35]="MAGENTA";COLOR[COLOR["CYAN"]=36]="CYAN";COLOR[COLOR["WHITE"]=37]="WHITE";COLOR[COLOR["BRIGHT_BLACK"]=90]="BRIGHT_BLACK";COLOR[COLOR["BRIGHT_RED"]=91]="BRIGHT_RED";COLOR[COLOR["BRIGHT_GREEN"]=92]="BRIGHT_GREEN";COLOR[COLOR["BRIGHT_YELLOW"]=93]="BRIGHT_YELLOW";COLOR[COLOR["BRIGHT_BLUE"]=94]="BRIGHT_BLUE";COLOR[COLOR["BRIGHT_MAGENTA"]=95]="BRIGHT_MAGENTA";COLOR[COLOR["BRIGHT_CYAN"]=96]="BRIGHT_CYAN";COLOR[COLOR["BRIGHT_WHITE"]=97]="BRIGHT_WHITE";})(COLOR||(COLOR={}));function getColor(color){return typeof color==='string'?COLOR[color.toUpperCase()]||COLOR.WHITE:color;}function addColor(string,color,background){if(!isBrowser&&typeof string==='string'){if(color){color=getColor(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator0=_createForOfIteratorHelper(propNames),_step0;try{var _loop3=function _loop3(){var key=_step0.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator0.s();!(_step0=_iterator0.n()).done;){_loop3();}}catch(err){_iterator0.e(err);}finally{_iterator0.f();}}function assert$3(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser&&'performance'in window_){var _window$performance,_window$performance$n;timestamp=window_===null||window_===void 0?void 0:(_window$performance=window_.performance)===null||_window$performance===void 0?void 0:(_window$performance$n=_window$performance.now)===null||_window$performance$n===void 0?void 0:_window$performance$n.call(_window$performance);}else if('hrtime'in process_){var _process$hrtime;var timeParts=process_===null||process_===void 0?void 0:(_process$hrtime=process_.hrtime)===null||_process$hrtime===void 0?void 0:_process$hrtime.call(process_);timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole={debug:isBrowser?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS={enabled:true,level:0};function noop(){}var cache={};var ONCE={once:true};var Log=/*#__PURE__*/function(){function Log(){_classCallCheck(this,Log);var _ref14=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref14.id;_defineProperty(this,"id",void 0);_defineProperty(this,"VERSION",VERSION$6);_defineProperty(this,"_startTs",getHiResTimestamp());_defineProperty(this,"_deltaTs",getHiResTimestamp());_defineProperty(this,"_storage",void 0);_defineProperty(this,"userData",{});_defineProperty(this,"LOG_THROTTLE_TIMEOUT",0);this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}return _createClass(Log,[{key:"level",get:function get(){return this.getLevel();},set:function set(newLevel){this.setLevel(newLevel);}},{key:"isEnabled",value:function isEnabled(){return this._storage.config.enabled;}},{key:"getLevel",value:function getLevel(){return this._storage.config.level;}},{key:"getTotal",value:function getTotal(){return Number((getHiResTimestamp()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp()-this._deltaTs).toPrecision(10));}},{key:"priority",get:function get(){return this.level;},set:function set(newPriority){this.level=newPriority;}},{key:"getPriority",value:function getPriority(){return this.level;}},{key:"enable",value:function enable(){var enabled=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this._storage.setConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.setConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.setConfiguration(_defineProperty2({},setting,value));}},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"assert",value:function assert(condition,message){assert$3(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole.warn,arguments,ONCE);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole.error,arguments);}},{key:"deprecated",value:function deprecated(oldUsage,newUsage){return this.warn("`".concat(oldUsage,"` is deprecated and will be removed in a later version. Use `").concat(newUsage,"` instead"));}},{key:"removed",value:function removed(oldUsage,newUsage){return this.error("`".concat(oldUsage,"` has been removed. Use `").concat(newUsage,"` instead"));}},{key:"probe",value:function probe(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return this._getLogFunction(logLevel,message,originalConsole.debug||originalConsole.info,arguments,ONCE);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop,columns&&[columns],{tag:getTableHeader(_table)});}return noop;}},{key:"image",value:function image(_ref){var logLevel=_ref.logLevel,priority=_ref.priority,image=_ref.image,_ref$message=_ref.message,message=_ref$message===void 0?'':_ref$message,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale;if(!this._shouldLog(logLevel||priority)){return noop;}return isBrowser?logImageInBrowser({image:image,message:message,scale:scale}):logImageInNode();}},{key:"time",value:function time(logLevel,message){return this._getLogFunction(logLevel,message,console.time?console.time:console.info);}},{key:"timeEnd",value:function timeEnd(logLevel,message){return this._getLogFunction(logLevel,message,console.timeEnd?console.timeEnd:console.info);}},{key:"timeStamp",value:function timeStamp(logLevel,message){return this._getLogFunction(logLevel,message,console.timeStamp||noop);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};var options=normalizeArguments({logLevel:logLevel,message:message,opts:opts});var collapsed=opts.collapsed;options.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(options);}},{key:"groupCollapsed",value:function groupCollapsed(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.group(logLevel,message,Object.assign({},opts,{collapsed:true}));}},{key:"groupEnd",value:function groupEnd(logLevel){return this._getLogFunction(logLevel,'',console.groupEnd||noop);}},{key:"withGroup",value:function withGroup(logLevel,message,func){this.group(logLevel,message)();try{func();}finally{this.groupEnd(logLevel)();}}},{key:"trace",value:function trace(){if(console.trace){console.trace();}}},{key:"_shouldLog",value:function _shouldLog(logLevel){return this.isEnabled()&&this.getLevel()>=normalizeLogLevel(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method,args,opts){if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$3(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once){if(!cache[tag]){cache[tag]=getHiResTimestamp();}else{return noop;}}message=decorateMessage(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);}();_defineProperty(Log,"VERSION",VERSION$6);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof2(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$3(Number.isFinite(resolvedLevel)&&resolvedLevel>=0);return resolvedLevel;}function normalizeArguments(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}switch(_typeof2(logLevel)){case'string':case'function':if(message!==undefined){args.unshift(message);}opts.message=logLevel;break;case'object':Object.assign(opts,logLevel);break;}if(typeof opts.message==='function'){opts.message=opts.message();}var messageType=_typeof2(opts.message);assert$3(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){console.warn('removed');return noop;}function logImageInBrowser(_ref3){var image=_ref3.image,_ref3$message=_ref3.message,message=_ref3$message===void 0?'':_ref3$message,_ref3$scale=_ref3.scale,scale=_ref3$scale===void 0?1:_ref3$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage(_img,message,scale)));};_img.src=image.toDataURL();return noop;}return noop;}function getTableHeader(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var probeLog=new Log({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}return _createClass(NullLog,[{key:"log",value:function log(){return function(){};}},{key:"info",value:function info(){return function(){};}},{key:"warn",value:function warn(){return function(){};}},{key:"error",value:function error(){return function(){};}}]);}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}return _createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return(_this$console$log=this.console.log).bind.apply(_this$console$log,[this.console].concat(args));}},{key:"info",value:function info(){var _this$console$info;for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}return(_this$console$info=this.console.info).bind.apply(_this$console$info,[this.console].concat(args));}},{key:"warn",value:function warn(){var _this$console$warn;for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}return(_this$console$warn=this.console.warn).bind.apply(_this$console$warn,[this.console].concat(args));}},{key:"error",value:function error(){var _this$console$error;for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);}();var DEFAULT_LOADER_OPTIONS={fetch:null,mimeType:undefined,nothrow:false,log:new ConsoleLog(),CDN:'https://unpkg.com/@loaders.gl',worker:true,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:isBrowser$2,_nodeWorkers:false,_workerType:'',limit:0,_limitMB:0,batchSize:'auto',batchDebounceMs:0,metadata:false,transforms:[]};var REMOVED_LOADER_OPTIONS={"throws":'nothrow',dataType:'(no longer used)',uri:'baseUri',method:'fetch.method',headers:'fetch.headers',body:'fetch.body',mode:'fetch.mode',credentials:'fetch.credentials',cache:'fetch.cache',redirect:'fetch.redirect',referrer:'fetch.referrer',referrerPolicy:'fetch.referrerPolicy',integrity:'fetch.integrity',keepalive:'fetch.keepalive',signal:'fetch.signal'};function getGlobalLoaderState(){globalThis.loaders=globalThis.loaders||{};var loaders=globalThis.loaders;loaders._state=loaders._state||{};return loaders._state;}var getGlobalLoaderOptions=function getGlobalLoaderOptions(){var state=getGlobalLoaderState();state.globalOptions=state.globalOptions||_objectSpread({},DEFAULT_LOADER_OPTIONS);return state.globalOptions;};function normalizeOptions(options,loader,loaders,url){loaders=loaders||[];loaders=Array.isArray(loaders)?loaders:[loaders];validateOptions(options,loaders);return normalizeOptionsInternal(loader,options,url);}function validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator1=_createForOfIteratorHelper(loaders),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var loader=_step1.value;var idOptions=options&&options[loader.id]||{};var loaderOptions=loader.options&&loader.options[loader.id]||{};var deprecatedOptions=loader.deprecatedOptions&&loader.deprecatedOptions[loader.id]||{};validateOptionsObject(idOptions,loader.id,loaderOptions,deprecatedOptions,loaders);}}catch(err){_iterator1.e(err);}finally{_iterator1.f();}}function validateOptionsObject(options,id,defaultOptions,deprecatedOptions,loaders){var loaderName=id||'Top level';var prefix=id?"".concat(id,"."):'';for(var key in options){var isSubOptions=!id&&isObject(options[key]);var isBaseUriOption=key==='baseUri'&&!id;var isWorkerUrlOption=key==='workerUrl'&&id;if(!(key in defaultOptions)&&!isBaseUriOption&&!isWorkerUrlOption){if(key in deprecatedOptions){probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' no longer supported, use '").concat(deprecatedOptions[key],"'"))();}else if(!isSubOptions){var suggestion=findSimilarOption(key,loaders);probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' not recognized. ").concat(suggestion))();}}}}function findSimilarOption(optionKey,loaders){var lowerCaseOptionKey=optionKey.toLowerCase();var bestSuggestion='';var _iterator10=_createForOfIteratorHelper(loaders),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var loader=_step10.value;for(var key in loader.options){if(optionKey===key){return"Did you mean '".concat(loader.id,".").concat(key,"'?");}var lowerCaseKey=key.toLowerCase();var isPartialMatch=lowerCaseOptionKey.startsWith(lowerCaseKey)||lowerCaseKey.startsWith(lowerCaseOptionKey);if(isPartialMatch){bestSuggestion=bestSuggestion||"Did you mean '".concat(loader.id,".").concat(key,"'?");}}}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}return bestSuggestion;}function normalizeOptionsInternal(loader,options,url){var loaderDefaultOptions=loader.options||{};var mergedOptions=_objectSpread({},loaderDefaultOptions);addUrlOptions(mergedOptions,url);if(mergedOptions.log===null){mergedOptions.log=new NullLog();}mergeNestedFields(mergedOptions,getGlobalLoaderOptions());mergeNestedFields(mergedOptions,options);return mergedOptions;}function mergeNestedFields(mergedOptions,options){for(var key in options){if(key in options){var value=options[key];if(isPureObject(value)&&isPureObject(mergedOptions[key])){mergedOptions[key]=_objectSpread(_objectSpread({},mergedOptions[key]),options[key]);}else{mergedOptions[key]=options[key];}}}}function addUrlOptions(options,url){if(url&&!('baseUri'in options)){options.baseUri=url;}}function isLoaderObject(loader){var _loader;if(!loader){return false;}if(Array.isArray(loader)){loader=loader[0];}var hasExtensions=Array.isArray((_loader=loader)===null||_loader===void 0?void 0:_loader.extensions);return hasExtensions;}function normalizeLoader(loader){var _loader2,_loader3;assert$5(loader,'null loader');assert$5(isLoaderObject(loader),'invalid loader');var options;if(Array.isArray(loader)){options=loader[1];loader=loader[0];loader=_objectSpread(_objectSpread({},loader),{},{options:_objectSpread(_objectSpread({},loader.options),options)});}if((_loader2=loader)!==null&&_loader2!==void 0&&_loader2.parseTextSync||(_loader3=loader)!==null&&_loader3!==void 0&&_loader3.parseText){loader.text=true;}if(!loader.text){loader.binary=true;}return loader;}var getGlobalLoaderRegistry=function getGlobalLoaderRegistry(){var state=getGlobalLoaderState();state.loaderRegistry=state.loaderRegistry||[];return state.loaderRegistry;};function getRegisteredLoaders(){return getGlobalLoaderRegistry();}var log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x24){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(data){var loaders,options,context,loader,_args13=arguments;return _regenerator().w(function(_context20){while(1)switch(_context20.n){case 0:loaders=_args13.length>1&&_args13[1]!==undefined?_args13[1]:[];options=_args13.length>2?_args13[2]:undefined;context=_args13.length>3?_args13[3]:undefined;if(validHTTPResponse(data)){_context20.n=1;break;}return _context20.a(2,null);case 1:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context20.n=2;break;}return _context20.a(2,loader);case 2:if(!isBlob(data)){_context20.n=4;break;}_context20.n=3;return data.slice(0,10).arrayBuffer();case 3:data=_context20.v;loader=selectLoaderSync(data,loaders,options,context);case 4:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context20.n=5;break;}throw new Error(getNoValidLoaderMessage(data));case 5:return _context20.a(2,loader);}},_callee17);}));return _selectLoader.apply(this,arguments);}function selectLoaderSync(data){var loaders=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var options=arguments.length>2?arguments[2]:undefined;var context=arguments.length>3?arguments[3]:undefined;if(!validHTTPResponse(data)){return null;}if(loaders&&!Array.isArray(loaders)){return normalizeLoader(loaders);}var candidateLoaders=[];if(loaders){candidateLoaders=candidateLoaders.concat(loaders);}if(!(options!==null&&options!==void 0&&options.ignoreRegisteredLoaders)){var _candidateLoaders;(_candidateLoaders=candidateLoaders).push.apply(_candidateLoaders,_toConsumableArray(getRegisteredLoaders()));}normalizeLoaders(candidateLoaders);var loader=selectLoaderInternal(data,candidateLoaders,options,context);if(!loader&&!(options!==null&&options!==void 0&&options.nothrow)){throw new Error(getNoValidLoaderMessage(data));}return loader;}function selectLoaderInternal(data,loaders,options,context){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var testUrl=stripQueryString(url)||(context===null||context===void 0?void 0:context.url);var loader=null;var reason='';if(options!==null&&options!==void 0&&options.mimeType){loader=findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.mimeType);reason="match forced by supplied MIME type ".concat(options===null||options===void 0?void 0:options.mimeType);}loader=loader||findLoaderByUrl(loaders,testUrl);reason=reason||(loader?"matched url ".concat(testUrl):'');loader=loader||findLoaderByMIMEType(loaders,type);reason=reason||(loader?"matched MIME type ".concat(type):'');loader=loader||findLoaderByInitialBytes(loaders,data);reason=reason||(loader?"matched initial data ".concat(getFirstCharacters(data)):'');loader=loader||findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.fallbackMimeType);reason=reason||(loader?"matched fallback MIME type ".concat(type):'');if(reason){var _loader;log.log(1,"selectLoader selected ".concat((_loader=loader)===null||_loader===void 0?void 0:_loader.name,": ").concat(reason,"."));}return loader;}function validHTTPResponse(data){if(data instanceof Response){if(data.status===204){return false;}}return true;}function getNoValidLoaderMessage(data){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var message='No valid loader found (';message+=url?"".concat(filename(url),", "):'no url provided, ';message+="MIME type: ".concat(type?"\"".concat(type,"\""):'not provided',", ");var firstCharacters=data?getFirstCharacters(data):'';message+=firstCharacters?" first bytes: \"".concat(firstCharacters,"\""):'first bytes: not available';message+=')';return message;}function normalizeLoaders(loaders){var _iterator11=_createForOfIteratorHelper(loaders),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var loader=_step11.value;normalizeLoader(loader);}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}function findLoaderByUrl(loaders,url){var match=url&&EXT_PATTERN.exec(url);var extension=match&&match[1];return extension?findLoaderByExtension(loaders,extension):null;}function findLoaderByExtension(loaders,extension){extension=extension.toLowerCase();var _iterator12=_createForOfIteratorHelper(loaders),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var loader=_step12.value;var _iterator13=_createForOfIteratorHelper(loader.extensions),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var loaderExtension=_step13.value;if(loaderExtension.toLowerCase()===extension){return loader;}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return null;}function findLoaderByMIMEType(loaders,mimeType){var _iterator14=_createForOfIteratorHelper(loaders),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var loader=_step14.value;if(loader.mimeTypes&&loader.mimeTypes.includes(mimeType)){return loader;}if(mimeType==="application/x.".concat(loader.id)){return loader;}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}return null;}function findLoaderByInitialBytes(loaders,data){if(!data){return null;}var _iterator15=_createForOfIteratorHelper(loaders),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var loader=_step15.value;if(typeof data==='string'){if(testDataAgainstText(data,loader)){return loader;}}else if(ArrayBuffer.isView(data)){if(testDataAgainstBinary(data.buffer,data.byteOffset,loader)){return loader;}}else if(data instanceof ArrayBuffer){var byteOffset=0;if(testDataAgainstBinary(data,byteOffset,loader)){return loader;}}}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}return null;}function testDataAgainstText(data,loader){if(loader.testText){return loader.testText(data);}var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return data.startsWith(test);});}function testDataAgainstBinary(data,byteOffset,loader){var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return testBinary(data,byteOffset,loader,test);});}function testBinary(data,byteOffset,loader,test){if(test instanceof ArrayBuffer){return compareArrayBuffers(test,data,test.byteLength);}switch(_typeof2(test)){case'function':return test(data,loader);case'string':var magic=getMagicString$1(data,byteOffset,test.length);return test===magic;default:return false;}}function getFirstCharacters(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i457=0;_i457<length;_i457++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i457));}return magic;}var DEFAULT_CHUNK_SIZE$2=256*1024;function makeStringIterator(string,options){var chunkSize,offset,textEncoder,chunkLength,chunk;return _regenerator().w(function(_context5){while(1)switch(_context5.n){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE$2;offset=0;textEncoder=new TextEncoder();case 1:if(!(offset<string.length)){_context5.n=3;break;}chunkLength=Math.min(string.length-offset,chunkSize);chunk=string.slice(offset,offset+chunkLength);offset+=chunkLength;_context5.n=2;return textEncoder.encode(chunk);case 2:_context5.n=1;break;case 3:return _context5.a(2);}},_marked);}var DEFAULT_CHUNK_SIZE$1=256*1024;function makeArrayBufferIterator(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return/*#__PURE__*/_regenerator().m(function _callee4(){var _options$chunkSize,chunkSize,byteOffset,chunkByteLength,chunk,sourceArray,_chunkArray;return _regenerator().w(function(_context6){while(1)switch(_context6.n){case 0:_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 1:if(!(byteOffset<arrayBuffer.byteLength)){_context6.n=3;break;}chunkByteLength=Math.min(arrayBuffer.byteLength-byteOffset,chunkSize);chunk=new ArrayBuffer(chunkByteLength);sourceArray=new Uint8Array(arrayBuffer,byteOffset,chunkByteLength);_chunkArray=new Uint8Array(chunk);_chunkArray.set(sourceArray);byteOffset+=chunkByteLength;_context6.n=2;return chunk;case 2:_context6.n=1;break;case 3:return _context6.a(2);}},_callee4);})();}var DEFAULT_CHUNK_SIZE=1024*1024;function makeBlobIterator(_x,_x2){return _makeBlobIterator.apply(this,arguments);}function _makeBlobIterator(){_makeBlobIterator=_wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee5(blob,options){var chunkSize,offset,end,chunk;return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE;offset=0;case 1:if(!(offset<blob.size)){_context7.n=4;break;}end=offset+chunkSize;_context7.n=2;return _awaitAsyncGenerator(blob.slice(offset,end).arrayBuffer());case 2:chunk=_context7.v;offset=end;_context7.n=3;return chunk;case 3:_context7.n=1;break;case 4:return _context7.a(2);}},_callee5);}));return _makeBlobIterator.apply(this,arguments);}function makeStreamIterator(stream,options){return isBrowser$2?makeBrowserStreamIterator(stream,options):makeNodeStreamIterator(stream);}function makeBrowserStreamIterator(_x3,_x4){return _makeBrowserStreamIterator.apply(this,arguments);}function _makeBrowserStreamIterator(){_makeBrowserStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee6(stream,options){var reader,nextBatchPromise,currentBatchPromise,_yield$_awaitAsyncGen,done,value,_t2;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:reader=stream.getReader();_context8.p=1;case 2:if(false)// removed by dead control flow
|
|
25068
|
+
{}currentBatchPromise=nextBatchPromise||reader.read();if(options!==null&&options!==void 0&&options._streamReadAhead){nextBatchPromise=reader.read();}_context8.n=3;return _awaitAsyncGenerator(currentBatchPromise);case 3:_yield$_awaitAsyncGen=_context8.v;done=_yield$_awaitAsyncGen.done;value=_yield$_awaitAsyncGen.value;if(!done){_context8.n=4;break;}return _context8.a(2);case 4:_context8.n=5;return toArrayBuffer(value);case 5:_context8.n=2;break;case 6:_context8.n=8;break;case 7:_context8.p=7;_t2=_context8.v;reader.releaseLock();case 8:return _context8.a(2);}},_callee6,null,[[1,7]]);}));return _makeBrowserStreamIterator.apply(this,arguments);}function makeNodeStreamIterator(_x5,_x6){return _makeNodeStreamIterator.apply(this,arguments);}function _makeNodeStreamIterator(){_makeNodeStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee7(stream,options){var _iteratorAbruptCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,chunk,_t3;return _regenerator().w(function(_context9){while(1)switch(_context9.p=_context9.n){case 0:_iteratorAbruptCompletion2=false;_didIteratorError2=false;_context9.p=1;_iterator2=_asyncIterator(stream);case 2:_context9.n=3;return _awaitAsyncGenerator(_iterator2.next());case 3:if(!(_iteratorAbruptCompletion2=!(_step2=_context9.v).done)){_context9.n=5;break;}chunk=_step2.value;_context9.n=4;return toArrayBuffer(chunk);case 4:_iteratorAbruptCompletion2=false;_context9.n=2;break;case 5:_context9.n=7;break;case 6:_context9.p=6;_t3=_context9.v;_didIteratorError2=true;_iteratorError2=_t3;case 7:_context9.p=7;_context9.p=8;if(!(_iteratorAbruptCompletion2&&_iterator2["return"]!=null)){_context9.n=9;break;}_context9.n=9;return _awaitAsyncGenerator(_iterator2["return"]());case 9:_context9.p=9;if(!_didIteratorError2){_context9.n=10;break;}throw _iteratorError2;case 10:return _context9.f(9);case 11:return _context9.f(7);case 12:return _context9.a(2);}},_callee7,null,[[8,,9,11],[1,6,7,12]]);}));return _makeNodeStreamIterator.apply(this,arguments);}function makeIterator(data,options){if(typeof data==='string'){return makeStringIterator(data,options);}if(data instanceof ArrayBuffer){return makeArrayBufferIterator(data,options);}if(isBlob(data)){return makeBlobIterator(data,options);}if(isReadableStream(data)){return makeStreamIterator(data,options);}if(isResponse(data)){var response=data;return makeStreamIterator(response.body,options);}throw new Error('makeIterator');}var ERR_DATA='Cannot convert supplied data type';function getArrayBufferOrStringFromDataSync(data,loader,options){if(loader.text&&typeof data==='string'){return data;}if(isBuffer(data)){data=data.buffer;}if(data instanceof ArrayBuffer){var arrayBuffer=data;if(loader.text&&!loader.binary){var textDecoder=new TextDecoder('utf8');return textDecoder.decode(arrayBuffer);}return arrayBuffer;}if(ArrayBuffer.isView(data)){if(loader.text&&!loader.binary){var _textDecoder=new TextDecoder('utf8');return _textDecoder.decode(data);}var _arrayBuffer=data.buffer;var byteLength=data.byteLength||data.length;if(data.byteOffset!==0||byteLength!==_arrayBuffer.byteLength){_arrayBuffer=_arrayBuffer.slice(data.byteOffset,data.byteOffset+byteLength);}return _arrayBuffer;}throw new Error(ERR_DATA);}function getArrayBufferOrStringFromData(_x25,_x26,_x27){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(data,loader,options){var isArrayBuffer,response,_t17;return _regenerator().w(function(_context21){while(1)switch(_context21.n){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context21.n=1;break;}return _context21.a(2,getArrayBufferOrStringFromDataSync(data,loader));case 1:if(!isBlob(data)){_context21.n=3;break;}_context21.n=2;return makeResponse(data);case 2:data=_context21.v;case 3:if(!isResponse(data)){_context21.n=9;break;}response=data;_context21.n=4;return checkResponse(response);case 4:if(!loader.binary){_context21.n=6;break;}_context21.n=5;return response.arrayBuffer();case 5:_t17=_context21.v;_context21.n=8;break;case 6:_context21.n=7;return response.text();case 7:_t17=_context21.v;case 8:return _context21.a(2,_t17);case 9:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context21.n=10;break;}return _context21.a(2,concatenateArrayBuffersAsync(data));case 10:throw new Error(ERR_DATA);case 11:return _context21.a(2);}},_callee18);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var fetchOptions=options||globalOptions;if(typeof fetchOptions.fetch==='function'){return fetchOptions.fetch;}if(isObject(fetchOptions.fetch)){return function(url){return fetchFile(url,fetchOptions);};}if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}return fetchFile;}function getLoaderContext(context,options,parentContext){if(parentContext){return parentContext;}var newContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(newContext.url){var baseUrl=stripQueryString(newContext.url);newContext.baseUrl=baseUrl;newContext.queryString=extractQueryString(newContext.url);newContext.filename=filename(baseUrl);newContext.baseUrl=dirname(baseUrl);}if(!Array.isArray(newContext.loaders)){newContext.loaders=null;}return newContext;}function getLoadersFromContext(loaders,context){if(!context&&loaders&&!Array.isArray(loaders)){return loaders;}var candidateLoaders;if(loaders){candidateLoaders=Array.isArray(loaders)?loaders:[loaders];}if(context&&context.loaders){var contextLoaders=Array.isArray(context.loaders)?context.loaders:[context.loaders];candidateLoaders=candidateLoaders?[].concat(_toConsumableArray(candidateLoaders),_toConsumableArray(contextLoaders)):contextLoaders;}return candidateLoaders&&candidateLoaders.length?candidateLoaders:null;}function parse$2(_x28,_x29,_x30,_x31){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regenerator().w(function(_context22){while(1)switch(_context22.n){case 0:assert$4(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context22.n=1;return data;case 1:data=_context22.v;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context22.n=2;return selectLoader(data,candidateLoaders,options);case 2:loader=_context22.v;if(loader){_context22.n=3;break;}return _context22.a(2,null);case 3:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context22.n=4;return parseWithLoader(loader,data,options,context);case 4:return _context22.a(2,_context22.v);}},_callee19);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x32,_x33,_x34,_x35){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regenerator().w(function(_context23){while(1)switch(_context23.n){case 0:validateWorkerVersion(loader);if(isResponse(data)){response=data;ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;headers=Object.fromEntries(response.headers.entries());context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context23.n=1;return getArrayBufferOrStringFromData(data,loader,options);case 1:data=_context23.v;if(!(loader.parseTextSync&&typeof data==='string')){_context23.n=2;break;}options.dataType='text';return _context23.a(2,loader.parseTextSync(data,options,context,loader));case 2:if(!canParseWithWorker(loader,options)){_context23.n=4;break;}_context23.n=3;return parseWithWorker(loader,data,options,context,parse$2);case 3:return _context23.a(2,_context23.v);case 4:if(!(loader.parseText&&typeof data==='string')){_context23.n=6;break;}_context23.n=5;return loader.parseText(data,options,context,loader);case 5:return _context23.a(2,_context23.v);case 6:if(!loader.parse){_context23.n=8;break;}_context23.n=7;return loader.parse(data,options,context,loader);case 7:return _context23.a(2,_context23.v);case 8:assert$4(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 9:return _context23.a(2);}},_callee20);}));return _parseWithLoader.apply(this,arguments);}var VERSION$5="3.4.15";var VERSION$4="3.4.15";var VERSION$3="3.4.15";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/dist/libs/basis_encoder.js");var loadBasisTranscoderPromise;function loadBasisTrascoderModule(_x36){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(options){var modules;return _regenerator().w(function(_context24){while(1)switch(_context24.n){case 0:modules=options.modules||{};if(!modules.basis){_context24.n=1;break;}return _context24.a(2,modules.basis);case 1:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context24.n=2;return loadBasisTranscoderPromise;case 2:return _context24.a(2,_context24.v);}},_callee21);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x37){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2,_t18,_t19,_t20;return _regenerator().w(function(_context25){while(1)switch(_context25.n){case 0:BASIS=null;wasmBinary=null;_t18=Promise;_context25.n=1;return loadLibrary('basis_transcoder.js','textures',options);case 1:_t19=_context25.v;_context25.n=2;return loadLibrary('basis_transcoder.wasm','textures',options);case 2:_t20=_context25.v;_context25.n=3;return _t18.all.call(_t18,[_t19,_t20]);case 3:_yield$Promise$all=_context25.v;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context25.n=4;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 4:return _context25.a(2,_context25.v);}},_callee22);}));return _loadBasisTrascoder.apply(this,arguments);}function initializeBasisTrascoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;function loadBasisEncoderModule(_x38){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(options){var modules;return _regenerator().w(function(_context26){while(1)switch(_context26.n){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context26.n=1;break;}return _context26.a(2,modules.basisEncoder);case 1:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context26.n=2;return loadBasisEncoderPromise;case 2:return _context26.a(2,_context26.v);}},_callee23);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x39){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4,_t21,_t22,_t23;return _regenerator().w(function(_context27){while(1)switch(_context27.n){case 0:BASIS_ENCODER=null;wasmBinary=null;_t21=Promise;_context27.n=1;return loadLibrary(BASIS_CDN_ENCODER_JS,'textures',options);case 1:_t22=_context27.v;_context27.n=2;return loadLibrary(BASIS_CDN_ENCODER_WASM,'textures',options);case 2:_t23=_context27.v;_context27.n=3;return _t21.all.call(_t21,[_t22,_t23]);case 3:_yield$Promise$all3=_context27.v;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS_ENCODER=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context27.n=4;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 4:return _context27.a(2,_context27.v);}},_callee24);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisEncoderModule(options).then(function(module){var BasisFile=module.BasisFile,KTX2File=module.KTX2File,initializeBasis=module.initializeBasis,BasisEncoder=module.BasisEncoder;initializeBasis();resolve({BasisFile:BasisFile,KTX2File:KTX2File,BasisEncoder:BasisEncoder});});});}var GL_EXTENSIONS_CONSTANTS={COMPRESSED_RGB_S3TC_DXT1_EXT:0x83f0,COMPRESSED_RGBA_S3TC_DXT1_EXT:0x83f1,COMPRESSED_RGBA_S3TC_DXT3_EXT:0x83f2,COMPRESSED_RGBA_S3TC_DXT5_EXT:0x83f3,COMPRESSED_R11_EAC:0x9270,COMPRESSED_SIGNED_R11_EAC:0x9271,COMPRESSED_RG11_EAC:0x9272,COMPRESSED_SIGNED_RG11_EAC:0x9273,COMPRESSED_RGB8_ETC2:0x9274,COMPRESSED_RGBA8_ETC2_EAC:0x9275,COMPRESSED_SRGB8_ETC2:0x9276,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:0x9277,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9278,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9279,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:0x8c00,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:0x8c02,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:0x8c01,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:0x8c03,COMPRESSED_RGB_ETC1_WEBGL:0x8d64,COMPRESSED_RGB_ATC_WEBGL:0x8c92,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:0x8c93,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:0x87ee,COMPRESSED_RGBA_ASTC_4X4_KHR:0x93b0,COMPRESSED_RGBA_ASTC_5X4_KHR:0x93b1,COMPRESSED_RGBA_ASTC_5X5_KHR:0x93b2,COMPRESSED_RGBA_ASTC_6X5_KHR:0x93b3,COMPRESSED_RGBA_ASTC_6X6_KHR:0x93b4,COMPRESSED_RGBA_ASTC_8X5_KHR:0x93b5,COMPRESSED_RGBA_ASTC_8X6_KHR:0x93b6,COMPRESSED_RGBA_ASTC_8X8_KHR:0x93b7,COMPRESSED_RGBA_ASTC_10X5_KHR:0x93b8,COMPRESSED_RGBA_ASTC_10X6_KHR:0x93b9,COMPRESSED_RGBA_ASTC_10X8_KHR:0x93ba,COMPRESSED_RGBA_ASTC_10X10_KHR:0x93bb,COMPRESSED_RGBA_ASTC_12X10_KHR:0x93bc,COMPRESSED_RGBA_ASTC_12X12_KHR:0x93bd,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:0x93d0,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:0x93d1,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:0x93d2,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:0x93d3,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:0x93d4,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:0x93d5,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:0x93d6,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:0x93d7,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:0x93d8,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:0x93d9,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:0x93da,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:0x93db,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:0x93dc,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:0x93dd,COMPRESSED_RED_RGTC1_EXT:0x8dbb,COMPRESSED_SIGNED_RED_RGTC1_EXT:0x8dbc,COMPRESSED_RED_GREEN_RGTC2_EXT:0x8dbd,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:0x8dbe,COMPRESSED_SRGB_S3TC_DXT1_EXT:0x8c4c,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:0x8c4d,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:0x8c4e,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:0x8c4f};var BROWSER_PREFIXES=['','WEBKIT_','MOZ_'];var WEBGL_EXTENSIONS={WEBGL_compressed_texture_s3tc:'dxt',WEBGL_compressed_texture_s3tc_srgb:'dxt-srgb',WEBGL_compressed_texture_etc1:'etc1',WEBGL_compressed_texture_etc:'etc2',WEBGL_compressed_texture_pvrtc:'pvrtc',WEBGL_compressed_texture_atc:'atc',WEBGL_compressed_texture_astc:'astc',EXT_texture_compression_rgtc:'rgtc'};var formats=null;function getSupportedGPUTextureFormats(gl){if(!formats){gl=gl||getWebGLContext()||undefined;formats=new Set();var _iterator16=_createForOfIteratorHelper(BROWSER_PREFIXES),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var prefix=_step16.value;for(var extension in WEBGL_EXTENSIONS){if(gl&&gl.getExtension("".concat(prefix).concat(extension))){var gpuTextureFormat=WEBGL_EXTENSIONS[extension];formats.add(gpuTextureFormat);}}}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}}return formats;}function getWebGLContext(){try{var canvas=document.createElement('canvas');return canvas.getContext('webgl');}catch(error){return null;}}var n,i,s,a,r,o,l,f;!function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB";}(n||(n={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT";}(i||(i={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC";}(s||(s={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB";}(a||(a={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2";}(r||(r={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED";}(o||(o={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA";}(l||(l={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG";}(f||(f={}));var KTX2_ID=[0xab,0x4b,0x54,0x58,0x20,0x32,0x30,0xbb,0x0d,0x0a,0x1a,0x0a];function isKTX(data){var id=new Uint8Array(data);var notKTX=id.byteLength<KTX2_ID.length||id[0]!==KTX2_ID[0]||id[1]!==KTX2_ID[1]||id[2]!==KTX2_ID[2]||id[3]!==KTX2_ID[3]||id[4]!==KTX2_ID[4]||id[5]!==KTX2_ID[5]||id[6]!==KTX2_ID[6]||id[7]!==KTX2_ID[7]||id[8]!==KTX2_ID[8]||id[9]!==KTX2_ID[9]||id[10]!==KTX2_ID[10]||id[11]!==KTX2_ID[11];return!notKTX;}var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:true},bc1:{basisFormat:2,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:true},bc5:{basisFormat:5,compressed:true},'bc7-m6-opaque-only':{basisFormat:6,compressed:true},'bc7-m5':{basisFormat:7,compressed:true},'pvrtc1-4-rgb':{basisFormat:8,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},'pvrtc1-4-rgba':{basisFormat:9,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},'astc-4x4':{basisFormat:10,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR},'atc-rgb':{basisFormat:11,compressed:true},'atc-rgba-interpolated-alpha':{basisFormat:12,compressed:true},rgba32:{basisFormat:13,compressed:false},rgb565:{basisFormat:14,compressed:false},bgr565:{basisFormat:15,compressed:false},rgba4444:{basisFormat:16,compressed:false}};function parseBasis(_x40,_x41){return _parseBasis.apply(this,arguments);}function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(data,options){var fileConstructors,_yield$loadBasisTrasc,BasisFile,_fileConstructors,_yield$loadBasisTrasc2,_BasisFile,_t24,_t25;return _regenerator().w(function(_context28){while(1)switch(_context28.n){case 0:if(!(options.basis.containerFormat==='auto')){_context28.n=4;break;}if(!isKTX(data)){_context28.n=2;break;}_context28.n=1;return loadBasisEncoderModule(options);case 1:fileConstructors=_context28.v;return _context28.a(2,parseKTX2File(fileConstructors.KTX2File,data,options));case 2:_context28.n=3;return loadBasisTrascoderModule(options);case 3:_yield$loadBasisTrasc=_context28.v;BasisFile=_yield$loadBasisTrasc.BasisFile;return _context28.a(2,parseBasisFile(BasisFile,data,options));case 4:_t24=options.basis.module;_context28.n=_t24==='encoder'?5:_t24==='transcoder'?9:9;break;case 5:_context28.n=6;return loadBasisEncoderModule(options);case 6:_fileConstructors=_context28.v;_t25=options.basis.containerFormat;_context28.n=_t25==='ktx2'?7:_t25==='basis'?8:8;break;case 7:return _context28.a(2,parseKTX2File(_fileConstructors.KTX2File,data,options));case 8:return _context28.a(2,parseBasisFile(_fileConstructors.BasisFile,data,options));case 9:_context28.n=10;return loadBasisTrascoderModule(options);case 10:_yield$loadBasisTrasc2=_context28.v;_BasisFile=_yield$loadBasisTrasc2.BasisFile;return _context28.a(2,parseBasisFile(_BasisFile,data,options));case 11:return _context28.a(2);}},_callee25);}));return _parseBasis.apply(this,arguments);}function parseBasisFile(BasisFile,data,options){var basisFile=new BasisFile(new Uint8Array(data));try{if(!basisFile.startTranscoding()){throw new Error('Failed to start basis transcoding');}var imageCount=basisFile.getNumImages();var images=[];for(var imageIndex=0;imageIndex<imageCount;imageIndex++){var levelsCount=basisFile.getNumLevels(imageIndex);var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeImage(basisFile,imageIndex,levelIndex,options));}images.push(levels);}return images;}finally{basisFile.close();basisFile["delete"]();}}function transcodeImage(basisFile,imageIndex,levelIndex,options){var width=basisFile.getImageWidth(imageIndex,levelIndex);var height=basisFile.getImageHeight(imageIndex,levelIndex);var hasAlpha=basisFile.getHasAlpha();var _getBasisOptions=getBasisOptions(options,hasAlpha),compressed=_getBasisOptions.compressed,format=_getBasisOptions.format,basisFormat=_getBasisOptions.basisFormat;var decodedSize=basisFile.getImageTranscodedSizeInBytes(imageIndex,levelIndex,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!basisFile.transcodeImage(decodedData,imageIndex,levelIndex,basisFormat,0,0)){throw new Error('failed to start Basis transcoding');}return{width:width,height:height,data:decodedData,compressed:compressed,format:format,hasAlpha:hasAlpha};}function parseKTX2File(KTX2File,data,options){var ktx2File=new KTX2File(new Uint8Array(data));try{if(!ktx2File.startTranscoding()){throw new Error('failed to start KTX2 transcoding');}var levelsCount=ktx2File.getLevels();var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeKTX2Image(ktx2File,levelIndex,options));break;}return[levels];}finally{ktx2File.close();ktx2File["delete"]();}}function transcodeKTX2Image(ktx2File,levelIndex,options){var _ktx2File$getImageLev=ktx2File.getImageLevelInfo(levelIndex,0,0),alphaFlag=_ktx2File$getImageLev.alphaFlag,height=_ktx2File$getImageLev.height,width=_ktx2File$getImageLev.width;var _getBasisOptions2=getBasisOptions(options,alphaFlag),compressed=_getBasisOptions2.compressed,format=_getBasisOptions2.format,basisFormat=_getBasisOptions2.basisFormat;var decodedSize=ktx2File.getImageTranscodedSizeInBytes(levelIndex,0,0,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!ktx2File.transcodeImage(decodedData,levelIndex,0,0,basisFormat,0,-1,-1)){throw new Error('Failed to transcode KTX2 image');}return{width:width,height:height,data:decodedData,compressed:compressed,levelSize:decodedSize,hasAlpha:alphaFlag,format:format};}function getBasisOptions(options,hasAlpha){var format=options&&options.basis&&options.basis.format;if(format==='auto'){format=selectSupportedBasisFormat();}if(_typeof2(format)==='object'){format=hasAlpha?format.alpha:format.noAlpha;}format=format.toLowerCase();return OutputFormat[format];}function selectSupportedBasisFormat(){var supportedFormats=getSupportedGPUTextureFormats();if(supportedFormats.has('astc')){return'astc-4x4';}else if(supportedFormats.has('dxt')){return{alpha:'bc3',noAlpha:'bc1'};}else if(supportedFormats.has('pvrtc')){return{alpha:'pvrtc1-4-rgba',noAlpha:'pvrtc1-4-rgb'};}else if(supportedFormats.has('etc1')){return'etc1';}else if(supportedFormats.has('etc2')){return'etc2';}return'rgb565';}var BasisWorkerLoader={name:'Basis',id:isBrowser$1?'basis':'basis-nodejs',module:'textures',version:VERSION$4,worker:true,extensions:['basis','ktx2'],mimeTypes:['application/octet-stream','image/ktx2'],tests:['sB'],binary:true,options:{basis:{format:'auto',libraryPath:'libs/',containerFormat:'auto',module:'transcoder'}}};var BasisLoader=_objectSpread(_objectSpread({},BasisWorkerLoader),{},{parse:parseBasis});var VERSION$2="3.4.15";var _parseImageNode=globalThis._parseImageNode;var IMAGE_SUPPORTED=typeof Image!=='undefined';var IMAGE_BITMAP_SUPPORTED=typeof ImageBitmap!=='undefined';var NODE_IMAGE_SUPPORTED=Boolean(_parseImageNode);var DATA_SUPPORTED=isBrowser$2?true:NODE_IMAGE_SUPPORTED;function isImageTypeSupported(type){switch(type){case'auto':return IMAGE_BITMAP_SUPPORTED||IMAGE_SUPPORTED||DATA_SUPPORTED;case'imagebitmap':return IMAGE_BITMAP_SUPPORTED;case'image':return IMAGE_SUPPORTED;case'data':return DATA_SUPPORTED;default:throw new Error("@loaders.gl/images: image ".concat(type," not supported in this environment"));}}function getDefaultImageType(){if(IMAGE_BITMAP_SUPPORTED){return'imagebitmap';}if(IMAGE_SUPPORTED){return'image';}if(DATA_SUPPORTED){return'data';}throw new Error('Install \'@loaders.gl/polyfills\' to parse images under Node.js');}function getImageType(image){var format=getImageTypeOrNull(image);if(!format){throw new Error('Not an image');}return format;}function getImageData(image){switch(getImageType(image)){case'data':return image;case'image':case'imagebitmap':var _canvas6=document.createElement('canvas');var context=_canvas6.getContext('2d');if(!context){throw new Error('getImageData');}_canvas6.width=image.width;_canvas6.height=image.height;context.drawImage(image,0,0);return context.getImageData(0,0,image.width,image.height);default:throw new Error('getImageData');}}function getImageTypeOrNull(image){if(typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){return'imagebitmap';}if(typeof Image!=='undefined'&&image instanceof Image){return'image';}if(image&&_typeof2(image)==='object'&&image.data&&image.width&&image.height){return'data';}return null;}var SVG_DATA_URL_PATTERN=/^data:image\/svg\+xml/;var SVG_URL_PATTERN=/\.svg((\?|#).*)?$/;function isSVG(url){return url&&(SVG_DATA_URL_PATTERN.test(url)||SVG_URL_PATTERN.test(url));}function getBlobOrSVGDataUrl(arrayBuffer,url){if(isSVG(url)){var textDecoder=new TextDecoder();var xmlText=textDecoder.decode(arrayBuffer);try{if(typeof unescape==='function'&&typeof encodeURIComponent==='function'){xmlText=unescape(encodeURIComponent(xmlText));}}catch(error){throw new Error(error.message);}var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return getBlob(arrayBuffer,url);}function getBlob(arrayBuffer,url){if(isSVG(url)){throw new Error('SVG cannot be parsed directly to imagebitmap');}return new Blob([new Uint8Array(arrayBuffer)]);}function parseToImage(_x42,_x43,_x44){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regenerator().w(function(_context29){while(1)switch(_context29.p=_context29.n){case 0:blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context29.p=1;_context29.n=2;return loadToImage(objectUrl||blobOrDataUrl,options);case 2:return _context29.a(2,_context29.v);case 3:_context29.p=3;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context29.f(3);case 4:return _context29.a(2);}},_callee26,null,[[1,,3,4]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x45,_x46){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(url,options){var image;return _regenerator().w(function(_context30){while(1)switch(_context30.n){case 0:image=new Image();image.src=url;if(!(options.image&&options.image.decode&&image.decode)){_context30.n=2;break;}_context30.n=1;return image.decode();case 1:return _context30.a(2,image);case 2:_context30.n=3;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(err){return reject(new Error("Could not load image ".concat(url,": ").concat(err)));};}catch(error){reject(error);}});case 3:return _context30.a(2,_context30.v);}},_callee27);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;function parseToImageBitmap(_x47,_x48,_x49){return _parseToImageBitmap.apply(this,arguments);}function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regenerator().w(function(_context31){while(1)switch(_context31.n){case 0:if(!isSVG(url)){_context31.n=2;break;}_context31.n=1;return parseToImage(arrayBuffer,options,url);case 1:_image7=_context31.v;blob=_image7;_context31.n=3;break;case 2:blob=getBlob(arrayBuffer,url);case 3:imagebitmapOptions=options&&options.imagebitmap;_context31.n=4;return safeCreateImageBitmap(blob,imagebitmapOptions);case 4:return _context31.a(2,_context31.v);}},_callee28);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x50){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(blob){var imagebitmapOptions,_args25=arguments,_t26;return _regenerator().w(function(_context32){while(1)switch(_context32.p=_context32.n){case 0:imagebitmapOptions=_args25.length>1&&_args25[1]!==undefined?_args25[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context32.n=4;break;}_context32.p=1;_context32.n=2;return createImageBitmap(blob,imagebitmapOptions);case 2:return _context32.a(2,_context32.v);case 3:_context32.p=3;_t26=_context32.v;console.warn(_t26);imagebitmapOptionsSupported=false;case 4:_context32.n=5;return createImageBitmap(blob);case 5:return _context32.a(2,_context32.v);}},_callee29,null,[[1,3]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){return false;}return true;}function getISOBMFFMediaType(buffer){if(!checkString(buffer,'ftyp',4)){return null;}if((buffer[8]&0x60)===0x00){return null;}return decodeMajorBrand(buffer);}function decodeMajorBrand(buffer){var brandMajor=getUTF8String(buffer,8,12).replace('\0',' ').trim();switch(brandMajor){case'avif':case'avis':return{extension:'avif',mimeType:'image/avif'};default:return null;}}function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i458=0;_i458<headerBytes.length;++_i458){if(headerBytes[_i458]!==buffer[_i458+offset]){return false;}}return true;}var BIG_ENDIAN=false;var LITTLE_ENDIAN=true;function getBinaryImageMetadata(binaryData){var dataView=toDataView(binaryData);return getPngMetadata(dataView)||getJpegMetadata(dataView)||getGifMetadata(dataView)||getBmpMetadata(dataView)||getISOBMFFMetadata(dataView);}function getISOBMFFMetadata(binaryData){var buffer=new Uint8Array(binaryData instanceof DataView?binaryData.buffer:binaryData);var mediaType=getISOBMFFMediaType(buffer);if(!mediaType){return null;}return{mimeType:mediaType.mimeType,width:0,height:0};}function getPngMetadata(binaryData){var dataView=toDataView(binaryData);var isPng=dataView.byteLength>=24&&dataView.getUint32(0,BIG_ENDIAN)===0x89504e47;if(!isPng){return null;}return{mimeType:'image/png',width:dataView.getUint32(16,BIG_ENDIAN),height:dataView.getUint32(20,BIG_ENDIAN)};}function getGifMetadata(binaryData){var dataView=toDataView(binaryData);var isGif=dataView.byteLength>=10&&dataView.getUint32(0,BIG_ENDIAN)===0x47494638;if(!isGif){return null;}return{mimeType:'image/gif',width:dataView.getUint16(6,LITTLE_ENDIAN),height:dataView.getUint16(8,LITTLE_ENDIAN)};}function getBmpMetadata(binaryData){var dataView=toDataView(binaryData);var isBmp=dataView.byteLength>=14&&dataView.getUint16(0,BIG_ENDIAN)===0x424d&&dataView.getUint32(2,LITTLE_ENDIAN)===dataView.byteLength;if(!isBmp){return null;}return{mimeType:'image/bmp',width:dataView.getUint32(18,LITTLE_ENDIAN),height:dataView.getUint32(22,LITTLE_ENDIAN)};}function getJpegMetadata(binaryData){var dataView=toDataView(binaryData);var isJpeg=dataView.byteLength>=3&&dataView.getUint16(0,BIG_ENDIAN)===0xffd8&&dataView.getUint8(2)===0xff;if(!isJpeg){return null;}var _getJpegMarkers=getJpegMarkers(),tableMarkers=_getJpegMarkers.tableMarkers,sofMarkers=_getJpegMarkers.sofMarkers;var i=2;while(i+9<dataView.byteLength){var marker=dataView.getUint16(i,BIG_ENDIAN);if(sofMarkers.has(marker)){return{mimeType:'image/jpeg',height:dataView.getUint16(i+5,BIG_ENDIAN),width:dataView.getUint16(i+7,BIG_ENDIAN)};}if(!tableMarkers.has(marker)){return null;}i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i459=0xffe0;_i459<0xfff0;++_i459){tableMarkers.add(_i459);}var sofMarkers=new Set([0xffc0,0xffc1,0xffc2,0xffc3,0xffc5,0xffc6,0xffc7,0xffc9,0xffca,0xffcb,0xffcd,0xffce,0xffcf,0xffde]);return{tableMarkers:tableMarkers,sofMarkers:sofMarkers};}function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuffer.isView(data)){return new DataView(data.buffer);}if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}function parseToNodeImage(_x51,_x52){return _parseToNodeImage.apply(this,arguments);}function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(arrayBuffer,options){var _ref23,mimeType,_parseImageNode;return _regenerator().w(function(_context33){while(1)switch(_context33.n){case 0:_ref23=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref23.mimeType;_parseImageNode=globalThis._parseImageNode;assert$5(_parseImageNode);_context33.n=1;return _parseImageNode(arrayBuffer,mimeType);case 1:return _context33.a(2,_context33.v);}},_callee30);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x53,_x54,_x55){return _parseImage.apply(this,arguments);}function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(arrayBuffer,options,context){var imageOptions,imageType,_ref24,url,loadType,image,_t27;return _regenerator().w(function(_context34){while(1)switch(_context34.n){case 0:options=options||{};imageOptions=options.image||{};imageType=imageOptions.type||'auto';_ref24=context||{},url=_ref24.url;loadType=getLoadableImageType(imageType);_t27=loadType;_context34.n=_t27==='imagebitmap'?1:_t27==='image'?3:_t27==='data'?5:7;break;case 1:_context34.n=2;return parseToImageBitmap(arrayBuffer,options,url);case 2:image=_context34.v;return _context34.a(3,8);case 3:_context34.n=4;return parseToImage(arrayBuffer,options,url);case 4:image=_context34.v;return _context34.a(3,8);case 5:_context34.n=6;return parseToNodeImage(arrayBuffer);case 6:image=_context34.v;return _context34.a(3,8);case 7:assert$5(false);case 8:if(imageType==='data'){image=getImageData(image);}return _context34.a(2,image);}},_callee31);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':return getDefaultImageType();default:isImageTypeSupported(type);return type;}}var EXTENSIONS$1=['png','jpg','jpeg','gif','webp','bmp','ico','svg','avif'];var MIME_TYPES=['image/png','image/jpeg','image/gif','image/webp','image/avif','image/bmp','image/vnd.microsoft.icon','image/svg+xml'];var DEFAULT_IMAGE_LOADER_OPTIONS={image:{type:'auto',decode:true}};var ImageLoader={id:'image',module:'images',name:'Images',version:VERSION$2,mimeTypes:MIME_TYPES,extensions:EXTENSIONS$1,parse:parseImage,tests:[function(arrayBuffer){return Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)));}],options:DEFAULT_IMAGE_LOADER_OPTIONS};var mimeTypeSupportedSync={};function isImageFormatSupported(mimeType){if(mimeTypeSupportedSync[mimeType]===undefined){var supported=isBrowser$2?checkBrowserImageFormatSupport(mimeType):checkNodeImageFormatSupport(mimeType);mimeTypeSupportedSync[mimeType]=supported;}return mimeTypeSupportedSync[mimeType];}function checkNodeImageFormatSupport(mimeType){var NODE_FORMAT_SUPPORT=['image/png','image/jpeg','image/gif'];var _parseImageNode=globalThis._parseImageNode,_globalThis$_imageFor=globalThis._imageFormatsNode,_imageFormatsNode=_globalThis$_imageFor===void 0?NODE_FORMAT_SUPPORT:_globalThis$_imageFor;return Boolean(_parseImageNode)&&_imageFormatsNode.includes(mimeType);}function checkBrowserImageFormatSupport(mimeType){switch(mimeType){case'image/avif':case'image/webp':return testBrowserImageFormatSupport(mimeType);default:return true;}}function testBrowserImageFormatSupport(mimeType){try{var element=document.createElement('canvas');var dataURL=element.toDataURL(mimeType);return dataURL.indexOf("data:".concat(mimeType))===0;}catch(_unused){return false;}}function assert$2(condition,message){if(!condition){throw new Error(message||'assert failed: gltf');}}function resolveUrl(url,options){var absolute=url.startsWith('data:')||url.startsWith('http:')||url.startsWith('https:');if(absolute){return url;}var baseUrl=options.baseUri||options.uri;if(!baseUrl){throw new Error("'baseUri' must be provided to resolve relative url ".concat(url));}return baseUrl.substr(0,baseUrl.lastIndexOf('/')+1)+url;}function getTypedArrayForBufferView(json,buffers,bufferViewIndex){var bufferView=json.bufferViews[bufferViewIndex];assert$2(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$2(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}var TYPES=['SCALAR','VEC2','VEC3','VEC4'];var ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]];var ARRAY_TO_COMPONENT_TYPE=new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);var ATTRIBUTE_TYPE_TO_COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function getAccessorTypeFromSize(size){var type=TYPES[size-1];return type||TYPES[0];}function getComponentTypeFromArray(typedArray){var componentType=ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);if(!componentType){throw new Error('Illegal typed array');}return componentType;}function getAccessorArrayTypeAndLength(accessor,bufferView){var ArrayType=ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];var components=ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];var bytesPerComponent=ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];var length=accessor.count*components;var byteLength=accessor.count*components*bytesPerComponent;assert$2(byteLength>=0&&byteLength<=bufferView.byteLength);return{ArrayType:ArrayType,length:length,byteLength:byteLength};}var DEFAULT_GLTF_JSON={asset:{version:'2.0',generator:'loaders.gl'},buffers:[]};var GLTFScenegraph=/*#__PURE__*/function(){function GLTFScenegraph(gltf){_classCallCheck(this,GLTFScenegraph);_defineProperty(this,"gltf",void 0);_defineProperty(this,"sourceBuffers",void 0);_defineProperty(this,"byteLength",void 0);this.gltf=gltf||{json:_objectSpread({},DEFAULT_GLTF_JSON),buffers:[]};this.sourceBuffers=[];this.byteLength=0;if(this.gltf.buffers&&this.gltf.buffers[0]){this.byteLength=this.gltf.buffers[0].byteLength;this.sourceBuffers=[this.gltf.buffers[0]];}}return _createClass(GLTFScenegraph,[{key:"json",get:function get(){return this.gltf.json;}},{key:"getApplicationData",value:function getApplicationData(key){var data=this.json[key];return data;}},{key:"getExtraData",value:function getExtraData(key){var extras=this.json.extras||{};return extras[key];}},{key:"getExtension",value:function getExtension(extensionName){var isExtension=this.getUsedExtensions().find(function(name){return name===extensionName;});var extensions=this.json.extensions||{};return isExtension?extensions[extensionName]||true:null;}},{key:"getRequiredExtension",value:function getRequiredExtension(extensionName){var isRequired=this.getRequiredExtensions().find(function(name){return name===extensionName;});return isRequired?this.getExtension(extensionName):null;}},{key:"getRequiredExtensions",value:function getRequiredExtensions(){return this.json.extensionsRequired||[];}},{key:"getUsedExtensions",value:function getUsedExtensions(){return this.json.extensionsUsed||[];}},{key:"getRemovedExtensions",value:function getRemovedExtensions(){return this.json.extensionsRemoved||[];}},{key:"getObjectExtension",value:function getObjectExtension(object,extensionName){var extensions=object.extensions||{};return extensions[extensionName];}},{key:"getScene",value:function getScene(index){return this.getObject('scenes',index);}},{key:"getNode",value:function getNode(index){return this.getObject('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this.getObject('skins',index);}},{key:"getMesh",value:function getMesh(index){return this.getObject('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this.getObject('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this.getObject('accessors',index);}},{key:"getTexture",value:function getTexture(index){return this.getObject('textures',index);}},{key:"getSampler",value:function getSampler(index){return this.getObject('samplers',index);}},{key:"getImage",value:function getImage(index){return this.getObject('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this.getObject('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this.getObject('buffers',index);}},{key:"getObject",value:function getObject(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){throw new Error("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"getTypedArrayForBufferView",value:function getTypedArrayForBufferView(bufferView){bufferView=this.getBufferView(bufferView);var bufferIndex=bufferView.buffer;var binChunk=this.gltf.buffers[bufferIndex];assert$2(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"getTypedArrayForAccessor",value:function getTypedArrayForAccessor(accessor){accessor=this.getAccessor(accessor);var bufferView=this.getBufferView(accessor.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var _getAccessorArrayType=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType.ArrayType,length=_getAccessorArrayType.length;var byteOffset=bufferView.byteOffset+accessor.byteOffset;return new ArrayType(arrayBuffer,byteOffset,length);}},{key:"getTypedArrayForImageData",value:function getTypedArrayForImageData(image){image=this.getAccessor(image);var bufferView=this.getBufferView(image.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var byteOffset=bufferView.byteOffset||0;return new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"addApplicationData",value:function addApplicationData(key,data){this.json[key]=data;return this;}},{key:"addExtraData",value:function addExtraData(key,data){this.json.extras=this.json.extras||{};this.json.extras[key]=data;return this;}},{key:"addObjectExtension",value:function addObjectExtension(object,extensionName,data){object.extensions=object.extensions||{};object.extensions[extensionName]=data;this.registerUsedExtension(extensionName);return this;}},{key:"setObjectExtension",value:function setObjectExtension(object,extensionName,data){var extensions=object.extensions||{};extensions[extensionName]=data;}},{key:"removeObjectExtension",value:function removeObjectExtension(object,extensionName){var extensions=object.extensions||{};var extension=extensions[extensionName];delete extensions[extensionName];return extension;}},{key:"addExtension",value:function addExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$2(extensionData);this.json.extensions=this.json.extensions||{};this.json.extensions[extensionName]=extensionData;this.registerUsedExtension(extensionName);return extensionData;}},{key:"addRequiredExtension",value:function addRequiredExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$2(extensionData);this.addExtension(extensionName,extensionData);this.registerRequiredExtension(extensionName);return extensionData;}},{key:"registerUsedExtension",value:function registerUsedExtension(extensionName){this.json.extensionsUsed=this.json.extensionsUsed||[];if(!this.json.extensionsUsed.find(function(ext){return ext===extensionName;})){this.json.extensionsUsed.push(extensionName);}}},{key:"registerRequiredExtension",value:function registerRequiredExtension(extensionName){this.registerUsedExtension(extensionName);this.json.extensionsRequired=this.json.extensionsRequired||[];if(!this.json.extensionsRequired.find(function(ext){return ext===extensionName;})){this.json.extensionsRequired.push(extensionName);}}},{key:"removeExtension",value:function removeExtension(extensionName){if(!this.getExtension(extensionName)){return;}if(this.json.extensionsRequired){this._removeStringFromArray(this.json.extensionsRequired,extensionName);}if(this.json.extensionsUsed){this._removeStringFromArray(this.json.extensionsUsed,extensionName);}if(this.json.extensions){delete this.json.extensions[extensionName];}if(!Array.isArray(this.json.extensionsRemoved)){this.json.extensionsRemoved=[];}var extensionsRemoved=this.json.extensionsRemoved;if(!extensionsRemoved.includes(extensionName)){extensionsRemoved.push(extensionName);}}},{key:"setDefaultScene",value:function setDefaultScene(sceneIndex){this.json.scene=sceneIndex;}},{key:"addScene",value:function addScene(scene){var nodeIndices=scene.nodeIndices;this.json.scenes=this.json.scenes||[];this.json.scenes.push({nodes:nodeIndices});return this.json.scenes.length-1;}},{key:"addNode",value:function addNode(node){var meshIndex=node.meshIndex,matrix=node.matrix;this.json.nodes=this.json.nodes||[];var nodeData={mesh:meshIndex};if(matrix){nodeData.matrix=matrix;}this.json.nodes.push(nodeData);return this.json.nodes.length-1;}},{key:"addMesh",value:function addMesh(mesh){var attributes=mesh.attributes,indices=mesh.indices,material=mesh.material,_mesh$mode=mesh.mode,mode=_mesh$mode===void 0?4:_mesh$mode;var accessors=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessors,mode:mode}]};if(indices){var indicesAccessor=this._addIndices(indices);glTFMesh.primitives[0].indices=indicesAccessor;}if(Number.isFinite(material)){glTFMesh.primitives[0].material=material;}this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addPointCloud",value:function addPointCloud(attributes){var accessorIndices=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessorIndices,mode:0}]};this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addImage",value:function addImage(imageData,mimeTypeOpt){var metadata=getBinaryImageMetadata(imageData);var mimeType=mimeTypeOpt||(metadata===null||metadata===void 0?void 0:metadata.mimeType);var bufferViewIndex=this.addBufferView(imageData);var glTFImage={bufferView:bufferViewIndex,mimeType:mimeType};this.json.images=this.json.images||[];this.json.images.push(glTFImage);return this.json.images.length-1;}},{key:"addBufferView",value:function addBufferView(buffer){var byteLength=buffer.byteLength;assert$2(Number.isFinite(byteLength));this.sourceBuffers=this.sourceBuffers||[];this.sourceBuffers.push(buffer);var glTFBufferView={buffer:0,byteOffset:this.byteLength,byteLength:byteLength};this.byteLength+=padToNBytes(byteLength,4);this.json.bufferViews=this.json.bufferViews||[];this.json.bufferViews.push(glTFBufferView);return this.json.bufferViews.length-1;}},{key:"addAccessor",value:function addAccessor(bufferViewIndex,accessor){var glTFAccessor={bufferView:bufferViewIndex,type:getAccessorTypeFromSize(accessor.size),componentType:accessor.componentType,count:accessor.count,max:accessor.max,min:accessor.min};this.json.accessors=this.json.accessors||[];this.json.accessors.push(glTFAccessor);return this.json.accessors.length-1;}},{key:"addBinaryBuffer",value:function addBinaryBuffer(sourceBuffer){var accessor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{size:3};var bufferViewIndex=this.addBufferView(sourceBuffer);var minMax={min:accessor.min,max:accessor.max};if(!minMax.min||!minMax.max){minMax=this._getAccessorMinMax(sourceBuffer,accessor.size);}var accessorDefaults={size:accessor.size,componentType:getComponentTypeFromArray(sourceBuffer),count:Math.round(sourceBuffer.length/accessor.size),min:minMax.min,max:minMax.max};return this.addAccessor(bufferViewIndex,Object.assign(accessorDefaults,accessor));}},{key:"addTexture",value:function addTexture(texture){var imageIndex=texture.imageIndex;var glTFTexture={source:imageIndex};this.json.textures=this.json.textures||[];this.json.textures.push(glTFTexture);return this.json.textures.length-1;}},{key:"addMaterial",value:function addMaterial(pbrMaterialInfo){this.json.materials=this.json.materials||[];this.json.materials.push(pbrMaterialInfo);return this.json.materials.length-1;}},{key:"createBinaryChunk",value:function createBinaryChunk(){var _this$json,_this$json$buffers;this.gltf.buffers=[];var totalByteLength=this.byteLength;var arrayBuffer=new ArrayBuffer(totalByteLength);var targetArray=new Uint8Array(arrayBuffer);var dstByteOffset=0;var _iterator17=_createForOfIteratorHelper(this.sourceBuffers||[]),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var sourceBuffer=_step17.value;dstByteOffset=copyToArray(sourceBuffer,targetArray,dstByteOffset);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}if((_this$json=this.json)!==null&&_this$json!==void 0&&(_this$json$buffers=_this$json.buffers)!==null&&_this$json$buffers!==void 0&&_this$json$buffers[0]){this.json.buffers[0].byteLength=totalByteLength;}else{this.json.buffers=[{byteLength:totalByteLength}];}this.gltf.binary=arrayBuffer;this.sourceBuffers=[arrayBuffer];}},{key:"_removeStringFromArray",value:function _removeStringFromArray(array,string){var found=true;while(found){var index=array.indexOf(string);if(index>-1){array.splice(index,1);}else{found=false;}}}},{key:"_addAttributes",value:function _addAttributes(){var attributes=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var result={};for(var attributeKey in attributes){var attributeData=attributes[attributeKey];var attrName=this._getGltfAttributeName(attributeKey);var accessor=this.addBinaryBuffer(attributeData.value,attributeData);result[attrName]=accessor;}return result;}},{key:"_addIndices",value:function _addIndices(indices){return this.addBinaryBuffer(indices,{size:1});}},{key:"_getGltfAttributeName",value:function _getGltfAttributeName(attributeName){switch(attributeName.toLowerCase()){case'position':case'positions':case'vertices':return'POSITION';case'normal':case'normals':return'NORMAL';case'color':case'colors':return'COLOR_0';case'texcoord':case'texcoords':return'TEXCOORD_0';default:return attributeName;}}},{key:"_getAccessorMinMax",value:function _getAccessorMinMax(buffer,size){var result={min:null,max:null};if(buffer.length<size){return result;}result.min=[];result.max=[];var initValues=buffer.subarray(0,size);var _iterator18=_createForOfIteratorHelper(initValues),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var value=_step18.value;result.min.push(value);result.max.push(value);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}for(var index=size;index<buffer.length;index+=size){for(var componentIndex=0;componentIndex<size;componentIndex++){result.min[0+componentIndex]=Math.min(result.min[0+componentIndex],buffer[index+componentIndex]);result.max[0+componentIndex]=Math.max(result.max[0+componentIndex],buffer[index+componentIndex]);}}return result;}}]);}();var wasm_base='B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB';var wasm_simd='B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';var detector=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);var FILTERS={0:'',1:'meshopt_decodeFilterOct',2:'meshopt_decodeFilterQuat',3:'meshopt_decodeFilterExp',NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};function meshoptDecodeGltfBuffer(_x56,_x57,_x58,_x59,_x60){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(target,count,size,source,mode){var filter,instance,_args28=arguments;return _regenerator().w(function(_context35){while(1)switch(_context35.n){case 0:filter=_args28.length>5&&_args28[5]!==undefined?_args28[5]:'NONE';_context35.n=1;return loadWasmInstance();case 1:instance=_context35.v;decode$7(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 2:return _context35.a(2);}},_callee32);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(){return _regenerator().w(function(_context36){while(1)switch(_context36.n){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context36.a(2,wasmPromise);}},_callee33);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(){var wasm,result;return _regenerator().w(function(_context37){while(1)switch(_context37.n){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context37.n=1;return WebAssembly.instantiate(unpack(wasm),{});case 1:result=_context37.v;_context37.n=2;return result.instance.exports.__wasm_call_ctors();case 2:return _context37.a(2,result.instance);}},_callee34);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i460=0;_i460<data.length;++_i460){var ch=data.charCodeAt(_i460);result[_i460]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i461=0;_i461<data.length;++_i461){result[write++]=result[_i461]<60?wasmpack[result[_i461]]:(result[_i461]-60)*64+result[++_i461];}return result.buffer.slice(0,write);}function decode$7(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;var tp=sbrk(count4*size);var sp=sbrk(source.length);var heap=new Uint8Array(instance.exports.memory.buffer);heap.set(source,sp);var res=fun(tp,count,size,sp,source.length);if(res===0&&filter){filter(tp,count4,size);}target.set(heap.subarray(tp,tp+count*size));sbrk(tp-sbrk(0));if(res!==0){throw new Error("Malformed buffer data: ".concat(res));}}var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$8=EXT_MESHOPT_COMPRESSION;function decode$6(_x61,_x62){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(gltfData,options){var _options$gltf,scenegraph,promises,_iterator48,_step48,bufferViewIndex;return _regenerator().w(function(_context38){while(1)switch(_context38.n){case 0:scenegraph=new GLTFScenegraph(gltfData);if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context38.n=1;break;}return _context38.a(2);case 1:promises=[];_iterator48=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){bufferViewIndex=_step48.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}_context38.n=2;return Promise.all(promises);case 2:scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 3:return _context38.a(2);}},_callee35);}));return _decode$.apply(this,arguments);}function decodeMeshoptBufferView(_x63,_x64){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regenerator().w(function(_context39){while(1)switch(_context39.n){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context39.n=2;break;}_meshoptExtension$byt=meshoptExtension.byteOffset,byteOffset=_meshoptExtension$byt===void 0?0:_meshoptExtension$byt,_meshoptExtension$byt2=meshoptExtension.byteLength,byteLength=_meshoptExtension$byt2===void 0?0:_meshoptExtension$byt2,byteStride=meshoptExtension.byteStride,count=meshoptExtension.count,mode=meshoptExtension.mode,_meshoptExtension$fil=meshoptExtension.filter,filter=_meshoptExtension$fil===void 0?'NONE':_meshoptExtension$fil,bufferIndex=meshoptExtension.buffer;buffer=scenegraph.gltf.buffers[bufferIndex];source=new Uint8Array(buffer.arrayBuffer,buffer.byteOffset+byteOffset,byteLength);result=new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer,bufferView.byteOffset,bufferView.byteLength);_context39.n=1;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 1:return _context39.a(2,result);case 2:return _context39.a(2,null);}},_callee36);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$6});var EXT_TEXTURE_WEBP='EXT_texture_webp';var name$7=EXT_TEXTURE_WEBP;function preprocess$3(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);if(!isImageFormatSupported('image/webp')){if(scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)){throw new Error("gltf: Required extension ".concat(EXT_TEXTURE_WEBP," not supported by browser"));}return;}var json=scenegraph.json;var _iterator19=_createForOfIteratorHelper(json.textures||[]),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var texture=_step19.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});var KHR_TEXTURE_BASISU='KHR_texture_basisu';var name$6=KHR_TEXTURE_BASISU;function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator20=_createForOfIteratorHelper(json.textures||[]),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var texture=_step20.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){texture.source=extension.source;}scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});var VERSION$1="3.4.15";var DEFAULT_DRACO_OPTIONS={draco:{decoderType:(typeof WebAssembly==="undefined"?"undefined":_typeof2(WebAssembly))==='object'?'wasm':'js',libraryPath:'libs/',extraAttributes:{},attributeNameEntry:undefined}};var DracoLoader$1={name:'Draco',id:isBrowser$1?'draco':'draco-nodejs',module:'draco',shapes:['mesh'],version:VERSION$1,worker:true,extensions:['drc'],mimeTypes:['application/octet-stream'],binary:true,tests:['DRACO'],options:DEFAULT_DRACO_OPTIONS};function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i462=0;_i462<len;_i462+=3){var x=positions[_i462];var y=positions[_i462+1];var _z4=positions[_i462+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert$1(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var Schema=/*#__PURE__*/function(){function Schema(fields,metadata){_classCallCheck(this,Schema);_defineProperty(this,"fields",void 0);_defineProperty(this,"metadata",void 0);assert$1(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}return _createClass(Schema,[{key:"compareTo",value:function compareTo(other){if(this.metadata!==other.metadata){return false;}if(this.fields.length!==other.fields.length){return false;}for(var _i463=0;_i463<this.fields.length;++_i463){if(!this.fields[_i463].compareTo(other.fields[_i463])){return false;}}return true;}},{key:"select",value:function select(){var nameMap=Object.create(null);for(var _len=arguments.length,columnNames=new Array(_len),_key=0;_key<_len;_key++){columnNames[_key]=arguments[_key];}for(var _i464=0,_columnNames=columnNames;_i464<_columnNames.length;_i464++){var _name6=_columnNames[_i464];nameMap[_name6]=true;}var selectedFields=this.fields.filter(function(field){return nameMap[field.name];});return new Schema(selectedFields,this.metadata);}},{key:"selectAt",value:function selectAt(){var _this117=this;for(var _len2=arguments.length,columnIndices=new Array(_len2),_key2=0;_key2<_len2;_key2++){columnIndices[_key2]=arguments[_key2];}var selectedFields=columnIndices.map(function(index){return _this117.fields[index];}).filter(Boolean);return new Schema(selectedFields,this.metadata);}},{key:"assign",value:function assign(schemaOrFields){var fields;var metadata=this.metadata;if(schemaOrFields instanceof Schema){var otherSchema=schemaOrFields;fields=otherSchema.fields;metadata=mergeMaps(mergeMaps(new Map(),this.metadata),otherSchema.metadata);}else{fields=schemaOrFields;}var fieldMap=Object.create(null);var _iterator21=_createForOfIteratorHelper(this.fields),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var field=_step21.value;fieldMap[field.name]=field;}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}var _iterator22=_createForOfIteratorHelper(fields),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _field=_step22.value;fieldMap[_field.name]=_field;}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}var mergedFields=Object.values(fieldMap);return new Schema(mergedFields,metadata);}}]);}();function checkNames(fields){var usedNames={};var _iterator23=_createForOfIteratorHelper(fields),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var field=_step23.value;if(usedNames[field.name]){console.warn('Schema: duplicated field name',field.name,field);}usedNames[field.name]=true;}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}}function mergeMaps(m1,m2){return new Map([].concat(_toConsumableArray(m1||new Map()),_toConsumableArray(m2||new Map())));}var Field=/*#__PURE__*/function(){function Field(name,type){_classCallCheck(this,Field);var nullable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_defineProperty(this,"name",void 0);_defineProperty(this,"type",void 0);_defineProperty(this,"nullable",void 0);_defineProperty(this,"metadata",void 0);this.name=name;this.type=type;this.nullable=nullable;this.metadata=metadata;}return _createClass(Field,[{key:"typeId",get:function get(){return this.type&&this.type.typeId;}},{key:"clone",value:function clone(){return new Field(this.name,this.type,this.nullable,this.metadata);}},{key:"compareTo",value:function compareTo(other){return this.name===other.name&&this.type===other.type&&this.nullable===other.nullable&&this.metadata===other.metadata;}},{key:"toString",value:function toString(){return"".concat(this.type).concat(this.nullable?', nullable':'').concat(this.metadata?", metadata: ".concat(this.metadata):'');}}]);}();var Type=function(Type){Type[Type["NONE"]=0]="NONE";Type[Type["Null"]=1]="Null";Type[Type["Int"]=2]="Int";Type[Type["Float"]=3]="Float";Type[Type["Binary"]=4]="Binary";Type[Type["Utf8"]=5]="Utf8";Type[Type["Bool"]=6]="Bool";Type[Type["Decimal"]=7]="Decimal";Type[Type["Date"]=8]="Date";Type[Type["Time"]=9]="Time";Type[Type["Timestamp"]=10]="Timestamp";Type[Type["Interval"]=11]="Interval";Type[Type["List"]=12]="List";Type[Type["Struct"]=13]="Struct";Type[Type["Union"]=14]="Union";Type[Type["FixedSizeBinary"]=15]="FixedSizeBinary";Type[Type["FixedSizeList"]=16]="FixedSizeList";Type[Type["Map"]=17]="Map";Type[Type["Dictionary"]=-1]="Dictionary";Type[Type["Int8"]=-2]="Int8";Type[Type["Int16"]=-3]="Int16";Type[Type["Int32"]=-4]="Int32";Type[Type["Int64"]=-5]="Int64";Type[Type["Uint8"]=-6]="Uint8";Type[Type["Uint16"]=-7]="Uint16";Type[Type["Uint32"]=-8]="Uint32";Type[Type["Uint64"]=-9]="Uint64";Type[Type["Float16"]=-10]="Float16";Type[Type["Float32"]=-11]="Float32";Type[Type["Float64"]=-12]="Float64";Type[Type["DateDay"]=-13]="DateDay";Type[Type["DateMillisecond"]=-14]="DateMillisecond";Type[Type["TimestampSecond"]=-15]="TimestampSecond";Type[Type["TimestampMillisecond"]=-16]="TimestampMillisecond";Type[Type["TimestampMicrosecond"]=-17]="TimestampMicrosecond";Type[Type["TimestampNanosecond"]=-18]="TimestampNanosecond";Type[Type["TimeSecond"]=-19]="TimeSecond";Type[Type["TimeMillisecond"]=-20]="TimeMillisecond";Type[Type["TimeMicrosecond"]=-21]="TimeMicrosecond";Type[Type["TimeNanosecond"]=-22]="TimeNanosecond";Type[Type["DenseUnion"]=-23]="DenseUnion";Type[Type["SparseUnion"]=-24]="SparseUnion";Type[Type["IntervalDayTime"]=-25]="IntervalDayTime";Type[Type["IntervalYearMonth"]=-26]="IntervalYearMonth";return Type;}({});var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}return _createClass(DataType,[{key:"typeId",get:function get(){return Type.NONE;}},{key:"compareTo",value:function compareTo(other){return this===other;}}],[{key:"isNull",value:function isNull(x){return x&&x.typeId===Type.Null;}},{key:"isInt",value:function isInt(x){return x&&x.typeId===Type.Int;}},{key:"isFloat",value:function isFloat(x){return x&&x.typeId===Type.Float;}},{key:"isBinary",value:function isBinary(x){return x&&x.typeId===Type.Binary;}},{key:"isUtf8",value:function isUtf8(x){return x&&x.typeId===Type.Utf8;}},{key:"isBool",value:function isBool(x){return x&&x.typeId===Type.Bool;}},{key:"isDecimal",value:function isDecimal(x){return x&&x.typeId===Type.Decimal;}},{key:"isDate",value:function isDate(x){return x&&x.typeId===Type.Date;}},{key:"isTime",value:function isTime(x){return x&&x.typeId===Type.Time;}},{key:"isTimestamp",value:function isTimestamp(x){return x&&x.typeId===Type.Timestamp;}},{key:"isInterval",value:function isInterval(x){return x&&x.typeId===Type.Interval;}},{key:"isList",value:function isList(x){return x&&x.typeId===Type.List;}},{key:"isStruct",value:function isStruct(x){return x&&x.typeId===Type.Struct;}},{key:"isUnion",value:function isUnion(x){return x&&x.typeId===Type.Union;}},{key:"isFixedSizeBinary",value:function isFixedSizeBinary(x){return x&&x.typeId===Type.FixedSizeBinary;}},{key:"isFixedSizeList",value:function isFixedSizeList(x){return x&&x.typeId===Type.FixedSizeList;}},{key:"isMap",value:function isMap(x){return x&&x.typeId===Type.Map;}},{key:"isDictionary",value:function isDictionary(x){return x&&x.typeId===Type.Dictionary;}}]);}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){function Int(isSigned,bitWidth){var _this118;_classCallCheck(this,Int);_this118=_callSuper(this,Int);_defineProperty(_this118,"isSigned",void 0);_defineProperty(_this118,"bitWidth",void 0);_this118.isSigned=isSigned;_this118.bitWidth=bitWidth;return _this118;}_inherits(Int,_DataType);return _createClass(Int,[{key:"typeId",get:function get(){return Type.Int;}},{key:_Symbol$toStringTag3,get:function get(){return'Int';}},{key:"toString",value:function toString(){return"".concat(this.isSigned?'I':'Ui',"nt").concat(this.bitWidth);}}]);}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){function Int8(){_classCallCheck(this,Int8);return _callSuper(this,Int8,[true,8]);}_inherits(Int8,_Int);return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){function Int16(){_classCallCheck(this,Int16);return _callSuper(this,Int16,[true,16]);}_inherits(Int16,_Int2);return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){function Int32(){_classCallCheck(this,Int32);return _callSuper(this,Int32,[true,32]);}_inherits(Int32,_Int3);return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){function Uint8(){_classCallCheck(this,Uint8);return _callSuper(this,Uint8,[false,8]);}_inherits(Uint8,_Int4);return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){function Uint16(){_classCallCheck(this,Uint16);return _callSuper(this,Uint16,[false,16]);}_inherits(Uint16,_Int5);return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){function Uint32(){_classCallCheck(this,Uint32);return _callSuper(this,Uint32,[false,32]);}_inherits(Uint32,_Int6);return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){function Float(precision){var _this119;_classCallCheck(this,Float);_this119=_callSuper(this,Float);_defineProperty(_this119,"precision",void 0);_this119.precision=precision;return _this119;}_inherits(Float,_DataType2);return _createClass(Float,[{key:"typeId",get:function get(){return Type.Float;}},{key:_Symbol$toStringTag4,get:function get(){return'Float';}},{key:"toString",value:function toString(){return"Float".concat(this.precision);}}]);}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){function Float32(){_classCallCheck(this,Float32);return _callSuper(this,Float32,[Precision.SINGLE]);}_inherits(Float32,_Float);return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){function Float64(){_classCallCheck(this,Float64);return _callSuper(this,Float64,[Precision.DOUBLE]);}_inherits(Float64,_Float2);return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){function FixedSizeList(listSize,child){var _this120;_classCallCheck(this,FixedSizeList);_this120=_callSuper(this,FixedSizeList);_defineProperty(_this120,"listSize",void 0);_defineProperty(_this120,"children",void 0);_this120.listSize=listSize;_this120.children=[child];return _this120;}_inherits(FixedSizeList,_DataType3);return _createClass(FixedSizeList,[{key:"typeId",get:function get(){return Type.FixedSizeList;}},{key:"valueType",get:function get(){return this.children[0].type;}},{key:"valueField",get:function get(){return this.children[0];}},{key:_Symbol$toStringTag5,get:function get(){return'FixedSizeList';}},{key:"toString",value:function toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">");}}]);}(DataType,_Symbol$toStringTag7);function getArrowTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return new Int8();case Uint8Array:return new Uint8();case Int16Array:return new Int16();case Uint16Array:return new Uint16();case Int32Array:return new Int32();case Uint32Array:return new Uint32();case Float32Array:return new Float32();case Float64Array:return new Float64();default:throw new Error('array type not supported');}}function deduceMeshField(attributeName,attribute,optionalMetadata){var type=getArrowTypeFromTypedArray(attribute.value);var metadata=optionalMetadata?optionalMetadata:makeMeshAttributeMetadata(attribute);var field=new Field(attributeName,new FixedSizeList(attribute.size,new Field('value',type)),false,metadata);return field;}function makeMeshAttributeMetadata(attribute){var result=new Map();if('byteOffset'in attribute){result.set('byteOffset',attribute.byteOffset.toString(10));}if('byteStride'in attribute){result.set('byteStride',attribute.byteStride.toString(10));}if('normalized'in attribute){result.set('normalized',attribute.normalized.toString());}return result;}function getDracoSchema(attributes,loaderData,indices){var metadataMap=makeMetadata(loaderData.metadata);var fields=[];var namedLoaderDataAttributes=transformAttributesLoaderData(loaderData.attributes);for(var attributeName in attributes){var attribute=attributes[attributeName];var field=getArrowFieldFromAttribute(attributeName,attribute,namedLoaderDataAttributes[attributeName]);fields.push(field);}if(indices){var indicesField=getArrowFieldFromAttribute('indices',indices);fields.push(indicesField);}return new Schema(fields,metadataMap);}function transformAttributesLoaderData(loaderData){var result={};for(var key in loaderData){var dracoAttribute=loaderData[key];result[dracoAttribute.name||'undefined']=dracoAttribute;}return result;}function getArrowFieldFromAttribute(attributeName,attribute,loaderData){var metadataMap=loaderData?makeMetadata(loaderData.metadata):undefined;var field=deduceMeshField(attributeName,attribute,metadataMap);return field;}function makeMetadata(metadata){var metadataMap=new Map();for(var key in metadata){metadataMap.set("".concat(key,".string"),JSON.stringify(metadata[key]));}return metadataMap;}var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP={POSITION:'POSITION',NORMAL:'NORMAL',COLOR:'COLOR_0',TEX_COORD:'TEXCOORD_0'};var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};var INDEX_ITEM_SIZE=4;var DracoParser=/*#__PURE__*/function(){function DracoParser(draco){_classCallCheck(this,DracoParser);_defineProperty(this,"draco",void 0);_defineProperty(this,"decoder",void 0);_defineProperty(this,"metadataQuerier",void 0);this.draco=draco;this.decoder=new this.draco.Decoder();this.metadataQuerier=new this.draco.MetadataQuerier();}return _createClass(DracoParser,[{key:"destroy",value:function destroy(){this.draco.destroy(this.decoder);this.draco.destroy(this.metadataQuerier);}},{key:"parseSync",value:function parseSync(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var buffer=new this.draco.DecoderBuffer();buffer.Init(new Int8Array(arrayBuffer),arrayBuffer.byteLength);this._disableAttributeTransforms(options);var geometry_type=this.decoder.GetEncodedGeometryType(buffer);var dracoGeometry=geometry_type===this.draco.TRIANGULAR_MESH?new this.draco.Mesh():new this.draco.PointCloud();try{var dracoStatus;switch(geometry_type){case this.draco.TRIANGULAR_MESH:dracoStatus=this.decoder.DecodeBufferToMesh(buffer,dracoGeometry);break;case this.draco.POINT_CLOUD:dracoStatus=this.decoder.DecodeBufferToPointCloud(buffer,dracoGeometry);break;default:throw new Error('DRACO: Unknown geometry type.');}if(!dracoStatus.ok()||!dracoGeometry.ptr){var message="DRACO decompression failed: ".concat(dracoStatus.error_msg());throw new Error(message);}var loaderData=this._getDracoLoaderData(dracoGeometry,geometry_type,options);var geometry=this._getMeshData(dracoGeometry,loaderData,options);var boundingBox=getMeshBoundingBox(geometry.attributes);var schema=getDracoSchema(geometry.attributes,loaderData,geometry.indices);var data=_objectSpread(_objectSpread({loader:'draco',loaderData:loaderData,header:{vertexCount:dracoGeometry.num_points(),boundingBox:boundingBox}},geometry),{},{schema:schema});return data;}finally{this.draco.destroy(buffer);if(dracoGeometry){this.draco.destroy(dracoGeometry);}}}},{key:"_getDracoLoaderData",value:function _getDracoLoaderData(dracoGeometry,geometry_type,options){var metadata=this._getTopLevelMetadata(dracoGeometry);var attributes=this._getDracoAttributes(dracoGeometry,options);return{geometry_type:geometry_type,num_attributes:dracoGeometry.num_attributes(),num_points:dracoGeometry.num_points(),num_faces:dracoGeometry instanceof this.draco.Mesh?dracoGeometry.num_faces():0,metadata:metadata,attributes:attributes};}},{key:"_getDracoAttributes",value:function _getDracoAttributes(dracoGeometry,options){var dracoAttributes={};for(var attributeId=0;attributeId<dracoGeometry.num_attributes();attributeId++){var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attributeId);var metadata=this._getAttributeMetadata(dracoGeometry,attributeId);dracoAttributes[dracoAttribute.unique_id()]={unique_id:dracoAttribute.unique_id(),attribute_type:dracoAttribute.attribute_type(),data_type:dracoAttribute.data_type(),num_components:dracoAttribute.num_components(),byte_offset:dracoAttribute.byte_offset(),byte_stride:dracoAttribute.byte_stride(),normalized:dracoAttribute.normalized(),attribute_index:attributeId,metadata:metadata};var quantization=this._getQuantizationTransform(dracoAttribute,options);if(quantization){dracoAttributes[dracoAttribute.unique_id()].quantization_transform=quantization;}var octahedron=this._getOctahedronTransform(dracoAttribute,options);if(octahedron){dracoAttributes[dracoAttribute.unique_id()].octahedron_transform=octahedron;}}return dracoAttributes;}},{key:"_getMeshData",value:function _getMeshData(dracoGeometry,loaderData,options){var attributes=this._getMeshAttributes(loaderData,dracoGeometry,options);var positionAttribute=attributes.POSITION;if(!positionAttribute){throw new Error('DRACO: No position attribute found.');}if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'triangle-strip':return{topology:'triangle-strip',mode:4,attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}return{topology:'point-list',mode:0,attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i465=0,_Object$values=Object.values(loaderData.attributes);_i465<_Object$values.length;_i465++){var loaderAttribute=_Object$values[_i465];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var _this$_getAttributeVa=this._getAttributeValues(dracoGeometry,loaderAttribute),value=_this$_getAttributeVa.value,size=_this$_getAttributeVa.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}return attributes;}},{key:"_getTriangleListIndices",value:function _getTriangleListIndices(dracoGeometry){var numFaces=dracoGeometry.num_faces();var numIndices=numFaces*3;var byteLength=numIndices*INDEX_ITEM_SIZE;var ptr=this.draco._malloc(byteLength);try{this.decoder.GetTrianglesUInt32Array(dracoGeometry,byteLength,ptr);return new Uint32Array(this.draco.HEAPF32.buffer,ptr,numIndices).slice();}finally{this.draco._free(ptr);}}},{key:"_getTriangleStripIndices",value:function _getTriangleStripIndices(dracoGeometry){var dracoArray=new this.draco.DracoInt32Array();try{this.decoder.GetTriangleStripsFromMesh(dracoGeometry,dracoArray);return getUint32Array(dracoArray);}finally{this.draco.destroy(dracoArray);}}},{key:"_getAttributeValues",value:function _getAttributeValues(dracoGeometry,attribute){var TypedArrayCtor=DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];var numComponents=attribute.num_components;var numPoints=dracoGeometry.num_points();var numValues=numPoints*numComponents;var byteLength=numValues*TypedArrayCtor.BYTES_PER_ELEMENT;var dataType=getDracoDataType(this.draco,TypedArrayCtor);var value;var ptr=this.draco._malloc(byteLength);try{var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attribute.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry,dracoAttribute,dataType,byteLength,ptr);value=new TypedArrayCtor(this.draco.HEAPF32.buffer,ptr,numValues).slice();}finally{this.draco._free(ptr);}return{value:value,size:numComponents};}},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){var uniqueId=attribute.unique_id;for(var _i466=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i466<_Object$entries4.length;_i466++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i466],2),attributeName=_Object$entries4$_i[0],attributeUniqueId=_Object$entries4$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}var thisAttributeType=attribute.attribute_type;for(var dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP){var attributeType=this.draco[dracoAttributeConstant];if(attributeType===thisAttributeType){return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}var entryName=options.attributeNameEntry||'name';if(attribute.metadata[entryName]){return attribute.metadata[entryName].string;}return"CUSTOM_ATTRIBUTE_".concat(uniqueId);}},{key:"_getTopLevelMetadata",value:function _getTopLevelMetadata(dracoGeometry){var dracoMetadata=this.decoder.GetMetadata(dracoGeometry);return this._getDracoMetadata(dracoMetadata);}},{key:"_getAttributeMetadata",value:function _getAttributeMetadata(dracoGeometry,attributeId){var dracoMetadata=this.decoder.GetAttributeMetadata(dracoGeometry,attributeId);return this._getDracoMetadata(dracoMetadata);}},{key:"_getDracoMetadata",value:function _getDracoMetadata(dracoMetadata){if(!dracoMetadata||!dracoMetadata.ptr){return{};}var result={};var numEntries=this.metadataQuerier.NumEntries(dracoMetadata);for(var entryIndex=0;entryIndex<numEntries;entryIndex++){var entryName=this.metadataQuerier.GetEntryName(dracoMetadata,entryIndex);result[entryName]=this._getDracoMetadataField(dracoMetadata,entryName);}return result;}},{key:"_getDracoMetadataField",value:function _getDracoMetadataField(dracoMetadata,entryName){var dracoArray=new this.draco.DracoInt32Array();try{this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var intArray=getInt32Array(dracoArray);return{"int":this.metadataQuerier.GetIntEntry(dracoMetadata,entryName),string:this.metadataQuerier.GetStringEntry(dracoMetadata,entryName),"double":this.metadataQuerier.GetDoubleEntry(dracoMetadata,entryName),intArray:intArray};}finally{this.draco.destroy(dracoArray);}}},{key:"_disableAttributeTransforms",value:function _disableAttributeTransforms(options){var _options$quantizedAtt=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt===void 0?[]:_options$quantizedAtt,_options$octahedronAt=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt===void 0?[]:_options$octahedronAt;var skipAttributes=[].concat(_toConsumableArray(quantizedAttributes),_toConsumableArray(octahedronAttributes));var _iterator24=_createForOfIteratorHelper(skipAttributes),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var dracoAttributeName=_step24.value;this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}},{key:"_getQuantizationTransform",value:function _getQuantizationTransform(dracoAttribute,options){var _this121=this;var _options$quantizedAtt2=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt2===void 0?[]:_options$quantizedAtt2;var attribute_type=dracoAttribute.attribute_type();var skip=quantizedAttributes.map(function(type){return _this121.decoder[type];}).includes(attribute_type);if(skip){var _transform2=new this.draco.AttributeQuantizationTransform();try{if(_transform2.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform2.quantization_bits(),range:_transform2.range(),min_values:new Float32Array([1,2,3]).map(function(i){return _transform2.min_value(i);})};}}finally{this.draco.destroy(_transform2);}}return null;}},{key:"_getOctahedronTransform",value:function _getOctahedronTransform(dracoAttribute,options){var _this122=this;var _options$octahedronAt2=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt2===void 0?[]:_options$octahedronAt2;var attribute_type=dracoAttribute.attribute_type();var octahedron=octahedronAttributes.map(function(type){return _this122.decoder[type];}).includes(attribute_type);if(octahedron){var _transform3=new this.draco.AttributeQuantizationTransform();try{if(_transform3.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform3.quantization_bits()};}}finally{this.draco.destroy(_transform3);}}return null;}}]);}();function getDracoDataType(draco,attributeType){switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco.DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array:return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco.DT_UINT32;default:return draco.DT_INVALID;}}function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i467=0;_i467<numValues;_i467++){intArray[_i467]=dracoArray.GetValue(_i467);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i468=0;_i468<numValues;_i468++){intArray[_i468]=dracoArray.GetValue(_i468);}return intArray;}var DRACO_DECODER_VERSION='1.5.5';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_JS_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.js");var DRACO_WASM_WRAPPER_URL="".concat(STATIC_DECODER_URL,"/draco_wasm_wrapper.js");var DRACO_WASM_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.wasm");var loadDecoderPromise;function loadDracoDecoderModule(_x65){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(options){var modules;return _regenerator().w(function(_context40){while(1)switch(_context40.n){case 0:modules=options.modules||{};if(modules.draco3d){loadDecoderPromise=loadDecoderPromise||modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};});}else{loadDecoderPromise=loadDecoderPromise||loadDracoDecoder(options);}_context40.n=1;return loadDecoderPromise;case 1:return _context40.a(2,_context40.v);}},_callee37);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x66){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6,_t28,_t29,_t30,_t31;return _regenerator().w(function(_context41){while(1)switch(_context41.n){case 0:_t28=options.draco&&options.draco.decoderType;_context41.n=_t28==='js'?1:_t28==='wasm'?3:3;break;case 1:_context41.n=2;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 2:DracoDecoderModule=_context41.v;return _context41.a(3,7);case 3:_t29=Promise;_context41.n=4;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 4:_t30=_context41.v;_context41.n=5;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 5:_t31=_context41.v;_context41.n=6;return _t29.all.call(_t29,[_t30,_t31]);case 6:_yield$Promise$all5=_context41.v;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);DracoDecoderModule=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];case 7:DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context41.n=8;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 8:return _context41.a(2,_context41.v);}},_callee38);}));return _loadDracoDecoder.apply(this,arguments);}function initializeDracoDecoder(DracoDecoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){DracoDecoderModule(_objectSpread(_objectSpread({},options),{},{onModuleLoaded:function onModuleLoaded(draco){return resolve({draco:draco});}}));});}({id:isBrowser$1?'draco-writer':'draco-writer-nodejs',name:'Draco compressed geometry writer',module:'draco',version:VERSION$1,worker:true,options:{draco:{},source:null}});var DracoLoader=_objectSpread(_objectSpread({},DracoLoader$1),{},{parse:parse$1});function parse$1(_x67,_x68){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regenerator().w(function(_context42){while(1)switch(_context42.p=_context42.n){case 0:_context42.n=1;return loadDracoDecoderModule(options);case 1:_yield$loadDracoDecod=_context42.v;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context42.p=2;return _context42.a(2,dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 3:_context42.p=3;dracoParser.destroy();return _context42.f(3);case 4:return _context42.a(2);}},_callee39,null,[[2,,3,4]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name7 in attributes){var attribute=attributes[_name7];if(_name7!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name7]=glTFAccessor;}}return accessors;}function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={value:buffer,size:size,byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getComponentTypeFromArray(buffer)};return glTFAccessor;}function getAccessorData(attribute){var buffer=attribute;var size=1;var count=0;if(attribute&&attribute.value){buffer=attribute.value;size=attribute.size||1;}if(buffer){if(!ArrayBuffer.isView(buffer)){buffer=toTypedArray(buffer,Float32Array);}count=buffer.length/size;}return{buffer:buffer,size:size,count:count};}function toTypedArray(array,ArrayType){var convertTypedArrays=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!array){return null;}if(Array.isArray(array)){return new ArrayType(array);}if(convertTypedArrays&&!(array instanceof ArrayType)){return new ArrayType(array);}return array;}var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator25=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _primitive=_step25.value;if(scenegraph.getObjectExtension(_primitive,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decode$5(_x69,_x70,_x71){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator49,_step49,_primitive6;return _regenerator().w(function(_context43){while(1)switch(_context43.n){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context43.n=1;break;}return _context43.a(2);case 1:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator49=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){_primitive6=_step49.value;if(scenegraph.getObjectExtension(_primitive6,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive6,options,context));}}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}_context43.n=2;return Promise.all(promises);case 2:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 3:return _context43.a(2);}},_callee40);}));return _decode$2.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator26=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var _mesh5=_step26.value;compressMesh(_mesh5,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}}function decompressPrimitive(_x72,_x73,_x74,_x75){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i584,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regenerator().w(function(_context44){while(1)switch(_context44.n){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context44.n=1;break;}return _context44.a(2);case 1:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context44.n=2;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 2:decodedData=_context44.v;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i584=0,_Object$entries5=Object.entries(decodedAttributes);_i584<_Object$entries5.length;_i584++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i584],2),attributeName=_Object$entries5$_i[0],decodedAttribute=_Object$entries5$_i[1];if(attributeName in primitive.attributes){accessorIndex=primitive.attributes[attributeName];accessor=scenegraph.getAccessor(accessorIndex);if(accessor!==null&&accessor!==void 0&&accessor.min&&accessor!==null&&accessor!==void 0&&accessor.max){decodedAttribute.min=accessor.min;decodedAttribute.max=accessor.max;}}}primitive.attributes=decodedAttributes;if(decodedData.indices){primitive.indices=getGLTFAccessor(decodedData.indices);}checkPrimitive(primitive);case 3:return _context44.a(2);}},_callee41);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){var _context$parseSync;var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:4;var options=arguments.length>3?arguments[3]:undefined;var context=arguments.length>4?arguments[4]:undefined;if(!options.DracoWriter){throw new Error('options.gltf.DracoWriter not provided');}var compressedData=options.DracoWriter.encodeSync({attributes:attributes});var decodedData=context===null||context===void 0?void 0:(_context$parseSync=context.parseSync)===null||_context$parseSync===void 0?void 0:_context$parseSync.call(context,{attributes:attributes});var fauxAccessors=options._addFauxAttributes(decodedData.attributes);var bufferViewIndex=options.addBufferView(compressedData);var glTFMesh={primitives:[{attributes:fauxAccessors,mode:mode,extensions:_defineProperty2({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors})}]};return glTFMesh;}function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator27,_step27,_mesh6,_iterator28,_step28,_primitive2,_t4,_t5;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:_iterator27=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context0.p=1;_iterator27.s();case 2:if((_step27=_iterator27.n()).done){_context0.n=10;break;}_mesh6=_step27.value;_iterator28=_createForOfIteratorHelper(_mesh6.primitives);_context0.p=3;_iterator28.s();case 4:if((_step28=_iterator28.n()).done){_context0.n=6;break;}_primitive2=_step28.value;_context0.n=5;return _primitive2;case 5:_context0.n=4;break;case 6:_context0.n=8;break;case 7:_context0.p=7;_t4=_context0.v;_iterator28.e(_t4);case 8:_context0.p=8;_iterator28.f();return _context0.f(8);case 9:_context0.n=2;break;case 10:_context0.n=12;break;case 11:_context0.p=11;_t5=_context0.v;_iterator27.e(_t5);case 12:_context0.p=12;_iterator27.f();return _context0.f(12);case 13:return _context0.a(2);}},_marked2,null,[[3,7,8,9],[1,11,12,13]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$5,preprocess:preprocess$1,decode:decode$5,encode:encode$3});function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}var config={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true};function formatValue(value){var _ref15=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref15$precision=_ref15.precision,precision=_ref15$precision===void 0?config.precision:_ref15$precision;value=round(value);return"".concat(parseFloat(value.toPrecision(precision)));}function isArray(value){return Array.isArray(value)||ArrayBuffer.isView(value)&&!(value instanceof DataView);}function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i469=0;_i469<a.length;++_i469){if(!_equals(a[_i469],b[_i469])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}function _extendableBuiltin(cls){function ExtendableBuiltin(){var instance=Reflect.construct(cls,Array.from(arguments));Object.setPrototypeOf(instance,Object.getPrototypeOf(this));return instance;}ExtendableBuiltin.prototype=Object.create(cls.prototype,{constructor:{value:cls,enumerable:false,writable:true,configurable:true}});if(Object.setPrototypeOf){Object.setPrototypeOf(ExtendableBuiltin,cls);}else{ExtendableBuiltin.__proto__=cls;}return ExtendableBuiltin;}var MathArray=/*#__PURE__*/function(_extendableBuiltin2){function MathArray(){_classCallCheck(this,MathArray);return _callSuper(this,MathArray,arguments);}_inherits(MathArray,_extendableBuiltin2);return _createClass(MathArray,[{key:"clone",value:function clone(){return new this.constructor().copy(this);}},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i470=0;_i470<this.ELEMENTS;++_i470){this[_i470]=array[_i470+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i471=0;_i471<this.ELEMENTS;++_i471){targetArray[offset+_i471]=this[_i471];}return targetArray;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){if(arrayOrObject===this){return this;}return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}},{key:"formatString",value:function formatString(opts){var string='';for(var _i472=0;_i472<this.ELEMENTS;++_i472){string+=(_i472>0?', ':'')+formatValue(this[_i472],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i473=0;_i473<this.ELEMENTS;++_i473){if(!_equals(this[_i473],array[_i473])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i474=0;_i474<this.ELEMENTS;++_i474){if(this[_i474]!==array[_i474]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i475=0;_i475<this.ELEMENTS;++_i475){this[_i475]=-this[_i475];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i476=0;_i476<this.ELEMENTS;++_i476){var ai=a[_i476];this[_i476]=ai+t*(b[_i476]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i477=0;_i477<this.ELEMENTS;++_i477){this[_i477]=Math.min(vector[_i477],this[_i477]);}return this.check();}},{key:"max",value:function max(vector){for(var _i478=0;_i478<this.ELEMENTS;++_i478){this[_i478]=Math.max(vector[_i478],this[_i478]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i479=0;_i479<this.ELEMENTS;++_i479){this[_i479]=Math.min(Math.max(this[_i479],minVector[_i479]),maxVector[_i479]);}return this.check();}},{key:"add",value:function add(){for(var _len68=arguments.length,vectors=new Array(_len68),_key8=0;_key8<_len68;_key8++){vectors[_key8]=arguments[_key8];}for(var _i480=0,_vectors=vectors;_i480<_vectors.length;_i480++){var vector=_vectors[_i480];for(var _i481=0;_i481<this.ELEMENTS;++_i481){this[_i481]+=vector[_i481];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len69=arguments.length,vectors=new Array(_len69),_key9=0;_key9<_len69;_key9++){vectors[_key9]=arguments[_key9];}for(var _i482=0,_vectors2=vectors;_i482<_vectors2.length;_i482++){var vector=_vectors2[_i482];for(var _i483=0;_i483<this.ELEMENTS;++_i483){this[_i483]-=vector[_i483];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i484=0;_i484<this.ELEMENTS;++_i484){this[_i484]*=_scale7;}}else{for(var _i485=0;_i485<this.ELEMENTS&&_i485<_scale7.length;++_i485){this[_i485]*=_scale7[_i485];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i486=0;_i486<this.ELEMENTS;++_i486){this[_i486]*=scalar;}return this.check();}},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i487=0;_i487<this.ELEMENTS;++_i487){valid=valid&&Number.isFinite(this[_i487]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i488=0;_i488<this.ELEMENTS;++_i488){this[_i488]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i489=0;_i489<this.ELEMENTS;++_i489){this[_i489]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i490=0;_i490<this.ELEMENTS;++_i490){this[_i490]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i491=0;_i491<this.ELEMENTS;++_i491){this[_i491]=Math.min(Math.max(this[_i491],min),max);}return this.check();}},{key:"elements",get:function get(){return this;}}]);}(_extendableBuiltin(Array));function validateVector(v,length){if(v.length!==length){return false;}for(var _i492=0;_i492<v.length;++_i492){if(!Number.isFinite(v[_i492])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(value));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}var Vector=/*#__PURE__*/function(_MathArray){function Vector(){_classCallCheck(this,Vector);return _callSuper(this,Vector,arguments);}_inherits(Vector,_MathArray);return _createClass(Vector,[{key:"x",get:function get(){return this[0];},set:function set(value){this[0]=checkNumber(value);}},{key:"y",get:function get(){return this[1];},set:function set(value){this[1]=checkNumber(value);}},{key:"len",value:function len(){return Math.sqrt(this.lengthSquared());}},{key:"magnitude",value:function magnitude(){return this.len();}},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i493=0;_i493<this.ELEMENTS;++_i493){length+=this[_i493]*this[_i493];}return length;}},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i494=0;_i494<this.ELEMENTS;++_i494){var dist=this[_i494]-mathArray[_i494];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i495=0;_i495<this.ELEMENTS;++_i495){product+=this[_i495]*mathArray[_i495];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i496=0;_i496<this.ELEMENTS;++_i496){this[_i496]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len70=arguments.length,vectors=new Array(_len70),_key0=0;_key0<_len70;_key0++){vectors[_key0]=arguments[_key0];}for(var _i497=0,_vectors3=vectors;_i497<_vectors3.length;_i497++){var vector=_vectors3[_i497];for(var _i498=0;_i498<this.ELEMENTS;++_i498){this[_i498]*=vector[_i498];}}return this.check();}},{key:"divide",value:function divide(){for(var _len71=arguments.length,vectors=new Array(_len71),_key1=0;_key1<_len71;_key1++){vectors[_key1]=arguments[_key1];}for(var _i499=0,_vectors4=vectors;_i499<_vectors4.length;_i499++){var vector=_vectors4[_i499];for(var _i500=0;_i500<this.ELEMENTS;++_i500){this[_i500]/=vector[_i500];}}return this.check();}},{key:"lengthSq",value:function lengthSq(){return this.lengthSquared();}},{key:"distanceTo",value:function distanceTo(vector){return this.distance(vector);}},{key:"distanceToSquared",value:function distanceToSquared(vector){return this.distanceSquared(vector);}},{key:"getComponent",value:function getComponent(i){assert(i>=0&&i<this.ELEMENTS,'index is out of range');return checkNumber(this[i]);}},{key:"setComponent",value:function setComponent(i,value){assert(i>=0&&i<this.ELEMENTS,'index is out of range');this[i]=value;return this.check();}},{key:"addVectors",value:function addVectors(a,b){return this.copy(a).add(b);}},{key:"subVectors",value:function subVectors(a,b){return this.copy(a).subtract(b);}},{key:"multiplyVectors",value:function multiplyVectors(a,b){return this.copy(a).multiply(b);}},{key:"addScaledVector",value:function addScaledVector(a,b){return this.add(new this.constructor(a).multiplyScalar(b));}}]);}(MathArray);/**
|
|
25008
25069
|
* Common utilities
|
|
25009
25070
|
* @module glMatrix
|
|
25010
25071
|
*/var ARRAY_TYPE=typeof Float32Array!=="undefined"?Float32Array:Array;/**
|
|
@@ -25127,7 +25188,7 @@ out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out;}/**
|
|
|
25127
25188
|
* @param {Object} [arg] additional argument to pass to fn
|
|
25128
25189
|
* @returns {Array} a
|
|
25129
25190
|
* @function
|
|
25130
|
-
*/(function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3;}if(!offset){offset=0;}if(count){l=Math.min(count*stride+offset,a.length);}else{l=a.length;}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];}return a;};})();var ORIGIN=[0,0,0];var ZERO;var Vector3=/*#__PURE__*/function(_Vector){function Vector3(){var _this123;var x=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var z=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,Vector3);_this123=_callSuper(this,Vector3,[-0,-0,-0]);if(arguments.length===1&&isArray(x)){_this123.copy(x);}else{if(config.debug){checkNumber(x);checkNumber(y);checkNumber(z);}_this123[0]=x;_this123[1]=y;_this123[2]=z;}return _this123;}_inherits(Vector3,_Vector);return _createClass(Vector3,[{key:"set",value:function set(x,y,z){this[0]=x;this[1]=y;this[2]=z;return this.check();}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];return this.check();}},{key:"fromObject",value:function fromObject(object){if(config.debug){checkNumber(object.x);checkNumber(object.y);checkNumber(object.z);}this[0]=object.x;this[1]=object.y;this[2]=object.z;return this.check();}},{key:"toObject",value:function toObject(object){object.x=this[0];object.y=this[1];object.z=this[2];return object;}},{key:"ELEMENTS",get:function get(){return 3;}},{key:"z",get:function get(){return this[2];},set:function set(value){this[2]=checkNumber(value);}},{key:"angle",value:function angle(vector){return _angle3(this,vector);}},{key:"cross",value:function cross(vector){_cross(this,this,vector);return this.check();}},{key:"rotateX",value:function rotateX(_ref16){var radians=_ref16.radians,_ref16$origin=_ref16.origin,origin=_ref16$origin===void 0?ORIGIN:_ref16$origin;_rotateX(this,this,origin,radians);return this.check();}},{key:"rotateY",value:function rotateY(_ref17){var radians=_ref17.radians,_ref17$origin=_ref17.origin,origin=_ref17$origin===void 0?ORIGIN:_ref17$origin;_rotateY(this,this,origin,radians);return this.check();}},{key:"rotateZ",value:function rotateZ(_ref18){var radians=_ref18.radians,_ref18$origin=_ref18.origin,origin=_ref18$origin===void 0?ORIGIN:_ref18$origin;_rotateZ(this,this,origin,radians);return this.check();}},{key:"transform",value:function transform(matrix4){return this.transformAsPoint(matrix4);}},{key:"transformAsPoint",value:function transformAsPoint(matrix4){transformMat4(this,this,matrix4);return this.check();}},{key:"transformAsVector",value:function transformAsVector(matrix4){vec3_transformMat4AsVector(this,this,matrix4);return this.check();}},{key:"transformByMatrix3",value:function transformByMatrix3(matrix3){transformMat3(this,this,matrix3);return this.check();}},{key:"transformByMatrix2",value:function transformByMatrix2(matrix2){vec3_transformMat2(this,this,matrix2);return this.check();}},{key:"transformByQuaternion",value:function transformByQuaternion(quaternion){transformQuat(this,this,quaternion);return this.check();}}],[{key:"ZERO",get:function get(){if(!ZERO){ZERO=new Vector3(0,0,0);Object.freeze(ZERO);}return ZERO;}}]);}(Vector);var Matrix=/*#__PURE__*/function(_MathArray2){function Matrix(){_classCallCheck(this,Matrix);return _callSuper(this,Matrix,arguments);}_inherits(Matrix,_MathArray2);return _createClass(Matrix,[{key:"toString",value:function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var
|
|
25191
|
+
*/(function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3;}if(!offset){offset=0;}if(count){l=Math.min(count*stride+offset,a.length);}else{l=a.length;}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];}return a;};})();var ORIGIN=[0,0,0];var ZERO;var Vector3=/*#__PURE__*/function(_Vector){function Vector3(){var _this123;var x=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var z=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,Vector3);_this123=_callSuper(this,Vector3,[-0,-0,-0]);if(arguments.length===1&&isArray(x)){_this123.copy(x);}else{if(config.debug){checkNumber(x);checkNumber(y);checkNumber(z);}_this123[0]=x;_this123[1]=y;_this123[2]=z;}return _this123;}_inherits(Vector3,_Vector);return _createClass(Vector3,[{key:"set",value:function set(x,y,z){this[0]=x;this[1]=y;this[2]=z;return this.check();}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];return this.check();}},{key:"fromObject",value:function fromObject(object){if(config.debug){checkNumber(object.x);checkNumber(object.y);checkNumber(object.z);}this[0]=object.x;this[1]=object.y;this[2]=object.z;return this.check();}},{key:"toObject",value:function toObject(object){object.x=this[0];object.y=this[1];object.z=this[2];return object;}},{key:"ELEMENTS",get:function get(){return 3;}},{key:"z",get:function get(){return this[2];},set:function set(value){this[2]=checkNumber(value);}},{key:"angle",value:function angle(vector){return _angle3(this,vector);}},{key:"cross",value:function cross(vector){_cross(this,this,vector);return this.check();}},{key:"rotateX",value:function rotateX(_ref16){var radians=_ref16.radians,_ref16$origin=_ref16.origin,origin=_ref16$origin===void 0?ORIGIN:_ref16$origin;_rotateX(this,this,origin,radians);return this.check();}},{key:"rotateY",value:function rotateY(_ref17){var radians=_ref17.radians,_ref17$origin=_ref17.origin,origin=_ref17$origin===void 0?ORIGIN:_ref17$origin;_rotateY(this,this,origin,radians);return this.check();}},{key:"rotateZ",value:function rotateZ(_ref18){var radians=_ref18.radians,_ref18$origin=_ref18.origin,origin=_ref18$origin===void 0?ORIGIN:_ref18$origin;_rotateZ(this,this,origin,radians);return this.check();}},{key:"transform",value:function transform(matrix4){return this.transformAsPoint(matrix4);}},{key:"transformAsPoint",value:function transformAsPoint(matrix4){transformMat4(this,this,matrix4);return this.check();}},{key:"transformAsVector",value:function transformAsVector(matrix4){vec3_transformMat4AsVector(this,this,matrix4);return this.check();}},{key:"transformByMatrix3",value:function transformByMatrix3(matrix3){transformMat3(this,this,matrix3);return this.check();}},{key:"transformByMatrix2",value:function transformByMatrix2(matrix2){vec3_transformMat2(this,this,matrix2);return this.check();}},{key:"transformByQuaternion",value:function transformByQuaternion(quaternion){transformQuat(this,this,quaternion);return this.check();}}],[{key:"ZERO",get:function get(){if(!ZERO){ZERO=new Vector3(0,0,0);Object.freeze(ZERO);}return ZERO;}}]);}(Vector);var Matrix=/*#__PURE__*/function(_MathArray2){function Matrix(){_classCallCheck(this,Matrix);return _callSuper(this,Matrix,arguments);}_inherits(Matrix,_MathArray2);return _createClass(Matrix,[{key:"toString",value:function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var _i501=0;_i501<this.ELEMENTS;++_i501){string+=" ".concat(this[_i501]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}},{key:"getElement",value:function getElement(row,col){return this[col*this.RANK+row];}},{key:"setElement",value:function setElement(row,col,value){this[col*this.RANK+row]=checkNumber(value);return this;}},{key:"getColumn",value:function getColumn(columnIndex){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Array(this.RANK).fill(-0);var firstIndex=columnIndex*this.RANK;for(var _i502=0;_i502<this.RANK;++_i502){result[_i502]=this[firstIndex+_i502];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i503=0;_i503<this.RANK;++_i503){this[firstIndex+_i503]=columnVector[_i503];}return this;}}]);}(MathArray);/**
|
|
25131
25192
|
* Transpose the values of a mat3
|
|
25132
25193
|
*
|
|
25133
25194
|
* @param {mat3} out the receiving matrix
|
|
@@ -25181,14 +25242,14 @@ var det=a00*b01+a01*b11+a02*b21;if(!det){return null;}det=1.0/det;out[0]=b01*det
|
|
|
25181
25242
|
* @param {ReadonlyQuat} q Quaternion to create matrix from
|
|
25182
25243
|
*
|
|
25183
25244
|
* @returns {mat3} out
|
|
25184
|
-
*/function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out;}var INDICES;(function(INDICES){INDICES[INDICES["COL0ROW0"]=0]="COL0ROW0";INDICES[INDICES["COL0ROW1"]=1]="COL0ROW1";INDICES[INDICES["COL0ROW2"]=2]="COL0ROW2";INDICES[INDICES["COL1ROW0"]=3]="COL1ROW0";INDICES[INDICES["COL1ROW1"]=4]="COL1ROW1";INDICES[INDICES["COL1ROW2"]=5]="COL1ROW2";INDICES[INDICES["COL2ROW0"]=6]="COL2ROW0";INDICES[INDICES["COL2ROW1"]=7]="COL2ROW1";INDICES[INDICES["COL2ROW2"]=8]="COL2ROW2";})(INDICES||(INDICES={}));var IDENTITY_MATRIX=Object.freeze([1,0,0,0,1,0,0,0,1]);var Matrix3=/*#__PURE__*/function(_Matrix){function Matrix3(array){var _this124;for(var _len72=arguments.length,args=new Array(_len72>1?_len72-1:0),_key10=1;_key10<_len72;_key10++){args[_key10-1]=arguments[_key10];}_classCallCheck(this,Matrix3);_this124=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this124.copy(array);}else if(args.length>0){_this124.copy([array].concat(args));}else{_this124.identity();}return _this124;}_inherits(Matrix3,_Matrix);return _createClass(Matrix3,[{key:"ELEMENTS",get:function get(){return 9;}},{key:"RANK",get:function get(){return 3;}},{key:"INDICES",get:function get(){return INDICES;}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=array[4];this[5]=array[5];this[6]=array[6];this[7]=array[7];this[8]=array[8];return this.check();}},{key:"identity",value:function identity(){return this.copy(IDENTITY_MATRIX);}},{key:"fromObject",value:function fromObject(object){return this.check();}},{key:"fromQuaternion",value:function fromQuaternion(q){fromQuat(this,q);return this.check();}},{key:"set",value:function set(m00,m10,m20,m01,m11,m21,m02,m12,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"setRowMajor",value:function setRowMajor(m00,m01,m02,m10,m11,m12,m20,m21,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"determinant",value:function determinant(){return _determinant(this);}},{key:"transpose",value:function transpose(){_transpose(this,this);return this.check();}},{key:"invert",value:function invert(){_invert(this,this);return this.check();}},{key:"multiplyLeft",value:function multiplyLeft(a){multiply(this,a,this);return this.check();}},{key:"multiplyRight",value:function multiplyRight(a){multiply(this,this,a);return this.check();}},{key:"rotate",value:function rotate(radians){_rotate(this,this,radians);return this.check();}},{key:"scale",value:function scale(factor){if(Array.isArray(factor)){_scale8(this,this,factor);}else{_scale8(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}},{key:"transform",value:function transform(vector,result){var out;switch(vector.length){case 2:out=transformMat3$1(result||[-0,-0],vector,this);break;case 3:out=transformMat3(result||[-0,-0,-0],vector,this);break;case 4:out=vec4_transformMat3(result||[-0,-0,-0,-0],vector,this);break;default:throw new Error('Illegal vector');}checkVector(out,vector.length);return out;}},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}},{key:"transformVector3",value:function transformVector3(vector,result){return this.transform(vector,result);}}],[{key:"IDENTITY",get:function get(){return getIdentityMatrix();}},{key:"ZERO",get:function get(){return getZeroMatrix();}}]);}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3;function getZeroMatrix(){if(!ZERO_MATRIX3){ZERO_MATRIX3=new Matrix3([0,0,0,0,0,0,0,0,0]);Object.freeze(ZERO_MATRIX3);}return ZERO_MATRIX3;}function getIdentityMatrix(){if(!IDENTITY_MATRIX3){IDENTITY_MATRIX3=new Matrix3();Object.freeze(IDENTITY_MATRIX3);}return IDENTITY_MATRIX3;}var COMPONENTS$1={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES$1={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var EXT_MESHOPT_TRANSFORM='KHR_texture_transform';var name$4=EXT_MESHOPT_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();function decode$4(_x76,_x77){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42(gltfData,options){var gltfScenegraph,extension,materials,_i584;return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context45.n=1;break;}return _context45.a(2);case 1:materials=gltfData.json.materials||[];for(_i584=0;_i584<materials.length;_i584++){transformTexCoords(_i584,gltfData);}case 2:return _context45.a(2);}},_callee42);}));return _decode$3.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var processedTexCoords=[];var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var baseColorTexture=material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture;if(baseColorTexture){transformPrimitives(gltfData,materialIndex,baseColorTexture,processedTexCoords);}var emisiveTexture=material===null||material===void 0?void 0:material.emissiveTexture;if(emisiveTexture){transformPrimitives(gltfData,materialIndex,emisiveTexture,processedTexCoords);}var normalTexture=material===null||material===void 0?void 0:material.normalTexture;if(normalTexture){transformPrimitives(gltfData,materialIndex,normalTexture,processedTexCoords);}var occlusionTexture=material===null||material===void 0?void 0:material.occlusionTexture;if(occlusionTexture){transformPrimitives(gltfData,materialIndex,occlusionTexture,processedTexCoords);}var metallicRoughnessTexture=material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture;if(metallicRoughnessTexture){transformPrimitives(gltfData,materialIndex,metallicRoughnessTexture,processedTexCoords);}}function transformPrimitives(gltfData,materialIndex,texture,processedTexCoords){var transformParameters=getTransformParameters(texture,processedTexCoords);if(!transformParameters){return;}var meshes=gltfData.json.meshes||[];var _iterator29=_createForOfIteratorHelper(meshes),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _mesh7=_step29.value;var _iterator30=_createForOfIteratorHelper(_mesh7.primitives),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var _primitive3=_step30.value;var material=_primitive3.material;if(Number.isFinite(material)&&materialIndex===material){transformPrimitive(gltfData,_primitive3,transformParameters);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}function getTransformParameters(texture,processedTexCoords){var _texture$extensions;var textureInfo=(_texture$extensions=texture.extensions)===null||_texture$extensions===void 0?void 0:_texture$extensions[EXT_MESHOPT_TRANSFORM];var _texture$texCoord=texture.texCoord,originalTexCoord=_texture$texCoord===void 0?0:_texture$texCoord;var _textureInfo$texCoord=textureInfo.texCoord,texCoord=_textureInfo$texCoord===void 0?originalTexCoord:_textureInfo$texCoord;var isProcessed=processedTexCoords.findIndex(function(_ref){var _ref19=_slicedToArray(_ref,2),original=_ref19[0],newTexCoord=_ref19[1];return original===originalTexCoord&&newTexCoord===texCoord;})!==-1;if(!isProcessed){var _matrix2=makeTransformationMatrix(textureInfo);if(originalTexCoord!==texCoord){texture.texCoord=texCoord;}processedTexCoords.push([originalTexCoord,texCoord]);return{originalTexCoord:originalTexCoord,texCoord:texCoord,matrix:_matrix2};}return null;}function transformPrimitive(gltfData,primitive,transformParameters){var originalTexCoord=transformParameters.originalTexCoord,texCoord=transformParameters.texCoord,matrix=transformParameters.matrix;var texCoordAccessor=primitive.attributes["TEXCOORD_".concat(originalTexCoord)];if(Number.isFinite(texCoordAccessor)){var _gltfData$json$access;var accessor=(_gltfData$json$access=gltfData.json.accessors)===null||_gltfData$json$access===void 0?void 0:_gltfData$json$access[texCoordAccessor];if(accessor&&accessor.bufferView){var _gltfData$json$buffer;var bufferView=(_gltfData$json$buffer=gltfData.json.bufferViews)===null||_gltfData$json$buffer===void 0?void 0:_gltfData$json$buffer[accessor.bufferView];if(bufferView){var _gltfData$buffers$buf=gltfData.buffers[bufferView.buffer],arrayBuffer=_gltfData$buffers$buf.arrayBuffer,bufferByteOffset=_gltfData$buffers$buf.byteOffset;var byteOffset=(bufferByteOffset||0)+(accessor.byteOffset||0)+(bufferView.byteOffset||0);var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType2.ArrayType,length=_getAccessorArrayType2.length;var bytes=BYTES$1[accessor.componentType];var components=COMPONENTS$1[accessor.type];var elementAddressScale=bufferView.byteStride||bytes*components;var result=new Float32Array(length);for(var _i503=0;_i503<accessor.count;_i503++){var uv=new ArrayType(arrayBuffer,byteOffset+_i503*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i503*components);}if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}function updateGltf(accessor,bufferView,buffers,newTexCoordArray){accessor.componentType=5126;buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});bufferView.buffer=buffers.length-1;bufferView.byteLength=newTexCoordArray.buffer.byteLength;bufferView.byteOffset=0;delete bufferView.byteStride;}function createAttribute(newTexCoord,originalAccessor,primitive,gltfData,newTexCoordArray){gltfData.buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});var bufferViews=gltfData.json.bufferViews;if(!bufferViews){return;}bufferViews.push({buffer:gltfData.buffers.length-1,byteLength:newTexCoordArray.buffer.byteLength,byteOffset:0});var accessors=gltfData.json.accessors;if(!accessors){return;}accessors.push({bufferView:(bufferViews===null||bufferViews===void 0?void 0:bufferViews.length)-1,byteOffset:0,componentType:5126,count:originalAccessor.count,type:'VEC2'});primitive.attributes["TEXCOORD_".concat(newTexCoord)]=accessors.length-1;}function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatirx=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatirx=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$4});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$3(_x78){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43(gltfData){var gltfScenegraph,json,extension,_iterator50,_step50,_node0,nodeExtension;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}_iterator50=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){_node0=_step50.value;nodeExtension=gltfScenegraph.getObjectExtension(_node0,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node0.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node0,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}case 1:return _context46.a(2);}},_callee43);}));return _decode$4.apply(this,arguments);}function encode$2(_x79){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44(gltfData){var gltfScenegraph,json,extension,_iterator51,_step51,light,_node1;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$2(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator51=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){light=_step51.value;_node1=light.node;gltfScenegraph.addObjectExtension(_node1,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}delete gltfScenegraph.json.lights;}case 1:return _context47.a(2);}},_callee44);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$3,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$2(_x80){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(gltfData){var gltfScenegraph,json,_iterator52,_step52,material,extension;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;_iterator52=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){material=_step52.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 1:return _context48.a(2);}},_callee45);}));return _decode$5.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator31=_createForOfIteratorHelper(json.materials||[]),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var material=_step31.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode$1(_x81){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(gltfData){var gltfScenegraph,json,extension,techniques,_iterator53,_step53,material,materialExtension;return _regenerator().w(function(_context49){while(1)switch(_context49.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator53=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){material=_step53.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){material.technique=Object.assign({},materialExtension,techniques[materialExtension.technique]);material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 1:return _context49.a(2);}},_callee46);}));return _decode$6.apply(this,arguments);}function encode(_x82,_x83){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(gltfData,options){return _regenerator().w(function(_context50){while(1)switch(_context50.n){case 0:return _context50.a(2);}},_callee47);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,gltfScenegraph){var _techniquesExtension$=techniquesExtension.programs,programs=_techniquesExtension$===void 0?[]:_techniquesExtension$,_techniquesExtension$2=techniquesExtension.shaders,shaders=_techniquesExtension$2===void 0?[]:_techniquesExtension$2,_techniquesExtension$3=techniquesExtension.techniques,techniques=_techniquesExtension$3===void 0?[]:_techniquesExtension$3;var textDecoder=new TextDecoder();shaders.forEach(function(shader){if(Number.isFinite(shader.bufferView)){shader.code=textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));}else{throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(function(program){program.fragmentShader=shaders[program.fragmentShader];program.vertexShader=shaders[program.vertexShader];});techniques.forEach(function(technique){technique.program=programs[technique.program];});return techniques;}function resolveValues(technique,gltfScenegraph){var values=Object.assign({},technique.values);Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});Object.keys(values).forEach(function(uniform){if(_typeof2(values[uniform])==='object'&&values[uniform].index!==undefined){values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode});var EXT_FEATURE_METADATA='EXT_feature_metadata';var name=EXT_FEATURE_METADATA;function decode(_x84){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(gltfData){var scenegraph;return _regenerator().w(function(_context51){while(1)switch(_context51.n){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 1:return _context51.a(2);}},_callee48);}));return _decode.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph){var _extension$schema;var extension=scenegraph.getExtension(EXT_FEATURE_METADATA);var schemaClasses=extension===null||extension===void 0?void 0:(_extension$schema=extension.schema)===null||_extension$schema===void 0?void 0:_extension$schema.classes;var featureTables=extension===null||extension===void 0?void 0:extension.featureTables;var featureTextures=extension===null||extension===void 0?void 0:extension.featureTextures;if(featureTextures){console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');}if(schemaClasses&&featureTables){for(var schemaName in schemaClasses){var schemaClass=schemaClasses[schemaName];var featureTable=findFeatureTableByName(featureTables,schemaName);if(featureTable){handleFeatureTableProperties(scenegraph,featureTable,schemaClass);}}}}function handleFeatureTableProperties(scenegraph,featureTable,schemaClass){for(var propertyName in schemaClass.properties){var _featureTable$propert;var schemaProperty=schemaClass.properties[propertyName];var featureTableProperty=featureTable===null||featureTable===void 0?void 0:(_featureTable$propert=featureTable.properties)===null||_featureTable$propert===void 0?void 0:_featureTable$propert[propertyName];var numberOfFeatures=featureTable.count;if(featureTableProperty){var data=getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty);featureTableProperty.data=data;}}}function getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty){var bufferView=featureTableProperty.bufferView;var data=scenegraph.getTypedArrayForBufferView(bufferView);switch(schemaProperty.type){case'STRING':{var stringOffsetBufferView=featureTableProperty.stringOffsetBufferView;var offsetsData=scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);data=getStringAttributes(data,offsetsData,numberOfFeatures);break;}}return data;}function findFeatureTableByName(featureTables,schemaClassName){for(var featureTableName in featureTables){var featureTable=featureTables[featureTableName];if(featureTable["class"]===schemaClassName){return featureTable;}}return null;}function getStringAttributes(data,offsetsData,stringsCount){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;var bytesPerStringSize=4;for(var index=0;index<stringsCount;index++){var stringByteSize=offsetsData[(index+1)*bytesPerStringSize]-offsetsData[index*bytesPerStringSize];var stringData=data.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}return stringsArray;}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator32=_createForOfIteratorHelper(extensions),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var extension=_step32.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}}function decodeExtensions(_x85){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49(gltf){var options,context,extensions,_iterator54,_step54,extension,_extension$decode,_args45=arguments,_t32;return _regenerator().w(function(_context52){while(1)switch(_context52.p=_context52.n){case 0:options=_args45.length>1&&_args45[1]!==undefined?_args45[1]:{};context=_args45.length>2?_args45[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator54=_createForOfIteratorHelper(extensions);_context52.p=1;_iterator54.s();case 2:if((_step54=_iterator54.n()).done){_context52.n=4;break;}extension=_step54.value;_context52.n=3;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 3:_context52.n=2;break;case 4:_context52.n=6;break;case 5:_context52.p=5;_t32=_context52.v;_iterator54.e(_t32);case 6:_context52.p=6;_iterator54.f();return _context52.f(6);case 7:return _context52.a(2);}},_callee49,null,[[1,5,6,7]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf;var excludes=(options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;var _iterator33=_createForOfIteratorHelper(json.images||[]),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _image6=_step33.value;var extension=gltfScenegraph.getObjectExtension(_image6,KHR_BINARY_GLTF);if(extension){Object.assign(_image6,extension);}gltfScenegraph.removeObjectExtension(_image6,KHR_BINARY_GLTF);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}if(json.buffers&&json.buffers[0]){delete json.buffers[0].uri;}gltfScenegraph.removeExtension(KHR_BINARY_GLTF);}var GLTF_ARRAYS={accessors:'accessor',animations:'animation',buffers:'buffer',bufferViews:'bufferView',images:'image',materials:'material',meshes:'mesh',nodes:'node',samplers:'sampler',scenes:'scene',skins:'skin',textures:'texture'};var GLTF_KEYS={accessor:'accessors',animations:'animation',buffer:'buffers',bufferView:'bufferViews',image:'images',material:'materials',mesh:'meshes',node:'nodes',sampler:'samplers',scene:'scenes',skin:'skins',texture:'textures'};var GLTFV1Normalizer=/*#__PURE__*/function(){function GLTFV1Normalizer(){_classCallCheck(this,GLTFV1Normalizer);_defineProperty(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}});_defineProperty(this,"json",void 0);}return _createClass(GLTFV1Normalizer,[{key:"normalize",value:function normalize(gltf,options){this.json=gltf.json;var json=gltf.json;switch(json.asset&&json.asset.version){case'2.0':return;case undefined:case'1.0':break;default:console.warn("glTF: Unknown version ".concat(json.asset.version));return;}if(!options.normalize){throw new Error('glTF v1 is not supported.');}console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');this._addAsset(json);this._convertTopLevelObjectsToArrays(json);preprocess(gltf);this._convertObjectIdsToArrayIndices(json);this._updateObjects(json);this._updateMaterial(json);}},{key:"_addAsset",value:function _addAsset(json){json.asset=json.asset||{};json.asset.version='2.0';json.asset.generator=json.asset.generator||'Normalized to glTF 2.0 by loaders.gl';}},{key:"_convertTopLevelObjectsToArrays",value:function _convertTopLevelObjectsToArrays(json){for(var arrayName in GLTF_ARRAYS){this._convertTopLevelObjectToArray(json,arrayName);}}},{key:"_convertTopLevelObjectToArray",value:function _convertTopLevelObjectToArray(json,mapName){var objectMap=json[mapName];if(!objectMap||Array.isArray(objectMap)){return;}json[mapName]=[];for(var id in objectMap){var object=objectMap[id];object.id=object.id||id;var index=json[mapName].length;json[mapName].push(object);this.idToIndexMap[mapName][id]=index;}}},{key:"_convertObjectIdsToArrayIndices",value:function _convertObjectIdsToArrayIndices(json){for(var arrayName in GLTF_ARRAYS){this._convertIdsToIndices(json,arrayName);}if('scene'in json){json.scene=this._convertIdToIndex(json.scene,'scene');}var _iterator34=_createForOfIteratorHelper(json.textures),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var texture=_step34.value;this._convertTextureIds(texture);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.meshes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _mesh8=_step35.value;this._convertMeshIds(_mesh8);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var _iterator36=_createForOfIteratorHelper(json.nodes),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _node4=_step36.value;this._convertNodeIds(_node4);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}var _iterator37=_createForOfIteratorHelper(json.scenes),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _node5=_step37.value;this._convertSceneIds(_node5);}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator38=_createForOfIteratorHelper(mesh.primitives),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _primitive4=_step38.value;var attributes=_primitive4.attributes,indices=_primitive4.indices,material=_primitive4.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive4.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive4.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_convertNodeIds",value:function _convertNodeIds(node){var _this125=this;if(node.children){node.children=node.children.map(function(child){return _this125._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this125._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this126=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this126._convertIdToIndex(node,'node');});}}},{key:"_convertIdsToIndices",value:function _convertIdsToIndices(json,topLevelArrayName){if(!json[topLevelArrayName]){console.warn("gltf v1: json doesn't contain attribute ".concat(topLevelArrayName));json[topLevelArrayName]=[];}var _iterator39=_createForOfIteratorHelper(json[topLevelArrayName]),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var object=_step39.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}},{key:"_convertIdToIndex",value:function _convertIdToIndex(id,key){var arrayName=GLTF_KEYS[key];if(arrayName in this.idToIndexMap){var index=this.idToIndexMap[arrayName][id];if(!Number.isFinite(index)){throw new Error("gltf v1: failed to resolve ".concat(key," with id ").concat(id));}return index;}return id;}},{key:"_updateObjects",value:function _updateObjects(json){var _iterator40=_createForOfIteratorHelper(this.json.buffers),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var buffer=_step40.value;delete buffer.type;}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator41=_createForOfIteratorHelper(json.materials),_step41;try{var _loop4=function _loop4(){var material=_step41.value;material.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var textureId=((_material$values=material.values)===null||_material$values===void 0?void 0:_material$values.tex)||((_material$values2=material.values)===null||_material$values2===void 0?void 0:_material$values2.texture2d_0)||((_material$values3=material.values)===null||_material$values3===void 0?void 0:_material$values3.diffuseTex);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}},_material$values,_material$values2,_material$values3;for(_iterator41.s();!(_step41=_iterator41.n()).done;){_loop4();}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}}}]);}();function normalizeGLTFV1(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return new GLTFV1Normalizer().normalize(gltf,options);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var GL_SAMPLER={TEXTURE_MAG_FILTER:0x2800,TEXTURE_MIN_FILTER:0x2801,TEXTURE_WRAP_S:0x2802,TEXTURE_WRAP_T:0x2803,REPEAT:0x2901,LINEAR:0x2601,NEAREST_MIPMAP_LINEAR:0x2702};var SAMPLER_PARAMETER_GLTF_TO_GL={magFilter:GL_SAMPLER.TEXTURE_MAG_FILTER,minFilter:GL_SAMPLER.TEXTURE_MIN_FILTER,wrapS:GL_SAMPLER.TEXTURE_WRAP_S,wrapT:GL_SAMPLER.TEXTURE_WRAP_T};var DEFAULT_SAMPLER=_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({},GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT);function getBytesFromComponentType(componentType){return BYTES[componentType];}function getSizeFromAccessorType(type){return COMPONENTS[type];}var GLTFPostProcessor=/*#__PURE__*/function(){function GLTFPostProcessor(){_classCallCheck(this,GLTFPostProcessor);_defineProperty(this,"baseUri",'');_defineProperty(this,"json",{});_defineProperty(this,"buffers",[]);_defineProperty(this,"images",[]);}return _createClass(GLTFPostProcessor,[{key:"postProcess",value:function postProcess(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var json=gltf.json,_gltf$buffers=gltf.buffers,buffers=_gltf$buffers===void 0?[]:_gltf$buffers,_gltf$images=gltf.images,images=_gltf$images===void 0?[]:_gltf$images,_gltf$baseUri=gltf.baseUri,baseUri=_gltf$baseUri===void 0?'':_gltf$baseUri;assert$2(json);this.baseUri=baseUri;this.json=json;this.buffers=buffers;this.images=images;this._resolveTree(this.json,options);return this.json;}},{key:"_resolveTree",value:function _resolveTree(json){var _this127=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this127._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this127._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this127._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this127._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this127._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this127._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this127._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this127._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this127._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this127._resolveScene(scene,i);});}if(json.scene!==undefined){json.scene=json.scenes[this.json.scene];}}},{key:"getScene",value:function getScene(index){return this._get('scenes',index);}},{key:"getNode",value:function getNode(index){return this._get('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this._get('skins',index);}},{key:"getMesh",value:function getMesh(index){return this._get('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this._get('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this._get('accessors',index);}},{key:"getCamera",value:function getCamera(index){return null;}},{key:"getTexture",value:function getTexture(index){return this._get('textures',index);}},{key:"getSampler",value:function getSampler(index){return this._get('samplers',index);}},{key:"getImage",value:function getImage(index){return this._get('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this._get('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this._get('buffers',index);}},{key:"_get",value:function _get(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){console.warn("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"_resolveScene",value:function _resolveScene(scene,index){var _this128=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this128.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this129=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this129.getNode(child);});}if(node.mesh!==undefined){node.mesh=this.getMesh(node.mesh);}else if(node.meshes!==undefined&&node.meshes.length){node.mesh=node.meshes.reduce(function(accum,meshIndex){var mesh=_this129.getMesh(meshIndex);accum.id=mesh.id;accum.primitives=accum.primitives.concat(mesh.primitives);return accum;},{primitives:[]});}if(node.camera!==undefined){node.camera=this.getCamera(node.camera);}if(node.skin!==undefined){node.skin=this.getSkin(node.skin);}return node;}},{key:"_resolveSkin",value:function _resolveSkin(skin,index){skin.id=skin.id||"skin-".concat(index);skin.inverseBindMatrices=this.getAccessor(skin.inverseBindMatrices);return skin;}},{key:"_resolveMesh",value:function _resolveMesh(mesh,index){var _this130=this;mesh.id=mesh.id||"mesh-".concat(index);if(mesh.primitives){mesh.primitives=mesh.primitives.map(function(primitive){primitive=_objectSpread({},primitive);var attributes=primitive.attributes;primitive.attributes={};for(var attribute in attributes){primitive.attributes[attribute]=_this130.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this130.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this130.getMaterial(primitive.material);}return primitive;});}return mesh;}},{key:"_resolveMaterial",value:function _resolveMaterial(material,index){material.id=material.id||"material-".concat(index);if(material.normalTexture){material.normalTexture=_objectSpread({},material.normalTexture);material.normalTexture.texture=this.getTexture(material.normalTexture.index);}if(material.occlusionTexture){material.occlustionTexture=_objectSpread({},material.occlustionTexture);material.occlusionTexture.texture=this.getTexture(material.occlusionTexture.index);}if(material.emissiveTexture){material.emmisiveTexture=_objectSpread({},material.emmisiveTexture);material.emissiveTexture.texture=this.getTexture(material.emissiveTexture.index);}if(!material.emissiveFactor){material.emissiveFactor=material.emmisiveTexture?[1,1,1]:[0,0,0];}if(material.pbrMetallicRoughness){material.pbrMetallicRoughness=_objectSpread({},material.pbrMetallicRoughness);var mr=material.pbrMetallicRoughness;if(mr.baseColorTexture){mr.baseColorTexture=_objectSpread({},mr.baseColorTexture);mr.baseColorTexture.texture=this.getTexture(mr.baseColorTexture.index);}if(mr.metallicRoughnessTexture){mr.metallicRoughnessTexture=_objectSpread({},mr.metallicRoughnessTexture);mr.metallicRoughnessTexture.texture=this.getTexture(mr.metallicRoughnessTexture.index);}}return material;}},{key:"_resolveAccessor",value:function _resolveAccessor(accessor,index){accessor.id=accessor.id||"accessor-".concat(index);if(accessor.bufferView!==undefined){accessor.bufferView=this.getBufferView(accessor.bufferView);}accessor.bytesPerComponent=getBytesFromComponentType(accessor.componentType);accessor.components=getSizeFromAccessorType(accessor.type);accessor.bytesPerElement=accessor.bytesPerComponent*accessor.components;if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorArrayType3=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType3.ArrayType,byteLength=_getAccessorArrayType3.byteLength;var byteOffset=(accessor.bufferView.byteOffset||0)+(accessor.byteOffset||0)+buffer.byteOffset;var cutBuffer=buffer.arrayBuffer.slice(byteOffset,byteOffset+byteLength);if(accessor.bufferView.byteStride){cutBuffer=this._getValueFromInterleavedBuffer(buffer,byteOffset,accessor.bufferView.byteStride,accessor.bytesPerElement,accessor.count);}accessor.value=new ArrayType(cutBuffer);}return accessor;}},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i504=0;_i504<count;_i504++){var elementOffset=byteOffset+_i504*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i504*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(texture,index){texture.id=texture.id||"texture-".concat(index);texture.sampler='sampler'in texture?this.getSampler(texture.sampler):DEFAULT_SAMPLER;texture.source=this.getImage(texture.source);return texture;}},{key:"_resolveSampler",value:function _resolveSampler(sampler,index){sampler.id=sampler.id||"sampler-".concat(index);sampler.parameters={};for(var key in sampler){var glEnum=this._enumSamplerParameter(key);if(glEnum!==undefined){sampler.parameters[glEnum]=sampler[key];}}return sampler;}},{key:"_enumSamplerParameter",value:function _enumSamplerParameter(key){return SAMPLER_PARAMETER_GLTF_TO_GL[key];}},{key:"_resolveImage",value:function _resolveImage(image,index){image.id=image.id||"image-".concat(index);if(image.bufferView!==undefined){image.bufferView=this.getBufferView(image.bufferView);}var preloadedImage=this.images[index];if(preloadedImage){image.image=preloadedImage;}return image;}},{key:"_resolveBufferView",value:function _resolveBufferView(bufferView,index){var bufferIndex=bufferView.buffer;var result=_objectSpread(_objectSpread({id:"bufferView-".concat(index)},bufferView),{},{buffer:this.buffers[bufferIndex]});var arrayBuffer=this.buffers[bufferIndex].arrayBuffer;var byteOffset=this.buffers[bufferIndex].byteOffset||0;if('byteOffset'in bufferView){byteOffset+=bufferView.byteOffset;}result.data=new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);return result;}},{key:"_resolveCamera",value:function _resolveCamera(camera,index){camera.id=camera.id||"camera-".concat(index);if(camera.perspective);if(camera.orthographic);return camera;}}]);}();function postProcessGLTF(gltf,options){return new GLTFPostProcessor().postProcess(gltf,options);}var MAGIC_glTF=0x676c5446;var GLB_FILE_HEADER_SIZE=12;var GLB_CHUNK_HEADER_SIZE=8;var GLB_CHUNK_TYPE_JSON=0x4e4f534a;var GLB_CHUNK_TYPE_BIN=0x004e4942;var GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED=0;var GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED=1;var GLB_V1_CONTENT_FORMAT_JSON=0x0;var LE=true;function getMagicString(dataView){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return"".concat(String.fromCharCode(dataView.getUint8(byteOffset+0))).concat(String.fromCharCode(dataView.getUint8(byteOffset+1))).concat(String.fromCharCode(dataView.getUint8(byteOffset+2))).concat(String.fromCharCode(dataView.getUint8(byteOffset+3)));}function isGLB(arrayBuffer){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var dataView=new DataView(arrayBuffer);var _options$magic=options.magic,magic=_options$magic===void 0?MAGIC_glTF:_options$magic;var magic1=dataView.getUint32(byteOffset,false);return magic1===magic||magic1===MAGIC_glTF;}function parseGLBSync(glb,arrayBuffer){var byteOffset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var dataView=new DataView(arrayBuffer);var type=getMagicString(dataView,byteOffset+0);var version=dataView.getUint32(byteOffset+4,LE);var byteLength=dataView.getUint32(byteOffset+8,LE);Object.assign(glb,{header:{byteOffset:byteOffset,byteLength:byteLength,hasBinChunk:false},type:type,version:version,json:{},binChunks:[]});byteOffset+=GLB_FILE_HEADER_SIZE;switch(glb.version){case 1:return parseGLBV1(glb,dataView,byteOffset);case 2:return parseGLBV2(glb,dataView,byteOffset,{});default:throw new Error("Invalid GLB version ".concat(glb.version,". Only supports v1 and v2."));}}function parseGLBV1(glb,dataView,byteOffset){assert$5(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);var contentLength=dataView.getUint32(byteOffset+0,LE);var contentFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;assert$5(contentFormat===GLB_V1_CONTENT_FORMAT_JSON);parseJSONChunk(glb,dataView,byteOffset,contentLength);byteOffset+=contentLength;byteOffset+=parseBINChunk(glb,dataView,byteOffset,glb.header.byteLength);return byteOffset;}function parseGLBV2(glb,dataView,byteOffset,options){assert$5(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);parseGLBChunksSync(glb,dataView,byteOffset,options);return byteOffset+glb.header.byteLength;}function parseGLBChunksSync(glb,dataView,byteOffset,options){while(byteOffset+8<=glb.header.byteLength){var chunkLength=dataView.getUint32(byteOffset+0,LE);var chunkFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;switch(chunkFormat){case GLB_CHUNK_TYPE_JSON:parseJSONChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_BIN:parseBINChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:if(!options.strict){parseJSONChunk(glb,dataView,byteOffset,chunkLength);}break;case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:if(!options.strict){parseBINChunk(glb,dataView,byteOffset,chunkLength);}break;}byteOffset+=padToNBytes(chunkLength,4);}return byteOffset;}function parseJSONChunk(glb,dataView,byteOffset,chunkLength){var jsonChunk=new Uint8Array(dataView.buffer,byteOffset,chunkLength);var textDecoder=new TextDecoder('utf8');var jsonText=textDecoder.decode(jsonChunk);glb.json=JSON.parse(jsonText);return padToNBytes(chunkLength,4);}function parseBINChunk(glb,dataView,byteOffset,chunkLength){glb.header.hasBinChunk=true;glb.binChunks.push({byteOffset:byteOffset,byteLength:chunkLength,arrayBuffer:dataView.buffer});return padToNBytes(chunkLength,4);}function parseGLTF$1(_x86,_x87){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args46=arguments;return _regenerator().w(function(_context53){while(1)switch(_context53.n){case 0:byteOffset=_args46.length>2&&_args46[2]!==undefined?_args46[2]:0;options=_args46.length>3?_args46[3]:undefined;context=_args46.length>4?_args46[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.normalize});preprocessExtensions(gltf,options,context);promises=[];if(!(options!==null&&options!==void 0&&(_options$gltf2=options.gltf)!==null&&_options$gltf2!==void 0&&_options$gltf2.loadBuffers&&gltf.json.buffers)){_context53.n=1;break;}_context53.n=1;return loadBuffers(gltf,options,context);case 1:if(options!==null&&options!==void 0&&(_options$gltf3=options.gltf)!==null&&_options$gltf3!==void 0&&_options$gltf3.loadImages){_promise=loadImages(gltf,options,context);promises.push(_promise);}promise=decodeExtensions(gltf,options,context);promises.push(promise);_context53.n=2;return Promise.all(promises);case 2:return _context53.a(2,options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);}},_callee50);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){if(options.uri){gltf.baseUri=options.uri;}if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){var glb={};byteOffset=parseGLBSync(glb,data,byteOffset,options.glb);assert$2(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$2(false,'GLTF: must be ArrayBuffer or string');}var buffers=gltf.json.buffers||[];gltf.buffers=new Array(buffers.length).fill(null);if(gltf._glb&&gltf._glb.header.hasBinChunk){var binChunks=gltf._glb.binChunks;gltf.buffers[0]={arrayBuffer:binChunks[0].arrayBuffer,byteOffset:binChunks[0].byteOffset,byteLength:binChunks[0].byteLength};}var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}function loadBuffers(_x88,_x89,_x90){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(gltf,options,context){var buffers,_i585,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regenerator().w(function(_context54){while(1)switch(_context54.n){case 0:buffers=gltf.json.buffers||[];_i585=0;case 1:if(!(_i585<buffers.length)){_context54.n=6;break;}buffer=buffers[_i585];if(!buffer.uri){_context54.n=4;break;}_fetch=context.fetch;assert$2(_fetch);uri=resolveUrl(buffer.uri,options);_context54.n=2;return context===null||context===void 0?void 0:(_context$fetch=context.fetch)===null||_context$fetch===void 0?void 0:_context$fetch.call(context,uri);case 2:response=_context54.v;_context54.n=3;return response===null||response===void 0?void 0:(_response$arrayBuffer=response.arrayBuffer)===null||_response$arrayBuffer===void 0?void 0:_response$arrayBuffer.call(response);case 3:arrayBuffer=_context54.v;gltf.buffers[_i585]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context54.n=5;break;case 4:if(gltf.buffers[_i585]===null){gltf.buffers[_i585]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 5:++_i585;_context54.n=1;break;case 6:return _context54.a(2);}},_callee51);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x91,_x92,_x93){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52(gltf,options,context){var imageIndices,images,promises,_iterator55,_step55,imageIndex;return _regenerator().w(function(_context55){while(1)switch(_context55.n){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator55=_createForOfIteratorHelper(imageIndices);try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){imageIndex=_step55.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}_context55.n=1;return Promise.all(promises);case 1:return _context55.a(2,_context55.v);}},_callee52);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator42=_createForOfIteratorHelper(textures),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var texture=_step42.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return Array.from(imageIndices).sort();}function loadImage(_x94,_x95,_x96,_x97,_x98){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regenerator().w(function(_context56){while(1)switch(_context56.n){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context56.n=3;break;}uri=resolveUrl(image.uri,options);_context56.n=1;return fetch(uri);case 1:response=_context56.v;_context56.n=2;return response.arrayBuffer();case 2:arrayBuffer=_context56.v;image.bufferView={data:arrayBuffer};case 3:if(Number.isFinite(image.bufferView)){array=getTypedArrayForBufferView(gltf.json,gltf.buffers,image.bufferView);arrayBuffer=sliceArrayBuffer(array.buffer,array.byteOffset,array.byteLength);}assert$2(arrayBuffer,'glTF image has no data');_context56.n=4;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 4:parsedImage=_context56.v;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}gltf.images=gltf.images||[];gltf.images[index]=parsedImage;case 5:return _context56.a(2);}},_callee53);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$5,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse,options:{gltf:{normalize:true,loadBuffers:true,loadImages:true,decompressMeshes:true,postProcess:true},log:console},deprecatedOptions:{fetchImages:'gltf.loadImages',createImages:'gltf.loadImages',decompress:'gltf.decompressMeshes',postProcess:'gltf.postProcess',gltf:{decompress:'gltf.decompressMeshes'}}};function parse(_x99){return _parse.apply(this,arguments);}/**
|
|
25245
|
+
*/function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out;}var INDICES;(function(INDICES){INDICES[INDICES["COL0ROW0"]=0]="COL0ROW0";INDICES[INDICES["COL0ROW1"]=1]="COL0ROW1";INDICES[INDICES["COL0ROW2"]=2]="COL0ROW2";INDICES[INDICES["COL1ROW0"]=3]="COL1ROW0";INDICES[INDICES["COL1ROW1"]=4]="COL1ROW1";INDICES[INDICES["COL1ROW2"]=5]="COL1ROW2";INDICES[INDICES["COL2ROW0"]=6]="COL2ROW0";INDICES[INDICES["COL2ROW1"]=7]="COL2ROW1";INDICES[INDICES["COL2ROW2"]=8]="COL2ROW2";})(INDICES||(INDICES={}));var IDENTITY_MATRIX=Object.freeze([1,0,0,0,1,0,0,0,1]);var Matrix3=/*#__PURE__*/function(_Matrix){function Matrix3(array){var _this124;for(var _len72=arguments.length,args=new Array(_len72>1?_len72-1:0),_key10=1;_key10<_len72;_key10++){args[_key10-1]=arguments[_key10];}_classCallCheck(this,Matrix3);_this124=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this124.copy(array);}else if(args.length>0){_this124.copy([array].concat(args));}else{_this124.identity();}return _this124;}_inherits(Matrix3,_Matrix);return _createClass(Matrix3,[{key:"ELEMENTS",get:function get(){return 9;}},{key:"RANK",get:function get(){return 3;}},{key:"INDICES",get:function get(){return INDICES;}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=array[4];this[5]=array[5];this[6]=array[6];this[7]=array[7];this[8]=array[8];return this.check();}},{key:"identity",value:function identity(){return this.copy(IDENTITY_MATRIX);}},{key:"fromObject",value:function fromObject(object){return this.check();}},{key:"fromQuaternion",value:function fromQuaternion(q){fromQuat(this,q);return this.check();}},{key:"set",value:function set(m00,m10,m20,m01,m11,m21,m02,m12,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"setRowMajor",value:function setRowMajor(m00,m01,m02,m10,m11,m12,m20,m21,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"determinant",value:function determinant(){return _determinant(this);}},{key:"transpose",value:function transpose(){_transpose(this,this);return this.check();}},{key:"invert",value:function invert(){_invert(this,this);return this.check();}},{key:"multiplyLeft",value:function multiplyLeft(a){multiply(this,a,this);return this.check();}},{key:"multiplyRight",value:function multiplyRight(a){multiply(this,this,a);return this.check();}},{key:"rotate",value:function rotate(radians){_rotate(this,this,radians);return this.check();}},{key:"scale",value:function scale(factor){if(Array.isArray(factor)){_scale8(this,this,factor);}else{_scale8(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}},{key:"transform",value:function transform(vector,result){var out;switch(vector.length){case 2:out=transformMat3$1(result||[-0,-0],vector,this);break;case 3:out=transformMat3(result||[-0,-0,-0],vector,this);break;case 4:out=vec4_transformMat3(result||[-0,-0,-0,-0],vector,this);break;default:throw new Error('Illegal vector');}checkVector(out,vector.length);return out;}},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}},{key:"transformVector3",value:function transformVector3(vector,result){return this.transform(vector,result);}}],[{key:"IDENTITY",get:function get(){return getIdentityMatrix();}},{key:"ZERO",get:function get(){return getZeroMatrix();}}]);}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3;function getZeroMatrix(){if(!ZERO_MATRIX3){ZERO_MATRIX3=new Matrix3([0,0,0,0,0,0,0,0,0]);Object.freeze(ZERO_MATRIX3);}return ZERO_MATRIX3;}function getIdentityMatrix(){if(!IDENTITY_MATRIX3){IDENTITY_MATRIX3=new Matrix3();Object.freeze(IDENTITY_MATRIX3);}return IDENTITY_MATRIX3;}var COMPONENTS$1={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES$1={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var EXT_MESHOPT_TRANSFORM='KHR_texture_transform';var name$4=EXT_MESHOPT_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();function decode$4(_x76,_x77){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42(gltfData,options){var gltfScenegraph,extension,materials,_i585;return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context45.n=1;break;}return _context45.a(2);case 1:materials=gltfData.json.materials||[];for(_i585=0;_i585<materials.length;_i585++){transformTexCoords(_i585,gltfData);}case 2:return _context45.a(2);}},_callee42);}));return _decode$3.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var processedTexCoords=[];var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var baseColorTexture=material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture;if(baseColorTexture){transformPrimitives(gltfData,materialIndex,baseColorTexture,processedTexCoords);}var emisiveTexture=material===null||material===void 0?void 0:material.emissiveTexture;if(emisiveTexture){transformPrimitives(gltfData,materialIndex,emisiveTexture,processedTexCoords);}var normalTexture=material===null||material===void 0?void 0:material.normalTexture;if(normalTexture){transformPrimitives(gltfData,materialIndex,normalTexture,processedTexCoords);}var occlusionTexture=material===null||material===void 0?void 0:material.occlusionTexture;if(occlusionTexture){transformPrimitives(gltfData,materialIndex,occlusionTexture,processedTexCoords);}var metallicRoughnessTexture=material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture;if(metallicRoughnessTexture){transformPrimitives(gltfData,materialIndex,metallicRoughnessTexture,processedTexCoords);}}function transformPrimitives(gltfData,materialIndex,texture,processedTexCoords){var transformParameters=getTransformParameters(texture,processedTexCoords);if(!transformParameters){return;}var meshes=gltfData.json.meshes||[];var _iterator29=_createForOfIteratorHelper(meshes),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _mesh7=_step29.value;var _iterator30=_createForOfIteratorHelper(_mesh7.primitives),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var _primitive3=_step30.value;var material=_primitive3.material;if(Number.isFinite(material)&&materialIndex===material){transformPrimitive(gltfData,_primitive3,transformParameters);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}function getTransformParameters(texture,processedTexCoords){var _texture$extensions;var textureInfo=(_texture$extensions=texture.extensions)===null||_texture$extensions===void 0?void 0:_texture$extensions[EXT_MESHOPT_TRANSFORM];var _texture$texCoord=texture.texCoord,originalTexCoord=_texture$texCoord===void 0?0:_texture$texCoord;var _textureInfo$texCoord=textureInfo.texCoord,texCoord=_textureInfo$texCoord===void 0?originalTexCoord:_textureInfo$texCoord;var isProcessed=processedTexCoords.findIndex(function(_ref){var _ref19=_slicedToArray(_ref,2),original=_ref19[0],newTexCoord=_ref19[1];return original===originalTexCoord&&newTexCoord===texCoord;})!==-1;if(!isProcessed){var _matrix2=makeTransformationMatrix(textureInfo);if(originalTexCoord!==texCoord){texture.texCoord=texCoord;}processedTexCoords.push([originalTexCoord,texCoord]);return{originalTexCoord:originalTexCoord,texCoord:texCoord,matrix:_matrix2};}return null;}function transformPrimitive(gltfData,primitive,transformParameters){var originalTexCoord=transformParameters.originalTexCoord,texCoord=transformParameters.texCoord,matrix=transformParameters.matrix;var texCoordAccessor=primitive.attributes["TEXCOORD_".concat(originalTexCoord)];if(Number.isFinite(texCoordAccessor)){var _gltfData$json$access;var accessor=(_gltfData$json$access=gltfData.json.accessors)===null||_gltfData$json$access===void 0?void 0:_gltfData$json$access[texCoordAccessor];if(accessor&&accessor.bufferView){var _gltfData$json$buffer;var bufferView=(_gltfData$json$buffer=gltfData.json.bufferViews)===null||_gltfData$json$buffer===void 0?void 0:_gltfData$json$buffer[accessor.bufferView];if(bufferView){var _gltfData$buffers$buf=gltfData.buffers[bufferView.buffer],arrayBuffer=_gltfData$buffers$buf.arrayBuffer,bufferByteOffset=_gltfData$buffers$buf.byteOffset;var byteOffset=(bufferByteOffset||0)+(accessor.byteOffset||0)+(bufferView.byteOffset||0);var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType2.ArrayType,length=_getAccessorArrayType2.length;var bytes=BYTES$1[accessor.componentType];var components=COMPONENTS$1[accessor.type];var elementAddressScale=bufferView.byteStride||bytes*components;var result=new Float32Array(length);for(var _i504=0;_i504<accessor.count;_i504++){var uv=new ArrayType(arrayBuffer,byteOffset+_i504*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i504*components);}if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}function updateGltf(accessor,bufferView,buffers,newTexCoordArray){accessor.componentType=5126;buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});bufferView.buffer=buffers.length-1;bufferView.byteLength=newTexCoordArray.buffer.byteLength;bufferView.byteOffset=0;delete bufferView.byteStride;}function createAttribute(newTexCoord,originalAccessor,primitive,gltfData,newTexCoordArray){gltfData.buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});var bufferViews=gltfData.json.bufferViews;if(!bufferViews){return;}bufferViews.push({buffer:gltfData.buffers.length-1,byteLength:newTexCoordArray.buffer.byteLength,byteOffset:0});var accessors=gltfData.json.accessors;if(!accessors){return;}accessors.push({bufferView:(bufferViews===null||bufferViews===void 0?void 0:bufferViews.length)-1,byteOffset:0,componentType:5126,count:originalAccessor.count,type:'VEC2'});primitive.attributes["TEXCOORD_".concat(newTexCoord)]=accessors.length-1;}function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatirx=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatirx=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$4});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$3(_x78){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43(gltfData){var gltfScenegraph,json,extension,_iterator50,_step50,_node0,nodeExtension;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}_iterator50=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){_node0=_step50.value;nodeExtension=gltfScenegraph.getObjectExtension(_node0,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node0.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node0,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}case 1:return _context46.a(2);}},_callee43);}));return _decode$4.apply(this,arguments);}function encode$2(_x79){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44(gltfData){var gltfScenegraph,json,extension,_iterator51,_step51,light,_node1;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$2(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator51=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){light=_step51.value;_node1=light.node;gltfScenegraph.addObjectExtension(_node1,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}delete gltfScenegraph.json.lights;}case 1:return _context47.a(2);}},_callee44);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$3,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$2(_x80){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(gltfData){var gltfScenegraph,json,_iterator52,_step52,material,extension;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;_iterator52=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){material=_step52.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 1:return _context48.a(2);}},_callee45);}));return _decode$5.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator31=_createForOfIteratorHelper(json.materials||[]),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var material=_step31.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode$1(_x81){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(gltfData){var gltfScenegraph,json,extension,techniques,_iterator53,_step53,material,materialExtension;return _regenerator().w(function(_context49){while(1)switch(_context49.n){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator53=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){material=_step53.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){material.technique=Object.assign({},materialExtension,techniques[materialExtension.technique]);material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 1:return _context49.a(2);}},_callee46);}));return _decode$6.apply(this,arguments);}function encode(_x82,_x83){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(gltfData,options){return _regenerator().w(function(_context50){while(1)switch(_context50.n){case 0:return _context50.a(2);}},_callee47);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,gltfScenegraph){var _techniquesExtension$=techniquesExtension.programs,programs=_techniquesExtension$===void 0?[]:_techniquesExtension$,_techniquesExtension$2=techniquesExtension.shaders,shaders=_techniquesExtension$2===void 0?[]:_techniquesExtension$2,_techniquesExtension$3=techniquesExtension.techniques,techniques=_techniquesExtension$3===void 0?[]:_techniquesExtension$3;var textDecoder=new TextDecoder();shaders.forEach(function(shader){if(Number.isFinite(shader.bufferView)){shader.code=textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));}else{throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(function(program){program.fragmentShader=shaders[program.fragmentShader];program.vertexShader=shaders[program.vertexShader];});techniques.forEach(function(technique){technique.program=programs[technique.program];});return techniques;}function resolveValues(technique,gltfScenegraph){var values=Object.assign({},technique.values);Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});Object.keys(values).forEach(function(uniform){if(_typeof2(values[uniform])==='object'&&values[uniform].index!==undefined){values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode});var EXT_FEATURE_METADATA='EXT_feature_metadata';var name=EXT_FEATURE_METADATA;function decode(_x84){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(gltfData){var scenegraph;return _regenerator().w(function(_context51){while(1)switch(_context51.n){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 1:return _context51.a(2);}},_callee48);}));return _decode.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph){var _extension$schema;var extension=scenegraph.getExtension(EXT_FEATURE_METADATA);var schemaClasses=extension===null||extension===void 0?void 0:(_extension$schema=extension.schema)===null||_extension$schema===void 0?void 0:_extension$schema.classes;var featureTables=extension===null||extension===void 0?void 0:extension.featureTables;var featureTextures=extension===null||extension===void 0?void 0:extension.featureTextures;if(featureTextures){console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');}if(schemaClasses&&featureTables){for(var schemaName in schemaClasses){var schemaClass=schemaClasses[schemaName];var featureTable=findFeatureTableByName(featureTables,schemaName);if(featureTable){handleFeatureTableProperties(scenegraph,featureTable,schemaClass);}}}}function handleFeatureTableProperties(scenegraph,featureTable,schemaClass){for(var propertyName in schemaClass.properties){var _featureTable$propert;var schemaProperty=schemaClass.properties[propertyName];var featureTableProperty=featureTable===null||featureTable===void 0?void 0:(_featureTable$propert=featureTable.properties)===null||_featureTable$propert===void 0?void 0:_featureTable$propert[propertyName];var numberOfFeatures=featureTable.count;if(featureTableProperty){var data=getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty);featureTableProperty.data=data;}}}function getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty){var bufferView=featureTableProperty.bufferView;var data=scenegraph.getTypedArrayForBufferView(bufferView);switch(schemaProperty.type){case'STRING':{var stringOffsetBufferView=featureTableProperty.stringOffsetBufferView;var offsetsData=scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);data=getStringAttributes(data,offsetsData,numberOfFeatures);break;}}return data;}function findFeatureTableByName(featureTables,schemaClassName){for(var featureTableName in featureTables){var featureTable=featureTables[featureTableName];if(featureTable["class"]===schemaClassName){return featureTable;}}return null;}function getStringAttributes(data,offsetsData,stringsCount){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;var bytesPerStringSize=4;for(var index=0;index<stringsCount;index++){var stringByteSize=offsetsData[(index+1)*bytesPerStringSize]-offsetsData[index*bytesPerStringSize];var stringData=data.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}return stringsArray;}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator32=_createForOfIteratorHelper(extensions),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var extension=_step32.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}}function decodeExtensions(_x85){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49(gltf){var options,context,extensions,_iterator54,_step54,extension,_extension$decode,_args45=arguments,_t32;return _regenerator().w(function(_context52){while(1)switch(_context52.p=_context52.n){case 0:options=_args45.length>1&&_args45[1]!==undefined?_args45[1]:{};context=_args45.length>2?_args45[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator54=_createForOfIteratorHelper(extensions);_context52.p=1;_iterator54.s();case 2:if((_step54=_iterator54.n()).done){_context52.n=4;break;}extension=_step54.value;_context52.n=3;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 3:_context52.n=2;break;case 4:_context52.n=6;break;case 5:_context52.p=5;_t32=_context52.v;_iterator54.e(_t32);case 6:_context52.p=6;_iterator54.f();return _context52.f(6);case 7:return _context52.a(2);}},_callee49,null,[[1,5,6,7]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf;var excludes=(options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;var _iterator33=_createForOfIteratorHelper(json.images||[]),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _image6=_step33.value;var extension=gltfScenegraph.getObjectExtension(_image6,KHR_BINARY_GLTF);if(extension){Object.assign(_image6,extension);}gltfScenegraph.removeObjectExtension(_image6,KHR_BINARY_GLTF);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}if(json.buffers&&json.buffers[0]){delete json.buffers[0].uri;}gltfScenegraph.removeExtension(KHR_BINARY_GLTF);}var GLTF_ARRAYS={accessors:'accessor',animations:'animation',buffers:'buffer',bufferViews:'bufferView',images:'image',materials:'material',meshes:'mesh',nodes:'node',samplers:'sampler',scenes:'scene',skins:'skin',textures:'texture'};var GLTF_KEYS={accessor:'accessors',animations:'animation',buffer:'buffers',bufferView:'bufferViews',image:'images',material:'materials',mesh:'meshes',node:'nodes',sampler:'samplers',scene:'scenes',skin:'skins',texture:'textures'};var GLTFV1Normalizer=/*#__PURE__*/function(){function GLTFV1Normalizer(){_classCallCheck(this,GLTFV1Normalizer);_defineProperty(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}});_defineProperty(this,"json",void 0);}return _createClass(GLTFV1Normalizer,[{key:"normalize",value:function normalize(gltf,options){this.json=gltf.json;var json=gltf.json;switch(json.asset&&json.asset.version){case'2.0':return;case undefined:case'1.0':break;default:console.warn("glTF: Unknown version ".concat(json.asset.version));return;}if(!options.normalize){throw new Error('glTF v1 is not supported.');}console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');this._addAsset(json);this._convertTopLevelObjectsToArrays(json);preprocess(gltf);this._convertObjectIdsToArrayIndices(json);this._updateObjects(json);this._updateMaterial(json);}},{key:"_addAsset",value:function _addAsset(json){json.asset=json.asset||{};json.asset.version='2.0';json.asset.generator=json.asset.generator||'Normalized to glTF 2.0 by loaders.gl';}},{key:"_convertTopLevelObjectsToArrays",value:function _convertTopLevelObjectsToArrays(json){for(var arrayName in GLTF_ARRAYS){this._convertTopLevelObjectToArray(json,arrayName);}}},{key:"_convertTopLevelObjectToArray",value:function _convertTopLevelObjectToArray(json,mapName){var objectMap=json[mapName];if(!objectMap||Array.isArray(objectMap)){return;}json[mapName]=[];for(var id in objectMap){var object=objectMap[id];object.id=object.id||id;var index=json[mapName].length;json[mapName].push(object);this.idToIndexMap[mapName][id]=index;}}},{key:"_convertObjectIdsToArrayIndices",value:function _convertObjectIdsToArrayIndices(json){for(var arrayName in GLTF_ARRAYS){this._convertIdsToIndices(json,arrayName);}if('scene'in json){json.scene=this._convertIdToIndex(json.scene,'scene');}var _iterator34=_createForOfIteratorHelper(json.textures),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var texture=_step34.value;this._convertTextureIds(texture);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.meshes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _mesh8=_step35.value;this._convertMeshIds(_mesh8);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var _iterator36=_createForOfIteratorHelper(json.nodes),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _node4=_step36.value;this._convertNodeIds(_node4);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}var _iterator37=_createForOfIteratorHelper(json.scenes),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _node5=_step37.value;this._convertSceneIds(_node5);}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator38=_createForOfIteratorHelper(mesh.primitives),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _primitive4=_step38.value;var attributes=_primitive4.attributes,indices=_primitive4.indices,material=_primitive4.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive4.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive4.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_convertNodeIds",value:function _convertNodeIds(node){var _this125=this;if(node.children){node.children=node.children.map(function(child){return _this125._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this125._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this126=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this126._convertIdToIndex(node,'node');});}}},{key:"_convertIdsToIndices",value:function _convertIdsToIndices(json,topLevelArrayName){if(!json[topLevelArrayName]){console.warn("gltf v1: json doesn't contain attribute ".concat(topLevelArrayName));json[topLevelArrayName]=[];}var _iterator39=_createForOfIteratorHelper(json[topLevelArrayName]),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var object=_step39.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}},{key:"_convertIdToIndex",value:function _convertIdToIndex(id,key){var arrayName=GLTF_KEYS[key];if(arrayName in this.idToIndexMap){var index=this.idToIndexMap[arrayName][id];if(!Number.isFinite(index)){throw new Error("gltf v1: failed to resolve ".concat(key," with id ").concat(id));}return index;}return id;}},{key:"_updateObjects",value:function _updateObjects(json){var _iterator40=_createForOfIteratorHelper(this.json.buffers),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var buffer=_step40.value;delete buffer.type;}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator41=_createForOfIteratorHelper(json.materials),_step41;try{var _loop4=function _loop4(){var material=_step41.value;material.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var textureId=((_material$values=material.values)===null||_material$values===void 0?void 0:_material$values.tex)||((_material$values2=material.values)===null||_material$values2===void 0?void 0:_material$values2.texture2d_0)||((_material$values3=material.values)===null||_material$values3===void 0?void 0:_material$values3.diffuseTex);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}},_material$values,_material$values2,_material$values3;for(_iterator41.s();!(_step41=_iterator41.n()).done;){_loop4();}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}}}]);}();function normalizeGLTFV1(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return new GLTFV1Normalizer().normalize(gltf,options);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var GL_SAMPLER={TEXTURE_MAG_FILTER:0x2800,TEXTURE_MIN_FILTER:0x2801,TEXTURE_WRAP_S:0x2802,TEXTURE_WRAP_T:0x2803,REPEAT:0x2901,LINEAR:0x2601,NEAREST_MIPMAP_LINEAR:0x2702};var SAMPLER_PARAMETER_GLTF_TO_GL={magFilter:GL_SAMPLER.TEXTURE_MAG_FILTER,minFilter:GL_SAMPLER.TEXTURE_MIN_FILTER,wrapS:GL_SAMPLER.TEXTURE_WRAP_S,wrapT:GL_SAMPLER.TEXTURE_WRAP_T};var DEFAULT_SAMPLER=_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({},GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT);function getBytesFromComponentType(componentType){return BYTES[componentType];}function getSizeFromAccessorType(type){return COMPONENTS[type];}var GLTFPostProcessor=/*#__PURE__*/function(){function GLTFPostProcessor(){_classCallCheck(this,GLTFPostProcessor);_defineProperty(this,"baseUri",'');_defineProperty(this,"json",{});_defineProperty(this,"buffers",[]);_defineProperty(this,"images",[]);}return _createClass(GLTFPostProcessor,[{key:"postProcess",value:function postProcess(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var json=gltf.json,_gltf$buffers=gltf.buffers,buffers=_gltf$buffers===void 0?[]:_gltf$buffers,_gltf$images=gltf.images,images=_gltf$images===void 0?[]:_gltf$images,_gltf$baseUri=gltf.baseUri,baseUri=_gltf$baseUri===void 0?'':_gltf$baseUri;assert$2(json);this.baseUri=baseUri;this.json=json;this.buffers=buffers;this.images=images;this._resolveTree(this.json,options);return this.json;}},{key:"_resolveTree",value:function _resolveTree(json){var _this127=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this127._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this127._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this127._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this127._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this127._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this127._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this127._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this127._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this127._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this127._resolveScene(scene,i);});}if(json.scene!==undefined){json.scene=json.scenes[this.json.scene];}}},{key:"getScene",value:function getScene(index){return this._get('scenes',index);}},{key:"getNode",value:function getNode(index){return this._get('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this._get('skins',index);}},{key:"getMesh",value:function getMesh(index){return this._get('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this._get('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this._get('accessors',index);}},{key:"getCamera",value:function getCamera(index){return null;}},{key:"getTexture",value:function getTexture(index){return this._get('textures',index);}},{key:"getSampler",value:function getSampler(index){return this._get('samplers',index);}},{key:"getImage",value:function getImage(index){return this._get('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this._get('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this._get('buffers',index);}},{key:"_get",value:function _get(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){console.warn("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"_resolveScene",value:function _resolveScene(scene,index){var _this128=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this128.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this129=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this129.getNode(child);});}if(node.mesh!==undefined){node.mesh=this.getMesh(node.mesh);}else if(node.meshes!==undefined&&node.meshes.length){node.mesh=node.meshes.reduce(function(accum,meshIndex){var mesh=_this129.getMesh(meshIndex);accum.id=mesh.id;accum.primitives=accum.primitives.concat(mesh.primitives);return accum;},{primitives:[]});}if(node.camera!==undefined){node.camera=this.getCamera(node.camera);}if(node.skin!==undefined){node.skin=this.getSkin(node.skin);}return node;}},{key:"_resolveSkin",value:function _resolveSkin(skin,index){skin.id=skin.id||"skin-".concat(index);skin.inverseBindMatrices=this.getAccessor(skin.inverseBindMatrices);return skin;}},{key:"_resolveMesh",value:function _resolveMesh(mesh,index){var _this130=this;mesh.id=mesh.id||"mesh-".concat(index);if(mesh.primitives){mesh.primitives=mesh.primitives.map(function(primitive){primitive=_objectSpread({},primitive);var attributes=primitive.attributes;primitive.attributes={};for(var attribute in attributes){primitive.attributes[attribute]=_this130.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this130.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this130.getMaterial(primitive.material);}return primitive;});}return mesh;}},{key:"_resolveMaterial",value:function _resolveMaterial(material,index){material.id=material.id||"material-".concat(index);if(material.normalTexture){material.normalTexture=_objectSpread({},material.normalTexture);material.normalTexture.texture=this.getTexture(material.normalTexture.index);}if(material.occlusionTexture){material.occlustionTexture=_objectSpread({},material.occlustionTexture);material.occlusionTexture.texture=this.getTexture(material.occlusionTexture.index);}if(material.emissiveTexture){material.emmisiveTexture=_objectSpread({},material.emmisiveTexture);material.emissiveTexture.texture=this.getTexture(material.emissiveTexture.index);}if(!material.emissiveFactor){material.emissiveFactor=material.emmisiveTexture?[1,1,1]:[0,0,0];}if(material.pbrMetallicRoughness){material.pbrMetallicRoughness=_objectSpread({},material.pbrMetallicRoughness);var mr=material.pbrMetallicRoughness;if(mr.baseColorTexture){mr.baseColorTexture=_objectSpread({},mr.baseColorTexture);mr.baseColorTexture.texture=this.getTexture(mr.baseColorTexture.index);}if(mr.metallicRoughnessTexture){mr.metallicRoughnessTexture=_objectSpread({},mr.metallicRoughnessTexture);mr.metallicRoughnessTexture.texture=this.getTexture(mr.metallicRoughnessTexture.index);}}return material;}},{key:"_resolveAccessor",value:function _resolveAccessor(accessor,index){accessor.id=accessor.id||"accessor-".concat(index);if(accessor.bufferView!==undefined){accessor.bufferView=this.getBufferView(accessor.bufferView);}accessor.bytesPerComponent=getBytesFromComponentType(accessor.componentType);accessor.components=getSizeFromAccessorType(accessor.type);accessor.bytesPerElement=accessor.bytesPerComponent*accessor.components;if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorArrayType3=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType3.ArrayType,byteLength=_getAccessorArrayType3.byteLength;var byteOffset=(accessor.bufferView.byteOffset||0)+(accessor.byteOffset||0)+buffer.byteOffset;var cutBuffer=buffer.arrayBuffer.slice(byteOffset,byteOffset+byteLength);if(accessor.bufferView.byteStride){cutBuffer=this._getValueFromInterleavedBuffer(buffer,byteOffset,accessor.bufferView.byteStride,accessor.bytesPerElement,accessor.count);}accessor.value=new ArrayType(cutBuffer);}return accessor;}},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i505=0;_i505<count;_i505++){var elementOffset=byteOffset+_i505*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i505*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(texture,index){texture.id=texture.id||"texture-".concat(index);texture.sampler='sampler'in texture?this.getSampler(texture.sampler):DEFAULT_SAMPLER;texture.source=this.getImage(texture.source);return texture;}},{key:"_resolveSampler",value:function _resolveSampler(sampler,index){sampler.id=sampler.id||"sampler-".concat(index);sampler.parameters={};for(var key in sampler){var glEnum=this._enumSamplerParameter(key);if(glEnum!==undefined){sampler.parameters[glEnum]=sampler[key];}}return sampler;}},{key:"_enumSamplerParameter",value:function _enumSamplerParameter(key){return SAMPLER_PARAMETER_GLTF_TO_GL[key];}},{key:"_resolveImage",value:function _resolveImage(image,index){image.id=image.id||"image-".concat(index);if(image.bufferView!==undefined){image.bufferView=this.getBufferView(image.bufferView);}var preloadedImage=this.images[index];if(preloadedImage){image.image=preloadedImage;}return image;}},{key:"_resolveBufferView",value:function _resolveBufferView(bufferView,index){var bufferIndex=bufferView.buffer;var result=_objectSpread(_objectSpread({id:"bufferView-".concat(index)},bufferView),{},{buffer:this.buffers[bufferIndex]});var arrayBuffer=this.buffers[bufferIndex].arrayBuffer;var byteOffset=this.buffers[bufferIndex].byteOffset||0;if('byteOffset'in bufferView){byteOffset+=bufferView.byteOffset;}result.data=new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);return result;}},{key:"_resolveCamera",value:function _resolveCamera(camera,index){camera.id=camera.id||"camera-".concat(index);if(camera.perspective);if(camera.orthographic);return camera;}}]);}();function postProcessGLTF(gltf,options){return new GLTFPostProcessor().postProcess(gltf,options);}var MAGIC_glTF=0x676c5446;var GLB_FILE_HEADER_SIZE=12;var GLB_CHUNK_HEADER_SIZE=8;var GLB_CHUNK_TYPE_JSON=0x4e4f534a;var GLB_CHUNK_TYPE_BIN=0x004e4942;var GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED=0;var GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED=1;var GLB_V1_CONTENT_FORMAT_JSON=0x0;var LE=true;function getMagicString(dataView){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return"".concat(String.fromCharCode(dataView.getUint8(byteOffset+0))).concat(String.fromCharCode(dataView.getUint8(byteOffset+1))).concat(String.fromCharCode(dataView.getUint8(byteOffset+2))).concat(String.fromCharCode(dataView.getUint8(byteOffset+3)));}function isGLB(arrayBuffer){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var dataView=new DataView(arrayBuffer);var _options$magic=options.magic,magic=_options$magic===void 0?MAGIC_glTF:_options$magic;var magic1=dataView.getUint32(byteOffset,false);return magic1===magic||magic1===MAGIC_glTF;}function parseGLBSync(glb,arrayBuffer){var byteOffset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var dataView=new DataView(arrayBuffer);var type=getMagicString(dataView,byteOffset+0);var version=dataView.getUint32(byteOffset+4,LE);var byteLength=dataView.getUint32(byteOffset+8,LE);Object.assign(glb,{header:{byteOffset:byteOffset,byteLength:byteLength,hasBinChunk:false},type:type,version:version,json:{},binChunks:[]});byteOffset+=GLB_FILE_HEADER_SIZE;switch(glb.version){case 1:return parseGLBV1(glb,dataView,byteOffset);case 2:return parseGLBV2(glb,dataView,byteOffset,{});default:throw new Error("Invalid GLB version ".concat(glb.version,". Only supports v1 and v2."));}}function parseGLBV1(glb,dataView,byteOffset){assert$5(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);var contentLength=dataView.getUint32(byteOffset+0,LE);var contentFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;assert$5(contentFormat===GLB_V1_CONTENT_FORMAT_JSON);parseJSONChunk(glb,dataView,byteOffset,contentLength);byteOffset+=contentLength;byteOffset+=parseBINChunk(glb,dataView,byteOffset,glb.header.byteLength);return byteOffset;}function parseGLBV2(glb,dataView,byteOffset,options){assert$5(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);parseGLBChunksSync(glb,dataView,byteOffset,options);return byteOffset+glb.header.byteLength;}function parseGLBChunksSync(glb,dataView,byteOffset,options){while(byteOffset+8<=glb.header.byteLength){var chunkLength=dataView.getUint32(byteOffset+0,LE);var chunkFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;switch(chunkFormat){case GLB_CHUNK_TYPE_JSON:parseJSONChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_BIN:parseBINChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:if(!options.strict){parseJSONChunk(glb,dataView,byteOffset,chunkLength);}break;case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:if(!options.strict){parseBINChunk(glb,dataView,byteOffset,chunkLength);}break;}byteOffset+=padToNBytes(chunkLength,4);}return byteOffset;}function parseJSONChunk(glb,dataView,byteOffset,chunkLength){var jsonChunk=new Uint8Array(dataView.buffer,byteOffset,chunkLength);var textDecoder=new TextDecoder('utf8');var jsonText=textDecoder.decode(jsonChunk);glb.json=JSON.parse(jsonText);return padToNBytes(chunkLength,4);}function parseBINChunk(glb,dataView,byteOffset,chunkLength){glb.header.hasBinChunk=true;glb.binChunks.push({byteOffset:byteOffset,byteLength:chunkLength,arrayBuffer:dataView.buffer});return padToNBytes(chunkLength,4);}function parseGLTF$1(_x86,_x87){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args46=arguments;return _regenerator().w(function(_context53){while(1)switch(_context53.n){case 0:byteOffset=_args46.length>2&&_args46[2]!==undefined?_args46[2]:0;options=_args46.length>3?_args46[3]:undefined;context=_args46.length>4?_args46[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.normalize});preprocessExtensions(gltf,options,context);promises=[];if(!(options!==null&&options!==void 0&&(_options$gltf2=options.gltf)!==null&&_options$gltf2!==void 0&&_options$gltf2.loadBuffers&&gltf.json.buffers)){_context53.n=1;break;}_context53.n=1;return loadBuffers(gltf,options,context);case 1:if(options!==null&&options!==void 0&&(_options$gltf3=options.gltf)!==null&&_options$gltf3!==void 0&&_options$gltf3.loadImages){_promise=loadImages(gltf,options,context);promises.push(_promise);}promise=decodeExtensions(gltf,options,context);promises.push(promise);_context53.n=2;return Promise.all(promises);case 2:return _context53.a(2,options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);}},_callee50);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){if(options.uri){gltf.baseUri=options.uri;}if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){var glb={};byteOffset=parseGLBSync(glb,data,byteOffset,options.glb);assert$2(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$2(false,'GLTF: must be ArrayBuffer or string');}var buffers=gltf.json.buffers||[];gltf.buffers=new Array(buffers.length).fill(null);if(gltf._glb&&gltf._glb.header.hasBinChunk){var binChunks=gltf._glb.binChunks;gltf.buffers[0]={arrayBuffer:binChunks[0].arrayBuffer,byteOffset:binChunks[0].byteOffset,byteLength:binChunks[0].byteLength};}var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}function loadBuffers(_x88,_x89,_x90){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(gltf,options,context){var buffers,_i586,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regenerator().w(function(_context54){while(1)switch(_context54.n){case 0:buffers=gltf.json.buffers||[];_i586=0;case 1:if(!(_i586<buffers.length)){_context54.n=6;break;}buffer=buffers[_i586];if(!buffer.uri){_context54.n=4;break;}_fetch=context.fetch;assert$2(_fetch);uri=resolveUrl(buffer.uri,options);_context54.n=2;return context===null||context===void 0?void 0:(_context$fetch=context.fetch)===null||_context$fetch===void 0?void 0:_context$fetch.call(context,uri);case 2:response=_context54.v;_context54.n=3;return response===null||response===void 0?void 0:(_response$arrayBuffer=response.arrayBuffer)===null||_response$arrayBuffer===void 0?void 0:_response$arrayBuffer.call(response);case 3:arrayBuffer=_context54.v;gltf.buffers[_i586]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context54.n=5;break;case 4:if(gltf.buffers[_i586]===null){gltf.buffers[_i586]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 5:++_i586;_context54.n=1;break;case 6:return _context54.a(2);}},_callee51);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x91,_x92,_x93){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52(gltf,options,context){var imageIndices,images,promises,_iterator55,_step55,imageIndex;return _regenerator().w(function(_context55){while(1)switch(_context55.n){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator55=_createForOfIteratorHelper(imageIndices);try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){imageIndex=_step55.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}_context55.n=1;return Promise.all(promises);case 1:return _context55.a(2,_context55.v);}},_callee52);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator42=_createForOfIteratorHelper(textures),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var texture=_step42.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return Array.from(imageIndices).sort();}function loadImage(_x94,_x95,_x96,_x97,_x98){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regenerator().w(function(_context56){while(1)switch(_context56.n){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context56.n=3;break;}uri=resolveUrl(image.uri,options);_context56.n=1;return fetch(uri);case 1:response=_context56.v;_context56.n=2;return response.arrayBuffer();case 2:arrayBuffer=_context56.v;image.bufferView={data:arrayBuffer};case 3:if(Number.isFinite(image.bufferView)){array=getTypedArrayForBufferView(gltf.json,gltf.buffers,image.bufferView);arrayBuffer=sliceArrayBuffer(array.buffer,array.byteOffset,array.byteLength);}assert$2(arrayBuffer,'glTF image has no data');_context56.n=4;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 4:parsedImage=_context56.v;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}gltf.images=gltf.images||[];gltf.images[index]=parsedImage;case 5:return _context56.a(2);}},_callee53);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$5,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse,options:{gltf:{normalize:true,loadBuffers:true,loadImages:true,decompressMeshes:true,postProcess:true},log:console},deprecatedOptions:{fetchImages:'gltf.loadImages',createImages:'gltf.loadImages',decompress:'gltf.decompressMeshes',postProcess:'gltf.postProcess',gltf:{decompress:'gltf.decompressMeshes'}}};function parse(_x99){return _parse.apply(this,arguments);}/**
|
|
25185
25246
|
* @private
|
|
25186
25247
|
*/function _parse(){_parse=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee54(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args50=arguments;return _regenerator().w(function(_context57){while(1)switch(_context57.n){case 0:options=_args50.length>1&&_args50[1]!==undefined?_args50[1]:{};context=_args50.length>2?_args50[2]:undefined;options=_objectSpread(_objectSpread({},GLTFLoader.options),options);options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};_context57.n=1;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 1:return _context57.a(2,_context57.v);}},_callee54);}));return _parse.apply(this,arguments);}var GLTFSceneModelLoader=/*#__PURE__*/function(){function GLTFSceneModelLoader(cfg){_classCallCheck(this,GLTFSceneModelLoader);}return _createClass(GLTFSceneModelLoader,[{key:"load",value:function load(plugin,src,metaModelJSON,options,sceneModel,ok,error){options=options||{};loadGLTF(plugin,src,metaModelJSON,options,sceneModel,function(){core.scheduleTask(function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
25187
25248
|
sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.error(msg);if(error){error(msg);}sceneModel.fire("error",msg);});}},{key:"parse",value:function parse(plugin,gltf,metaModelJSON,options,sceneModel,ok,error){options=options||{};parseGLTF(plugin,"",gltf,metaModelJSON,options,sceneModel,function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
25188
25249
|
sceneModel.fire("loaded",true,false);if(ok){ok();}});}}]);}();function loadGLTF(plugin,src,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;var isGLB=src.split(".").pop()==="glb";if(isGLB){plugin.dataSource.getGLB(src,function(arrayBuffer){// OK
|
|
25189
25250
|
options.basePath=getBasePath(src);parseGLTF(plugin,src,arrayBuffer,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}else{plugin.dataSource.getGLTF(src,function(gltf){// OK
|
|
25190
25251
|
options.basePath=getBasePath(src);parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}}function getBasePath(src){var i=src.lastIndexOf("/");return i!==0?src.substring(0,i+1):"";}function parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;parse$2(gltf,GLTFLoader,{baseUri:options.basePath}).then(function(gltfData){var ctx={src:src,entityId:options.entityId,metaModelJSON:metaModelJSON,autoMetaModel:options.autoMetaModel,globalizeObjectIds:options.globalizeObjectIds,metaObjects:[],loadBuffer:options.loadBuffer,basePath:options.basePath,handlenode:options.handlenode,backfaces:!!options.backfaces,gltfData:gltfData,scene:sceneModel.scene,plugin:plugin,sceneModel:sceneModel,//geometryCreated: {},
|
|
25191
|
-
numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);if(options.autoMetaModel){ctx.metaObjects.push({id:sceneModel.id,type:"Default",name:sceneModel.id});}loadDefaultScene(ctx);sceneModel.finalize();if(options.autoMetaModel){plugin.viewer.metaScene.createMetaModel(sceneModel.id,{metaObjects:ctx.metaObjects});}spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var
|
|
25252
|
+
numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);if(options.autoMetaModel){ctx.metaObjects.push({id:sceneModel.id,type:"Default",name:sceneModel.id});}loadDefaultScene(ctx);sceneModel.finalize();if(options.autoMetaModel){plugin.viewer.metaScene.createMetaModel(sceneModel.id,{metaObjects:ctx.metaObjects});}spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i506=0,len=textures.length;_i506<len;_i506++){loadTexture(ctx,textures[_i506]);}}else{console.log("no texture");}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i507=0,len=materials.length;_i507<len;_i507++){var material=materials[_i507];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}switch(material.alphaMode){case"OPAQUE":break;case"MASK":var alphaCutoff=material.alphaCutoff;// Default from the spec https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material
|
|
25192
25253
|
textureSetCfg.alphaCutoff=alphaCutoff!==undefined?alphaCutoff:0.5;break;}var metallicPBR=material.pbrMetallicRoughness;if(material.pbrMetallicRoughness){var pbrMetallicRoughness=material.pbrMetallicRoughness;var baseColorTexture=pbrMetallicRoughness.baseColorTexture||pbrMetallicRoughness.colorTexture;if(baseColorTexture){if(baseColorTexture.texture){textureSetCfg.colorTextureId=baseColorTexture.texture._textureId;}else{textureSetCfg.colorTextureId=ctx.gltfData.textures[baseColorTexture.index]._textureId;}}if(metallicPBR.metallicRoughnessTexture){textureSetCfg.metallicRoughnessTextureId=metallicPBR.metallicRoughnessTexture.texture._textureId;}}var extensions=material.extensions;if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){specularPBR.specularTexture;var specularColorTexture=specularPBR.specularColorTexture;if(specularColorTexture!==null&&specularColorTexture!==undefined){textureSetCfg.colorTextureId=ctx.gltfData.textures[specularColorTexture.index]._textureId;}}}if(textureSetCfg.normalTextureId!==undefined||textureSetCfg.occlusionTextureId!==undefined||textureSetCfg.emissiveTextureId!==undefined||textureSetCfg.colorTextureId!==undefined||textureSetCfg.metallicRoughnessTextureId!==undefined){textureSetCfg.id="textureSet-".concat(ctx.nextId++,";");ctx.sceneModel.createTextureSet(textureSetCfg);return textureSetCfg.id;}return null;}function loadMaterialAttributes(ctx,material){// Substitute RGBA for material, to use fast flat shading instead
|
|
25193
25254
|
var extensions=material.extensions;var materialAttributes={color:new Float32Array([1,1,1,1]),opacity:1,metallic:0,roughness:1,doubleSided:true};if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){var diffuseFactor=specularPBR.diffuseFactor;if(diffuseFactor!==null&&diffuseFactor!==undefined){materialAttributes.color.set(diffuseFactor);}}var common=extensions["KHR_materials_common"];if(common){var technique=common.technique;var values=common.values||{};var blinn=technique==="BLINN";var phong=technique==="PHONG";var lambert=technique==="LAMBERT";var diffuse=values.diffuse;if(diffuse&&(blinn||phong||lambert)){if(!utils.isString(diffuse)){materialAttributes.color.set(diffuse);}}var transparency=values.transparency;if(transparency!==null&&transparency!==undefined){materialAttributes.opacity=transparency;}var transparent=values.transparent;if(transparent!==null&&transparent!==undefined){materialAttributes.opacity=transparent;}}}var metallicPBR=material.pbrMetallicRoughness;if(metallicPBR){var baseColorFactor=metallicPBR.baseColorFactor;if(baseColorFactor){materialAttributes.color[0]=baseColorFactor[0];materialAttributes.color[1]=baseColorFactor[1];materialAttributes.color[2]=baseColorFactor[2];materialAttributes.opacity=baseColorFactor[3];}var metallicFactor=metallicPBR.metallicFactor;if(metallicFactor!==null&&metallicFactor!==undefined){materialAttributes.metallic=metallicFactor;}var roughnessFactor=metallicPBR.roughnessFactor;if(roughnessFactor!==null&&roughnessFactor!==undefined){materialAttributes.roughness=roughnessFactor;}}materialAttributes.doubleSided=material.doubleSided!==false;return materialAttributes;}function loadDefaultScene(ctx){var gltfData=ctx.gltfData;var scene=gltfData.scene||gltfData.scenes[0];if(!scene){error(ctx,"glTF has no default scene");return;}var nodes=scene.nodes;if(!nodes){return;}(function accumulateMeshInstantes(nodes){nodes.forEach(function(node){var mesh=node.mesh;if(mesh){mesh.instances||(mesh.instances=0);mesh.instances+=1;}if(node.children){accumulateMeshInstantes(node.children);}});})(nodes);// Create a SceneMesh for each mesh primitive, and a SceneModelEntity for the root node and each named node.
|
|
25194
25255
|
var meshIdsStack=[];var meshIds=null;(function createSceneMeshesAndEntities(nodes,depth,parentMatrix){nodes.forEach(function(node){var nodeName=node.name;var entityId=nodeName!==undefined&&nodeName!==null&&nodeName||depth===0&&"entity-"+ctx.nextId++;if(entityId){while(ctx.sceneModel.objects[entityId]){entityId="entity-"+ctx.nextId++;}meshIdsStack.push(meshIds);meshIds=[];}var matrix=parseNodeMatrix(node,parentMatrix);if(node.mesh){parseNodeMesh(node,ctx,matrix,meshIds);}if(node.children){createSceneMeshesAndEntities(node.children,depth+1,matrix);}if(entityId){if(meshIds.length>0){var globalId=ctx.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,entityId):entityId;ctx.sceneModel.createEntity({id:globalId,meshIds:meshIds,isObject:true});if(ctx.autoMetaModel){ctx.metaObjects.push({id:globalId,type:"Default",name:globalId,parent:ctx.sceneModel.id});}}meshIds=meshIdsStack.pop();}});})(nodes,0,null);}/**
|
|
@@ -25204,7 +25265,7 @@ var meshIdsStack=[];var meshIds=null;(function createSceneMeshesAndEntities(node
|
|
|
25204
25265
|
* @param ctx Parsing context
|
|
25205
25266
|
* @param matrix Matrix for the XKTMeshes
|
|
25206
25267
|
* @param meshIds returns IDs of the new XKTMeshes
|
|
25207
|
-
*/function parseNodeMesh(node,ctx,matrix,meshIds){var mesh=node.mesh;if(!mesh){return;}var numPrimitives=mesh.primitives.length;if(numPrimitives>0){for(var
|
|
25268
|
+
*/function parseNodeMesh(node,ctx,matrix,meshIds){var mesh=node.mesh;if(!mesh){return;}var numPrimitives=mesh.primitives.length;if(numPrimitives>0){for(var _i508=0;_i508<numPrimitives;_i508++){var _primitive5=mesh.primitives[_i508];if(_primitive5.mode<4){continue;}var meshCfg={id:ctx.sceneModel.id+"."+ctx.numObjects++};var material=_primitive5.material;if(material){meshCfg.textureSetId=material._textureSetId;meshCfg.color=material._attributes.color;meshCfg.opacity=material._attributes.opacity;meshCfg.metallic=material._attributes.metallic;meshCfg.roughness=material._attributes.roughness;}else{meshCfg.color=new Float32Array([1.0,1.0,1.0]);meshCfg.opacity=1.0;}var backfaces=ctx.backfaces!==false||material&&material.doubleSided!==false;switch(_primitive5.mode){case 0:// POINTS
|
|
25208
25269
|
meshCfg.primitive="points";break;case 1:// LINES
|
|
25209
25270
|
meshCfg.primitive="lines";break;case 2:// LINE_LOOP
|
|
25210
25271
|
meshCfg.primitive="lines";break;case 3:// LINE_STRIP
|
|
@@ -25482,7 +25543,9 @@ if(!params.src&&!params.gltf){this.error("load() param expected: src or gltf");r
|
|
|
25482
25543
|
{areaId:22,boundaries:[[17,6,2,1],[11,0,1,1]],dir:[0.5,0.7071,0.5],up:[-0.5,0.7071,-0.5]},// Front-right-bottom corner
|
|
25483
25544
|
{areaId:23,boundaries:[[11,11,2,2]],dir:[0.5,-0.7071,-0.5],up:[0.5,0.7071,-0.5]},// Back-left-top corner
|
|
25484
25545
|
{areaId:24,boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[-0.5,0.7071,0.5],up:[0.5,0.7071,-0.5]},// Front-right-top corner
|
|
25485
|
-
{areaId:25,boundaries:[[11,5,2,2]],dir:[0.5,0.7071,-0.5],up:[-0.5,0.7071,0.5]}];areasYUpAbNormal.forEach(function(face){if(face.areaId>5){face.up=[face.up[0]*-1,face.up[1]*-1,face.up[2]*-1];}});var areasYUpUse=viewerNormalUp?areasYUp:areasYUpAbNormal;for(var
|
|
25546
|
+
{areaId:25,boundaries:[[11,5,2,2]],dir:[0.5,0.7071,-0.5],up:[-0.5,0.7071,0.5]}];areasYUpAbNormal.forEach(function(face){if(face.areaId>5){face.up=[face.up[0]*-1,face.up[1]*-1,face.up[2]*-1];}});var areasYUpUse=viewerNormalUp?areasYUp:areasYUpAbNormal;for(var _i509=0,len=areasZUp.length;_i509<len;_i509++){math.normalizeVec3(areasZUp[_i509].dir,areasZUp[_i509].dir);math.normalizeVec3(areasZUp[_i509].up,areasZUp[_i509].up);}for(var _i510=0,_len73=areasYUpUse.length;_i510<_len73;_i510++){math.normalizeVec3(areasYUpUse[_i510].dir,areasYUpUse[_i510].dir);math.normalizeVec3(areasYUpUse[_i510].up,areasYUpUse[_i510].up);}var areas=areasYUpUse;this._textureCanvas=document.createElement("canvas");this._textureCanvas.width=width;this._textureCanvas.height=height;this._textureCanvas.style.width=width+"px";this._textureCanvas.style.height=height+"px";this._textureCanvas.style.padding="0";this._textureCanvas.style.margin="0";this._textureCanvas.style.top="0";this._textureCanvas.style.background=cubeColor;this._textureCanvas.style.position="absolute";this._textureCanvas.style.opacity="1.0";this._textureCanvas.style.display="none";this._textureCanvas.style["z-index"]=-100;this._textureCanvas.setAttribute("id","myNavCubeRenderImage");this.cubeParentDiv=document.createElement("div");this.cubeParentDiv.setAttribute("id","myNavCubeRenderImage_parent");// cfg.viewerElement 为纹理画布(display:none,仅作 NavCube 贴图绘制源)的宿主节点;
|
|
25547
|
+
// 未传入时回退到 Viewer 画布的父元素 / document.body,避免整个 NavCubePlugin 初始化失败
|
|
25548
|
+
this.cubeContainer=cfg.viewerElement||viewer.scene.canvas.canvas.parentElement||document.body;this.cubeParentDiv.appendChild(this._textureCanvas);this.cubeContainer.appendChild(this.cubeParentDiv);var context=this._textureCanvas.getContext("2d");var zUp=false;function paint(){for(var _i511=0,_len74=facesZUp.length;_i511<_len74;_i511++){var face=facesZUp[_i511];var boundary=face.boundary;var xmin=Math.round(boundary[0]*scale);var ymin=Math.round(boundary[1]*scale);var _width=Math.round(boundary[2]*scale);var _height=Math.round(boundary[3]*scale);context.fillStyle=face.color;context.fillRect(xmin,ymin,_width,_height);}for(var _i512=0,_len75=areas.length;_i512<_len75;_i512++){var _xmin=void 0;var _ymin=void 0;var _width2=void 0;var _height2=void 0;var area=areas[_i512];var boundaries=area.boundaries;for(var j=0,lenj=boundaries.length;j<lenj;j++){var _boundary=boundaries[j];_xmin=Math.round(_boundary[0]*scale);_ymin=Math.round(_boundary[1]*scale);_width2=Math.round(_boundary[2]*scale);_height2=Math.round(_boundary[3]*scale);if(area.highlighted){context.fillStyle=area.highlighted?cubeHighlightColor:area.color||cubeColor;context.fillRect(_xmin,_ymin,_width2,_height2);}}if(area.label){context.fillStyle=textColor;context.font="60px sans-serif";context.textAlign="center";var xcenter=_xmin+_width2*0.5;var ycenter=_ymin+_height2*0.7;context.fillText(translateLabel(area.label),xcenter,ycenter,80);}}navCubeScene.glRedraw();}var translateLabel=function(){var swizzleYUp={"NavCube.front":"NavCube.front","NavCube.back":"NavCube.back","NavCube.right":"NavCube.right","NavCube.left":"NavCube.left","NavCube.top":"NavCube.top","NavCube.bottom":"NavCube.bottom"};var swizzleZUp={"NavCube.front":"NavCube.front","NavCube.back":"NavCube.back","NavCube.right":"NavCube.right","NavCube.left":"NavCube.left","NavCube.top":"NavCube.top","NavCube.bottom":"NavCube.bottom"};var defaultLabels={"NavCube.front":"FRONT","NavCube.back":"BACK","NavCube.right":"RIGHT","NavCube.left":"LEFT","NavCube.top":"TOP","NavCube.bottom":"BOTTOM"};return function(key){var swizzle=zUp?swizzleZUp:swizzleYUp;var swizzledKey=swizzle?swizzle[key]:null;if(swizzledKey){return viewer.localeService.translate(swizzledKey)||defaultLabels[swizzledKey]||swizzledKey;}return key;};}();this.setZUp=function(){zUp=true;areas=areasZUp;this.clear();};this.setYUp=function(){viewerNormalUp=viewer.scene.camera.normalUp;zUp=false;areas=viewerNormalUp?areasYUp:areasYUpAbNormal;this.clear();};this.clear=function(){context.fillStyle=cubeColor;context.fillRect(0,0,width,height);for(var i=0,len=areas.length;i<len;i++){var area=areas[i];area.highlighted=false;}paint();};this.getArea=function(uv){var s=uv[0]*width;var t=height-uv[1]*height;// Correct for our texture Y-flipping
|
|
25486
25549
|
for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.boundaries;for(var j=0,lenj=boundaries.length;j<lenj;j++){var boundary=boundaries[j];if(s>=boundary[0]*scale&&s<=(boundary[0]+boundary[2])*scale&&t>=boundary[1]*scale&&t<=(boundary[1]+boundary[3])*scale){return i;}}}return-1;};this.setAreaHighlighted=function(areaId,highlighted){var area=areas[areaId];if(!area){throw"Area not found: "+areaId;}area.highlighted=!!highlighted;paint();};this.getAreaDir=function(areaId){var area=areas[areaId];if(!area){throw"Unknown area: "+areaId;}return area.dir;};this.getAreaUp=function(areaId){var area=areas[areaId];if(!area){throw"Unknown area: "+areaId;}return area.up;};this.getImage=function(){return this._textureCanvas;};this.destroy=function(){if(this._textureCanvas){this._textureCanvas.parentNode.removeChild(this._textureCanvas);this._textureCanvas=null;}if(this.cubeParentDiv){this.cubeParentDiv.parentNode.removeChild(this.cubeParentDiv);this.cubeParentDiv=null;}};}var tempVec3a$1=math.vec3();var tempVec3b=math.vec3();math.mat4();/**
|
|
25487
25550
|
* {@link Viewer} plugin that lets us look at the entire {@link Scene} from along a chosen axis or diagonal.
|
|
25488
25551
|
*
|
|
@@ -25549,7 +25612,7 @@ for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.bo
|
|
|
25549
25612
|
* @param {String} [cfg.id="NavCube"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
25550
25613
|
* @param {String} [cfg.canvasId] ID of an existing HTML canvas to display the NavCube - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.
|
|
25551
25614
|
* @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas to display the NavCube - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
|
|
25552
|
-
* @param {
|
|
25615
|
+
* @param {HTMLElement} [cfg.viewerElement] Optional element to host the plugin's internal (hidden) texture canvas. Defaults to the parent of the Viewer's canvas, falling back to document.body.
|
|
25553
25616
|
* @param {Boolean} [cfg.visible=true] Initial visibility.
|
|
25554
25617
|
* @param {Boolean} [cfg.shadowVisible=true] Whether the shadow of the cube is visible.
|
|
25555
25618
|
* @param {String} [cfg.cameraFly=true] Whether the {@link Camera} flies or jumps to each selected axis or diagonal.
|
|
@@ -26114,7 +26177,7 @@ this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSe
|
|
|
26114
26177
|
*/function unionBounds(aabbs){var bounds=[Infinity,Infinity,Infinity,-Infinity,-Infinity,-Infinity];var found=false;var _iterator43=_createForOfIteratorHelper(aabbs),_step43;try{var _loop5=function _loop5(){var aabb=_step43.value;if(!aabb||aabb.length<6||!Array.from(aabb).every(Number.isFinite))return 0;// continue
|
|
26115
26178
|
if([0,1,2].some(function(axis){return aabb[axis]>aabb[axis+3];}))return 0;// continue
|
|
26116
26179
|
if(Math.max(aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2])<=0)return 0;// continue
|
|
26117
|
-
found=true;for(var axis=0;axis<3;axis++){bounds[axis]=Math.min(bounds[axis],aabb[axis]);bounds[axis+3]=Math.max(bounds[axis+3],aabb[axis+3]);}},_ret;for(_iterator43.s();!(_step43=_iterator43.n()).done;){_ret=_loop5();if(_ret===0)continue;}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}return found?bounds:null;}function resolveMinSize(value,aabb){var extent=Math.max(aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2]);var fallback=Math.max(extent*0.01,Number.EPSILON*Math.max.apply(Math,[1].concat(_toConsumableArray(aabb.map(Math.abs))))*32);var size=value==null?[fallback,fallback,fallback]:typeof value==="number"?[value,value,value]:Array.from(value);if(size.length!==3||!size.every(function(n){return Number.isFinite(n)&&n>0;})){throw new Error("最小间距必须为正数或三个轴的正数数组");}return size;}function fitBox(aabb,mode,minSize){var result=[];var pad=Math.max(aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2])*0.01;for(var axis=0;axis<3;axis++){var _center2=aabb[axis]+(aabb[axis+3]-aabb[axis])/2;var extent=aabb[axis+3]-aabb[axis];var size=Math.max(minSize[axis],mode==="outside"?extent*0.3:extent+pad*2);result[axis]=_center2-size/2;result[axis+3]=_center2+size/2;}return result;}/** 面序为 +X、-X、+Y、-Y、+Z、-Z;法线遵循引擎朝向保留半空间的约定。 */function boxFaces(aabb){var center=[0,1,2].map(function(axis){return aabb[axis]+(aabb[axis+3]-aabb[axis])/2;});return Array.from({length:6},function(_,face){var axis=Math.floor(face/2);var sign=face%2===0?1:-1;var pos=center.slice();pos[axis]=aabb[axis+(sign>0?3:0)];var dir=[0,0,0];dir[axis]=-sign;var u=(axis+1)%3;var v=(axis+2)%3;var corners=[[0,0],[1,0],[1,1],[0,1]].map(function(_ref20){var _ref21=_slicedToArray(_ref20,2),a=_ref21[0],b=_ref21[1];var p=pos.slice();p[u]=aabb[u+a*3];p[v]=aabb[v+b*3];return p;});return{axis:axis,sign:sign,pos:pos,dir:dir,corners:corners};});}function moveBoxFace(aabb,face,delta,minSize,translate){var next=Array.from(aabb);var axis=Math.floor(face/2);if(!Number.isFinite(delta))return next;if(translate){next[axis]+=delta;next[axis+3]+=delta;}else if(face%2===0){next[axis+3]=Math.max(next[axis]+minSize[axis],next[axis+3]+delta);}else{next[axis]=Math.min(next[axis+3]-minSize[axis],next[axis]+delta);}return next;}function rayBoxFace(origin,dir,aabb){var near=-Infinity,far=Infinity,nearFace=-1,farFace=-1;for(var axis=0;axis<3;axis++){if(Math.abs(dir[axis])<1e-12){if(origin[axis]<aabb[axis]||origin[axis]>aabb[axis+3])return null;continue;}var lo=(aabb[axis]-origin[axis])/dir[axis];var hi=(aabb[axis+3]-origin[axis])/dir[axis];var entering=Math.min(lo,hi),exiting=Math.max(lo,hi);if(entering>near){near=entering;nearFace=axis*2+(dir[axis]>0?1:0);}if(exiting<far){far=exiting;farFace=axis*2+(dir[axis]>0?0:1);}if(near>far)return null;}if(far<0||!Number.isFinite(far))return null;var t=near>=0?near:far;return{face:near>=0?nearFace:farFace,point:origin.map(function(n,axis){return n+dir[axis]*t;})};}var COLORS=[[0.92,0.32,0.32],[1,0.58,0.25],[0.28,0.88,0.35],[0.18,0.65,0.25],[0.32,0.55,1],[0.15,0.36,0.9]];var dot=function dot(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];};var sub=function sub(a,b){return a.map(function(n,i){return n-b[i];});};var normalize=function normalize(v){var length=Math.hypot.apply(Math,_toConsumableArray(v));return length>1e-12?v.map(function(n){return n/length;}):null;};/** 两次适配使用的模型包围盒是否一致;容差按尺寸取相对值。 */var sameBounds=function sameBounds(a,b){if(!a||!b)return false;var tolerance=Math.max(1,Math.abs(a[3]-a[0]),Math.abs(a[4]-a[1]),Math.abs(a[5]-a[2]))*1e-9;for(var
|
|
26180
|
+
found=true;for(var axis=0;axis<3;axis++){bounds[axis]=Math.min(bounds[axis],aabb[axis]);bounds[axis+3]=Math.max(bounds[axis+3],aabb[axis+3]);}},_ret;for(_iterator43.s();!(_step43=_iterator43.n()).done;){_ret=_loop5();if(_ret===0)continue;}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}return found?bounds:null;}function resolveMinSize(value,aabb){var extent=Math.max(aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2]);var fallback=Math.max(extent*0.01,Number.EPSILON*Math.max.apply(Math,[1].concat(_toConsumableArray(aabb.map(Math.abs))))*32);var size=value==null?[fallback,fallback,fallback]:typeof value==="number"?[value,value,value]:Array.from(value);if(size.length!==3||!size.every(function(n){return Number.isFinite(n)&&n>0;})){throw new Error("最小间距必须为正数或三个轴的正数数组");}return size;}function fitBox(aabb,mode,minSize){var result=[];var pad=Math.max(aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2])*0.01;for(var axis=0;axis<3;axis++){var _center2=aabb[axis]+(aabb[axis+3]-aabb[axis])/2;var extent=aabb[axis+3]-aabb[axis];var size=Math.max(minSize[axis],mode==="outside"?extent*0.3:extent+pad*2);result[axis]=_center2-size/2;result[axis+3]=_center2+size/2;}return result;}/** 面序为 +X、-X、+Y、-Y、+Z、-Z;法线遵循引擎朝向保留半空间的约定。 */function boxFaces(aabb){var center=[0,1,2].map(function(axis){return aabb[axis]+(aabb[axis+3]-aabb[axis])/2;});return Array.from({length:6},function(_,face){var axis=Math.floor(face/2);var sign=face%2===0?1:-1;var pos=center.slice();pos[axis]=aabb[axis+(sign>0?3:0)];var dir=[0,0,0];dir[axis]=-sign;var u=(axis+1)%3;var v=(axis+2)%3;var corners=[[0,0],[1,0],[1,1],[0,1]].map(function(_ref20){var _ref21=_slicedToArray(_ref20,2),a=_ref21[0],b=_ref21[1];var p=pos.slice();p[u]=aabb[u+a*3];p[v]=aabb[v+b*3];return p;});return{axis:axis,sign:sign,pos:pos,dir:dir,corners:corners};});}function moveBoxFace(aabb,face,delta,minSize,translate){var next=Array.from(aabb);var axis=Math.floor(face/2);if(!Number.isFinite(delta))return next;if(translate){next[axis]+=delta;next[axis+3]+=delta;}else if(face%2===0){next[axis+3]=Math.max(next[axis]+minSize[axis],next[axis+3]+delta);}else{next[axis]=Math.min(next[axis+3]-minSize[axis],next[axis]+delta);}return next;}function rayBoxFace(origin,dir,aabb){var near=-Infinity,far=Infinity,nearFace=-1,farFace=-1;for(var axis=0;axis<3;axis++){if(Math.abs(dir[axis])<1e-12){if(origin[axis]<aabb[axis]||origin[axis]>aabb[axis+3])return null;continue;}var lo=(aabb[axis]-origin[axis])/dir[axis];var hi=(aabb[axis+3]-origin[axis])/dir[axis];var entering=Math.min(lo,hi),exiting=Math.max(lo,hi);if(entering>near){near=entering;nearFace=axis*2+(dir[axis]>0?1:0);}if(exiting<far){far=exiting;farFace=axis*2+(dir[axis]>0?0:1);}if(near>far)return null;}if(far<0||!Number.isFinite(far))return null;var t=near>=0?near:far;return{face:near>=0?nearFace:farFace,point:origin.map(function(n,axis){return n+dir[axis]*t;})};}var COLORS=[[0.92,0.32,0.32],[1,0.58,0.25],[0.28,0.88,0.35],[0.18,0.65,0.25],[0.32,0.55,1],[0.15,0.36,0.9]];var dot=function dot(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];};var sub=function sub(a,b){return a.map(function(n,i){return n-b[i];});};var normalize=function normalize(v){var length=Math.hypot.apply(Math,_toConsumableArray(v));return length>1e-12?v.map(function(n){return n/length;}):null;};/** 两次适配使用的模型包围盒是否一致;容差按尺寸取相对值。 */var sameBounds=function sameBounds(a,b){if(!a||!b)return false;var tolerance=Math.max(1,Math.abs(a[3]-a[0]),Math.abs(a[4]-a[1]),Math.abs(a[5]-a[2]))*1e-9;for(var _i513=0;_i513<6;_i513++){if(Math.abs(a[_i513]-b[_i513])>tolerance)return false;}return true;};/**
|
|
26118
26181
|
* SectionPlanesPlugin 创建的统一盒体控制器。
|
|
26119
26182
|
* inside 为六面伸缩、保留盒内;outside 为整体平移、保留盒外。
|
|
26120
26183
|
* 不依赖页面 ID、叠加 canvas 或全局事件总线。
|
|
@@ -26143,13 +26206,13 @@ _this140._setAutoFit(true);}_this140._bindInput();_this140._syncVisible();}catch
|
|
|
26143
26206
|
*
|
|
26144
26207
|
* 多个模型时取并集,避免默认盒体只包住其中一个模型。
|
|
26145
26208
|
*/},{key:"_sceneBound",value:function _sceneBound(){var models=Object.values(this.scene.models);var entities=models.length?models:Object.values(this.scene.objects);return unionBounds(entities.map(function(model){return model.aabb;}));}/** 按模型集合包围盒刷新盒体范围,并记为重置基准。 */},{key:"_fitTo",value:function _fitTo(bounds){var minSize=resolveMinSize(this._minSizeConfig,bounds);var next=fitBox(bounds,this.mode,minSize);this._minSize=minSize;this._fittedBounds=bounds;this._setAABB(next);this._initialAABB=next.slice();}/** 模型集合变化时自动重新适配;用户手动调整后不再执行。 */},{key:"_autoFitToScene",value:function _autoFitToScene(){if(this.destroyed||!this._autoFit)return;var bounds=this._sceneBound();if(!bounds||sameBounds(bounds,this._fittedBounds))return;this._fitTo(bounds);}/** 开关自动跟随模型集合。 */},{key:"_setAutoFit",value:function _setAutoFit(enabled){var _this141=this;if(!enabled){this._autoFit=false;this._stopTick();return;}this._autoFit=true;if(!this._tickSub)this._tickSub=this.scene.on("tick",function(){return _this141._autoFitToScene();});}},{key:"_createGeometry",value:function _createGeometry(){var _this142=this;var unitFaces=boxFaces([-0.5,-0.5,-0.5,0.5,0.5,0.5]);unitFaces.forEach(function(face,index){var material=new PhongMaterial(_this142,{diffuse:COLORS[index],emissive:COLORS[index].map(function(n){return n*0.2;}),alpha:0.01,alphaMode:"blend",backfaces:true});var mesh=new Mesh(_this142,{geometry:new ReadableGeometry(_this142,{primitive:"triangles",positions:face.corners.flat(),normals:Array.from({length:4},function(){return face.dir.map(function(n){return-n;});}).flat(),indices:[0,1,2,0,2,3]}),material:material,clippable:false,collidable:false,pickable:false,isObject:false,castsShadow:false,receivesShadow:false,visible:false});_this142._faces.push({mesh:mesh,material:material});});var positions=[-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5];this._edges=new Mesh(this,{geometry:new ReadableGeometry(this,{primitive:"lines",positions:positions,indices:[0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]}),material:new PhongMaterial(this,{diffuse:[0,0,0],emissive:[0.45,0.85,1],lineWidth:2}),clippable:false,collidable:false,pickable:false,isObject:false,castsShadow:false,receivesShadow:false,visible:false});var _iterator45=_createForOfIteratorHelper(boxFaces(this._aabb)),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var face=_step45.value;var plane=new SectionPlane(this,{pos:face.pos,dir:face.dir,active:this.active,clipGroup:this._group});this._planes.push(plane);// 外部清理了组中任一平面时,一并释放整个控制器,避免残缺盒体。
|
|
26146
|
-
plane.once("destroyed",function(){if(!_this142._destroying)_this142.destroy();});}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}this._syncVisible();}},{key:"_syncBox",value:function _syncBox(){var _this143=this;var size=[0,1,2].map(function(i){return _this143._aabb[i+3]-_this143._aabb[i];});var center=[0,1,2].map(function(i){return _this143._aabb[i]+size[i]/2;});for(var
|
|
26209
|
+
plane.once("destroyed",function(){if(!_this142._destroying)_this142.destroy();});}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}this._syncVisible();}},{key:"_syncBox",value:function _syncBox(){var _this143=this;var size=[0,1,2].map(function(i){return _this143._aabb[i+3]-_this143._aabb[i];});var center=[0,1,2].map(function(i){return _this143._aabb[i]+size[i]/2;});for(var _i514=0,_arr=[].concat(_toConsumableArray(this._faces.map(function(f){return f.mesh;})),[this._edges]);_i514<_arr.length;_i514++){var _mesh9=_arr[_i514];// 局部单位盒始终共享中心及缩放;RTC 原点保留大坐标精度。
|
|
26147
26210
|
_mesh9.origin=center;_mesh9.scale=size;}boxFaces(this._aabb).forEach(function(face,index){_this143._planes[index].pos=face.pos;});this.glRedraw();this.fire("aabb",this.aabb);}},{key:"setCulled",value:function setCulled(value){this._culled=!!value;if(value)this._finishDrag();this._syncVisible();}},{key:"_syncVisible",value:function _syncVisible(){var visible=this.active&&this.visible&&!this._culled;var _iterator46=_createForOfIteratorHelper(this._faces),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var face=_step46.value;face.mesh.visible=visible;}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}if(this._edges)this._edges.visible=visible;this._canvas.style.touchAction=visible?"none":this._savedTouchAction;if(!visible)this._highlight(-1);}},{key:"_highlight",value:function _highlight(index){if(this._hover===index)return;this._hover=index;this._faces.forEach(function(face,i){face.material.alpha=i===index?0.04:0.01;face.material.emissive=i===index?[0.55,0.4,0.05]:COLORS[i].map(function(n){return n*0.2;});});this._canvas.style.cursor=index<0?this._savedCursor:this._drag?"grabbing":"grab";this.glRedraw();}/** 取消自动适配的 tick 订阅。 */},{key:"_stopTick",value:function _stopTick(){if(this._tickSub){this.scene.off(this._tickSub);this._tickSub=null;}}},{key:"_ray",value:function _ray(event){var rect=this._canvas.getBoundingClientRect();if(!rect.width||!rect.height)return null;var x=(event.clientX-rect.left)/rect.width*2-1;var y=1-(event.clientY-rect.top)/rect.height*2;var camera=this._viewer.camera;var inverse=math.inverseMat4(math.mulMat4(camera.projMatrix,camera.viewMatrix,math.mat4()),math.mat4());var unproject=function unproject(z){var p=math.transformVec4(inverse,[x,y,z,1],math.vec4());return[p[0]/p[3],p[1]/p[3],p[2]/p[3]];};var origin=unproject(-1),far=unproject(0.5);var dir=normalize(sub(far,origin));return dir&&origin.every(Number.isFinite)?{origin:origin,dir:dir}:null;}},{key:"_planeHit",value:function _planeHit(ray,point,normal){if(!ray)return null;var denominator=dot(normal,ray.dir);if(Math.abs(denominator)<1e-8)return null;var t=dot(normal,sub(point,ray.origin))/denominator;return t>=0&&Number.isFinite(t)?ray.origin.map(function(n,i){return n+ray.dir[i]*t;}):null;}},{key:"_bindInput",value:function _bindInput(){var _this144=this;var listen=function listen(target,type,fn){target.addEventListener(type,fn,{capture:true,passive:false});_this144._listeners.push(function(){return target.removeEventListener(type,fn,true);});};var stop=function stop(event){event.preventDefault();event.stopImmediatePropagation();};listen(this._canvas,"pointerdown",function(event){if(_this144._drag){stop(event);return;}if(!_this144.active||!_this144.visible||_this144._culled||!_this144._aabb||!event.isPrimary)return;_this144._suppressUntil=0;var ray=_this144._ray(event);var hit=ray&&rayBoxFace(ray.origin,ray.dir,_this144._aabb);// 非主键手势(中键平移、右键等)不接管,交给相机控制。
|
|
26148
26211
|
if(event.button!==0)return;var rect=_this144._canvas.getBoundingClientRect();var modelHit=!hit&&_this144.scene.pick({canvasPos:[event.clientX-rect.left,event.clientY-rect.top]});if(!hit&&!modelHit)return;stop(event);var camera=_this144._viewer.camera;var cameraControl=_this144._viewer.cameraControl;var eye=Array.from(camera.eye);var forward=normalize(Array.from(camera.look,function(n,i){return n-eye[i];}))||[0,0,-1];var face=hit?hit.face:-1;var axis=face>=0?Math.floor(face/2):0;var planeNormal=forward.slice();planeNormal[axis]=0;var normal=normalize(planeNormal);var point=hit?hit.point:Array.from(camera.look);var reference=normal&&_this144._planeHit(ray,point,normal);var depth=Math.max(Math.abs(dot(sub(point,eye),forward)),camera.perspective.near);var worldPerPixel=camera.projection==="ortho"?camera.ortho.scale/rect.height:2*depth*Math.tan(camera.perspective.fov*Math.PI/360)/rect.height;_this144._drag={pointerId:event.pointerId,face:face,axis:axis,point:point,normal:normal,reference:reference&&Math.abs(forward[axis])<0.98?reference:null,lastY:event.clientY,worldPerPixel:worldPerPixel,fallbackSign:forward[axis]>0?1:-1,pointerEnabled:cameraControl.pointerEnabled,touch:event.pointerType==="touch"};cameraControl.pointerEnabled=false;try{_this144._canvas.setPointerCapture(event.pointerId);}catch(error){// 指针已被释放或元素已脱离文档时忽略,拖动仍在 document 监听中继续。
|
|
26149
26212
|
}_this144._highlight(face);_this144._canvas.style.cursor=face>=0?"grabbing":_this144._savedCursor;if(face>=0){// 与旧控制器保持一致,外部据此在拖动期间锁住页面滚动。
|
|
26150
26213
|
_this144._plugin.fire("clickPlaneStart");if(_this144._drag.touch)_this144._plugin.fire("touchPlaneStart");}_this144.fire("dragStart",{face:face},true);});listen(document,"pointermove",function(event){var drag=_this144._drag;if(drag){if(drag.pointerId!==event.pointerId)return;stop(event);if(drag.face<0)return;var delta;if(drag.reference){var point=_this144._planeHit(_this144._ray(event),drag.point,drag.normal);if(!point)return;delta=point[drag.axis]-drag.reference[drag.axis];drag.reference=point;}else{delta=(drag.lastY-event.clientY)*drag.worldPerPixel*drag.fallbackSign;}drag.lastY=event.clientY;// 用户开始手动调整后,盒体不再随模型集合变化自动重新适配。
|
|
26151
26214
|
_this144._setAutoFit(false);// 每次消费鼠标增量,达到最小值后反向拖动不会出现空行程。
|
|
26152
|
-
_this144._aabb=moveBoxFace(_this144._aabb,drag.face,delta,_this144._minSize,_this144.mode==="outside");_this144._syncBox();}else if(event.target===_this144._canvas&&_this144.active&&_this144.visible&&!_this144._culled&&_this144._aabb){var ray=_this144._ray(event);var hit=ray&&rayBoxFace(ray.origin,ray.dir,_this144._aabb);_this144._highlight(hit?hit.face:-1);}});var finish=function finish(event){if(!_this144._drag||event.pointerId!==_this144._drag.pointerId)return;stop(event);_this144._finishDrag();};listen(document,"pointerup",finish);listen(document,"pointercancel",finish);listen(this._canvas,"lostpointercapture",finish);listen(this._canvas,"pointerleave",function(){if(!_this144._drag)_this144._highlight(-1);});listen(window,"blur",function(){return _this144._finishDrag();});for(var
|
|
26215
|
+
_this144._aabb=moveBoxFace(_this144._aabb,drag.face,delta,_this144._minSize,_this144.mode==="outside");_this144._syncBox();}else if(event.target===_this144._canvas&&_this144.active&&_this144.visible&&!_this144._culled&&_this144._aabb){var ray=_this144._ray(event);var hit=ray&&rayBoxFace(ray.origin,ray.dir,_this144._aabb);_this144._highlight(hit?hit.face:-1);}});var finish=function finish(event){if(!_this144._drag||event.pointerId!==_this144._drag.pointerId)return;stop(event);_this144._finishDrag();};listen(document,"pointerup",finish);listen(document,"pointercancel",finish);listen(this._canvas,"lostpointercapture",finish);listen(this._canvas,"pointerleave",function(){if(!_this144._drag)_this144._highlight(-1);});listen(window,"blur",function(){return _this144._finishDrag();});for(var _i515=0,_arr2=["mousedown","mousemove","mouseup","click","dblclick","touchstart","touchmove","touchend","touchcancel","contextmenu","wheel"];_i515<_arr2.length;_i515++){var type=_arr2[_i515];listen(document,type,function(event){if(_this144._drag||event.target===_this144._canvas&&performance.now()<_this144._suppressUntil)stop(event);});}}},{key:"_finishDrag",value:function _finishDrag(){var drag=this._drag;if(!drag)return;this._drag=null;this._suppressUntil=performance.now()+80;if(this._canvas.hasPointerCapture(drag.pointerId))this._canvas.releasePointerCapture(drag.pointerId);var cameraControl=this._viewer.cameraControl;if(cameraControl&&!cameraControl.destroyed)cameraControl.pointerEnabled=drag.pointerEnabled;this._highlight(-1);this._canvas.style.cursor=this._savedCursor;if(drag.face>=0){if(drag.touch)this._plugin.fire("touchPlaneEnd");this._plugin.fire("clickPlaneEnd");}this.fire("dragEnd",{face:drag.face},true);}},{key:"destroy",value:function destroy(){if(this.destroyed||this._destroying)return;this._destroying=true;this._finishDrag();var _iterator47=_createForOfIteratorHelper(this._listeners),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var remove=_step47.value;remove();}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}this._setAutoFit(false);this._canvas.style.touchAction=this._savedTouchAction;this._canvas.style.cursor=this._savedCursor;_superPropGet(SectionBoxControl,"destroy",this,3)([]);this._planes=[];this._faces=[];this._listeners=[];this.scene.fire("sectionPlaneUpdated",this,true);}}]);}(Component);var tempAABB=math.AABB3();var tempVec3=math.vec3();/**
|
|
26153
26216
|
* SectionPlanesPlugin is a {@link Viewer} plugin that manages {@link SectionPlane}s.
|
|
26154
26217
|
*
|
|
26155
26218
|
* [<img src="https://user-images.githubusercontent.com/83100/57724962-406e9a00-768c-11e9-9f1f-3d178a3ec11f.gif">](https://xeokit.github.io/xeokit-sdk/examples/#gizmos_SectionPlanesPlugin)
|
|
@@ -26667,7 +26730,7 @@ for(var _id5 in this._controls){if(this._controls.hasOwnProperty(_id5)){this._co
|
|
|
26667
26730
|
* These are created and destroyed automatically as models are loaded and destroyed.
|
|
26668
26731
|
*
|
|
26669
26732
|
* @type {{String: {String:Storey}}}
|
|
26670
|
-
*/_this148.modelStoreys={};_this148._fitStoreyMaps=!!cfg.fitStoreyMaps;_this148._onModelLoaded=_this148.viewer.scene.on("modelLoaded",function(modelId){_this148._registerModelStoreys(modelId);_this148.fire("storeys",_this148.storeys);});return _this148;}_inherits(StoreyViewsPlugin,_Plugin9);return _createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this149=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var
|
|
26733
|
+
*/_this148.modelStoreys={};_this148._fitStoreyMaps=!!cfg.fitStoreyMaps;_this148._onModelLoaded=_this148.viewer.scene.on("modelLoaded",function(modelId){_this148._registerModelStoreys(modelId);_this148.fire("storeys",_this148.storeys);});return _this148;}_inherits(StoreyViewsPlugin,_Plugin9);return _createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this149=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i516=0,len=storeyIds.length;_i516<len;_i516++){var storeyId=storeyIds[_i516];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this149._deregisterModelStoreys(modelId);_this149.fire("storeys",_this149.storeys);});this.storeys[storeyId]=storey;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];}}delete this.modelStoreys[modelId];}}/**
|
|
26671
26734
|
* When true, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different
|
|
26672
26735
|
* floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
|
|
26673
26736
|
* @returns {*|boolean}
|
|
@@ -26819,7 +26882,7 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
|
|
|
26819
26882
|
@returns {Skybox} The new skybox.
|
|
26820
26883
|
*/},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}if(!params.src&&!params.image){this.error("No legal skybox image or src: "+id);return this;}if(params.src){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}else if(params.image){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,image:params.image,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}}},{key:"setSkyBoxActiveById",value:function setSkyBoxActiveById(id,active){this.skyboxes[id].active=active;}/**
|
|
26821
26884
|
* 设置开启天空盒
|
|
26822
|
-
*/},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;for(var
|
|
26885
|
+
*/},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;for(var _i517=0;_i517<this.skyboxes.length;_i517++)this.skyboxes[_i517].active=active;}},{key:"getSkyBoxById",value:function getSkyBoxById(id){return this.skyboxes[id];}/**
|
|
26823
26886
|
Destroys a skybox.
|
|
26824
26887
|
@param id
|
|
26825
26888
|
*/},{key:"destroySkybox",value:function destroySkybox(id){var skybox=this.skyboxes[id];if(!skybox){this.error("Skybox not found: "+id);return;}skybox.destroy();}/**
|
|
@@ -27197,7 +27260,7 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
|
|
|
27197
27260
|
// );
|
|
27198
27261
|
// return;
|
|
27199
27262
|
// }
|
|
27200
|
-
for(var
|
|
27263
|
+
for(var _i518=0;;_i518++){if(!treeViews[_i518]){treeViews[_i518]=_this151;_this151._index=_i518;_this151._id="tree-".concat(_i518);break;}}// this._containerElement = containerElement;
|
|
27201
27264
|
_this151._metaModels={};_this151._autoAddModels=cfg.autoAddModels!==false;_this151._autoExpandDepth=cfg.autoExpandDepth||0;_this151._sortNodes=cfg.sortNodes!==false;_this151._viewer=viewer;_this151._rootElement=null;_this151._muteSceneEvents=false;_this151._muteTreeEvents=false;_this151._rootNodes=[];_this151._objectNodes={};// Object ID -> Node
|
|
27202
27265
|
_this151._nodeNodes={};// Node ID -> Node
|
|
27203
27266
|
_this151._rootNames={};// Node ID -> Root name
|
|
@@ -27222,7 +27285,7 @@ _this151._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
|
|
|
27222
27285
|
// this._checkboxChangeHandler = (event) => {
|
|
27223
27286
|
// this.checkboxChangeHandler(event)
|
|
27224
27287
|
// };
|
|
27225
|
-
_this151._hierarchy=cfg.hierarchy||"containment";_this151._autoExpandDepth=cfg.autoExpandDepth||0;if(_this151._autoAddModels){var modelIds=Object.keys(_this151.viewer.metaScene.metaModels);for(var
|
|
27288
|
+
_this151._hierarchy=cfg.hierarchy||"containment";_this151._autoExpandDepth=cfg.autoExpandDepth||0;if(_this151._autoAddModels){var modelIds=Object.keys(_this151.viewer.metaScene.metaModels);for(var _i519=0,len=modelIds.length;_i519<len;_i519++){var modelId=modelIds[_i519];var metaModel=_this151.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this151.addModel(modelId);}}_this151.viewer.scene.on("modelLoaded",function(modelId){if(_this151.viewer.metaScene.metaModels[modelId]){_this151.addModel(modelId);}});}return _this151;}//展开点击事件
|
|
27226
27289
|
_inherits(TreeViewPlugin,_Plugin1);return _createClass(TreeViewPlugin,[{key:"switchExpandHandler",value:function switchExpandHandler(event){event.preventDefault();event.stopPropagation();event.target;// this._expandSwitchElement(switchElement);
|
|
27227
27290
|
this.fire("ExpandHandler",event);}//收起点击事件
|
|
27228
27291
|
},{key:"switchCollapseHandler",value:function switchCollapseHandler(event){event.preventDefault();event.stopPropagation();// const switchElement = event.target;
|
|
@@ -27287,12 +27350,12 @@ this.fire("nodeNodes_Created",this._nodeNodes);this.fire("rootNodes_Created",thi
|
|
|
27287
27350
|
// }
|
|
27288
27351
|
//创建storeys菜单的根节点
|
|
27289
27352
|
},{key:"_createStoreysNodes",value:function _createStoreysNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createStoreysNodes2(rootMetaObjects[id],null,null,null);}}//创建storeys菜单的各层级节点
|
|
27290
|
-
},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(buildingNode);this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model '"+this.metaModel.id+"' - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node6={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node6);this._objectNodes[_node6.objectId]=_node6;this._nodeNodes[_node6.nodeId]=_node6;}}}if(children){for(var
|
|
27353
|
+
},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(buildingNode);this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model '"+this.metaModel.id+"' - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node6={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node6);this._objectNodes[_node6.objectId]=_node6;this._nodeNodes[_node6.nodeId]=_node6;}}}if(children){for(var _i520=0,len=children.length;_i520<len;_i520++){var childMetaObject=children[_i520];this._createStoreysNodes2(childMetaObject,buildingNode,storeyNode,typeNodes);}}}//创建Classes菜单的根节点
|
|
27291
27354
|
},{key:"_createTypesNodes",value:function _createTypesNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createTypesNodes2(rootMetaObjects[id],null,null);}}//创建Classes菜单的根节点
|
|
27292
|
-
},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node7={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node7);this._objectNodes[_node7.objectId]=_node7;this._nodeNodes[_node7.nodeId]=_node7;}}}if(children){for(var
|
|
27355
|
+
},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node7={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node7);this._objectNodes[_node7.objectId]=_node7;this._nodeNodes[_node7.nodeId]=_node7;}}}if(children){for(var _i521=0,len=children.length;_i521<len;_i521++){var childMetaObject=children[_i521];this._createTypesNodes2(childMetaObject,rootNode,typeNodes);}}}//创建Object菜单的根节点
|
|
27293
27356
|
},{key:"_createContainmentNodes",value:function _createContainmentNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createContainmentNodes2(rootMetaObjects[id],null);}}//创建Object菜单的各层级节点
|
|
27294
|
-
},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var
|
|
27295
|
-
},{key:"_synchNodesToEntities",value:function _synchNodesToEntities(){var objectIds=Object.keys(this.viewer.metaScene.metaObjects);var metaObjects=this._viewer.metaScene.metaObjects;var objects=this._viewer.scene.objects;for(var
|
|
27357
|
+
},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var _i522=0,len=children.length;_i522<len;_i522++){var childMetaObject=children[_i522];this._createContainmentNodes2(childMetaObject,node);}}}//同步scene和metaScene中的内容
|
|
27358
|
+
},{key:"_synchNodesToEntities",value:function _synchNodesToEntities(){var objectIds=Object.keys(this.viewer.metaScene.metaObjects);var metaObjects=this._viewer.metaScene.metaObjects;var objects=this._viewer.scene.objects;for(var _i523=0,len=objectIds.length;_i523<len;_i523++){var objectId=objectIds[_i523];var metaObject=metaObjects[objectId];if(metaObject){var _node8=this._objectNodes[objectId];if(_node8){var entity=objects[objectId];if(entity){var visible=entity.visible;_node8.numEntities=1;_node8.xrayed=entity.xrayed;if(visible){_node8.numVisibleEntities=1;_node8.checked=true;}else{_node8.numVisibleEntities=0;_node8.checked=false;}var parent=_node8.parent;// Synch parents
|
|
27296
27359
|
while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;parent.checked=true;}parent=parent.parent;}}}}}}//判断是否合法
|
|
27297
27360
|
},{key:"_validate",value:function _validate(){this.errors=[];switch(this._hierarchy){case"storeys":this.valid=this._validateMetaModelForStoreysHierarchy();break;case"types":this.valid=this._rootNodes.length>0;break;case"containment":default:this.valid=this._rootNodes.length>0;break;}return this.valid;}},{key:"_validateMetaModelForStoreysHierarchy",value:function _validateMetaModelForStoreysHierarchy(){var level=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var ctx=arguments.length>1?arguments[1]:undefined;var buildingNode=arguments.length>2?arguments[2]:undefined;// ctx = ctx || {
|
|
27298
27361
|
// foundIFCBuildingStoreys: false
|
|
@@ -27421,8 +27484,8 @@ this._showListItemElementId=null;}/**
|
|
|
27421
27484
|
*
|
|
27422
27485
|
* @param {TreeViewNode} node Root of the subtree.
|
|
27423
27486
|
* @param {Function} callback Callback called at each {@link TreeViewNode}, with the TreeViewNode given as the argument.
|
|
27424
|
-
*/},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var
|
|
27425
|
-
},{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var
|
|
27487
|
+
*/},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i524=0,len=children.length;_i524<len;_i524++){this.withNodeTree(children[_i524],callback);}}//遍历树指定节点下的子节点
|
|
27488
|
+
},{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i525=0,len=children.length;_i525<len;_i525++){this._withNodeTree(children[_i525],callback);}}/**
|
|
27426
27489
|
* 获取指定id节点的children
|
|
27427
27490
|
* @param {*} nodeId
|
|
27428
27491
|
* @returns node Children[]
|
|
@@ -27435,8 +27498,8 @@ this._showListItemElementId=null;}/**
|
|
|
27435
27498
|
*/},{key:"destroy",value:function destroy(){// if (!this._containerElement) {
|
|
27436
27499
|
// return;
|
|
27437
27500
|
// }
|
|
27438
|
-
this._metaModels={};if(this._rootElement&&!this._destroyed){this._rootElement.parentNode.removeChild(this._rootElement);this._viewer.scene.off(this._onObjectVisibility);this._destroyed=true;}delete treeViews[this._index];_superPropGet(TreeViewPlugin,"destroy",this,3)([]);}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var
|
|
27439
|
-
children.sort(this._getSpatialSortFunc());}else{children.sort(this._alphaSortFunc);}for(var
|
|
27501
|
+
this._metaModels={};if(this._rootElement&&!this._destroyed){this._rootElement.parentNode.removeChild(this._rootElement);this._viewer.scene.off(this._onObjectVisibility);this._destroyed=true;}delete treeViews[this._index];_superPropGet(TreeViewPlugin,"destroy",this,3)([]);}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i526=0,len=children.length;_i526<len;_i526++){var childMetaObject=children[_i526];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i527=0,len=this._rootNodes.length;_i527<len;_i527++){var rootNode=this._rootNodes[_i527];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}if(this._hierarchy==="storeys"&&node.type==="IfcBuilding"){// Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
|
|
27502
|
+
children.sort(this._getSpatialSortFunc());}else{children.sort(this._alphaSortFunc);}for(var _i528=0,len=children.length;_i528<len;_i528++){var _node9=children[_i528];this._sortChildren(_node9);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){// Creates cached sort func with Viewer in scope
|
|
27440
27503
|
var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var metaScene=viewer.metaScene;return this._spatialSortFunc||(this._spatialSortFunc=function(node1,node2){if(!node1.aabb||!node2.aabb){// Sorting on lowest point of the AABB is likely more more robust when objects could overlap storeys
|
|
27441
27504
|
if(!node1.aabb){node1.aabb=scene.getAABB(metaScene.getObjectIDsInSubtree(node1.objectId));}if(!node2.aabb){node2.aabb=scene.getAABB(metaScene.getObjectIDsInSubtree(node2.objectId));}}var idx=0;if(camera.xUp){idx=0;}else if(camera.yUp){idx=1;}else{idx=2;}if(node1.aabb[idx]>node2.aabb[idx]){return-1;}if(node1.aabb[idx]<node2.aabb[idx]){return 1;}return 0;});}},{key:"_alphaSortFunc",value:function _alphaSortFunc(node1,node2){var title1=node1.title.toUpperCase();// FIXME: Should be case sensitive?
|
|
27442
27505
|
var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title2){return 1;}return 0;}// //将所有节点内容添加到html tree里面
|
|
@@ -27512,7 +27575,7 @@ this._objectsViewCulled=[];// A flag for each object to indicate its view-cull s
|
|
|
27512
27575
|
this._objectsDetailCulled=[];// A flag for each object to indicate its detail-cull status
|
|
27513
27576
|
this._objectsChanged=[];// A flag for each object, set whenever its cull status has changed since last _applyChanges()
|
|
27514
27577
|
this._objectsChangedList=[];// A list of objects whose cull status has changed, applied and cleared by _applyChanges()
|
|
27515
|
-
this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this153._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this153._dirty){_this153._build();}_this153._applyChanges();});}return _createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this154=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this154._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var
|
|
27578
|
+
this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this153._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this153._dirty){_this153._build();}_this153._applyChanges();});}return _createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this154=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this154._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i529=0;_i529<this._numObjects;_i529++){this._objects[_i529]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i530=0;_i530<this._lenObjectsChangedList;_i530++){var objectIdx=this._objectsChangedList[_i530];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
|
|
27516
27579
|
* Array of {@link Entity} instances that represent objects in the {@link Scene}.
|
|
27517
27580
|
*
|
|
27518
27581
|
* ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.
|
|
@@ -27580,15 +27643,15 @@ var kdTreeDimLength=new Float32Array(3);/**
|
|
|
27580
27643
|
* @param {String} [cfg.id="ViewCull"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
27581
27644
|
* @param {Number} [cfg.maxTreeDepth=8] Maximum depth of the kd-tree.
|
|
27582
27645
|
*/function ViewCullPlugin(viewer){var _this155;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ViewCullPlugin);_this155=_callSuper(this,ViewCullPlugin,["ViewCull",viewer]);_this155._objectCullStates=getObjectCullStates(viewer.scene);// Combines updates from multiple culling systems for its Scene's Entities
|
|
27583
|
-
_this155._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this155._modelInfos={};_this155._frustum=new Frustum$1();_this155._kdRoot=null;_this155._frustumDirty=false;_this155._kdTreeDirty=false;_this155._insideView=false;_this155.enabled=cfg.enabled;var camera=viewer.scene.camera;_this155._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this155._frustumDirty=true;});_this155._onProjMatrix=viewer.scene.camera.on("
|
|
27584
|
-
_inherits(ViewCullPlugin,_Plugin10);return _createClass(ViewCullPlugin,[{key:"isBoxInFrustum",value:function isBoxInFrustum(frustumPlanes,aabb){for(var
|
|
27585
|
-
},{key:"extractFrustumPlanes",value:function extractFrustumPlanes(projectionMatrix,viewMatrix){var combinedMatrix=math.identityMat4();math.mulMat4(projectionMatrix,viewMatrix,combinedMatrix);var planes=[];for(var
|
|
27646
|
+
_this155._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this155._modelInfos={};_this155._frustum=new Frustum$1();_this155._kdRoot=null;_this155._frustumDirty=false;_this155._kdTreeDirty=false;_this155._insideView=false;_this155.enabled=cfg.enabled;var camera=viewer.scene.camera;_this155._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this155._frustumDirty=true;});_this155._onProjMatrix=viewer.scene.camera.on("projMatrix",function(){_this155._frustumDirty=true;});_this155._onModelLoaded=viewer.scene.on("modelLoaded",function(modelId){var model=_this155.viewer.scene.models[modelId];if(model){_this155._addModel(model);}});_this155._onSceneTick=viewer.scene.on("tick",function(){if(_this155._enabled)_this155._doCull();_this155.insideView=_this155.isBoxInFrustum(_this155.extractFrustumPlanes(camera.projMatrix,camera.viewMatrix),viewer.scene.aabb);});return _this155;}//包围盒和视锥相交测试
|
|
27647
|
+
_inherits(ViewCullPlugin,_Plugin10);return _createClass(ViewCullPlugin,[{key:"isBoxInFrustum",value:function isBoxInFrustum(frustumPlanes,aabb){for(var _i531=0;_i531<6;_i531++){var plane=frustumPlanes[_i531];var _p4=[plane[0]>0?aabb[3]:aabb[0],plane[1]>0?aabb[4]:aabb[1],plane[2]>0?aabb[5]:aabb[2]];if(plane[0]*_p4[0]+plane[1]*_p4[1]+plane[2]*_p4[2]+plane[3]<0){return false;}}return true;}//视锥计算
|
|
27648
|
+
},{key:"extractFrustumPlanes",value:function extractFrustumPlanes(projectionMatrix,viewMatrix){var combinedMatrix=math.identityMat4();math.mulMat4(projectionMatrix,viewMatrix,combinedMatrix);var planes=[];for(var _i532=0;_i532<6;_i532++){planes.push(math.identityMat4());}// Left plane
|
|
27586
27649
|
planes[0][0]=combinedMatrix[3]+combinedMatrix[0];planes[0][1]=combinedMatrix[7]+combinedMatrix[4];planes[0][2]=combinedMatrix[11]+combinedMatrix[8];planes[0][3]=combinedMatrix[15]+combinedMatrix[12];// Right plane
|
|
27587
27650
|
planes[1][0]=combinedMatrix[3]-combinedMatrix[0];planes[1][1]=combinedMatrix[7]-combinedMatrix[4];planes[1][2]=combinedMatrix[11]-combinedMatrix[8];planes[1][3]=combinedMatrix[15]-combinedMatrix[12];// Bottom plane
|
|
27588
27651
|
planes[2][0]=combinedMatrix[3]+combinedMatrix[1];planes[2][1]=combinedMatrix[7]+combinedMatrix[5];planes[2][2]=combinedMatrix[11]+combinedMatrix[9];planes[2][3]=combinedMatrix[15]+combinedMatrix[13];// Top plane
|
|
27589
27652
|
planes[3][0]=combinedMatrix[3]-combinedMatrix[1];planes[3][1]=combinedMatrix[7]-combinedMatrix[5];planes[3][2]=combinedMatrix[11]-combinedMatrix[9];planes[3][3]=combinedMatrix[15]-combinedMatrix[13];// Near plane
|
|
27590
27653
|
planes[4][0]=combinedMatrix[3]+combinedMatrix[2];planes[4][1]=combinedMatrix[7]+combinedMatrix[6];planes[4][2]=combinedMatrix[11]+combinedMatrix[10];planes[4][3]=combinedMatrix[15]+combinedMatrix[14];// Far plane
|
|
27591
|
-
planes[5][0]=combinedMatrix[3]-combinedMatrix[2];planes[5][1]=combinedMatrix[7]-combinedMatrix[6];planes[5][2]=combinedMatrix[11]-combinedMatrix[10];planes[5][3]=combinedMatrix[15]-combinedMatrix[14];for(var
|
|
27654
|
+
planes[5][0]=combinedMatrix[3]-combinedMatrix[2];planes[5][1]=combinedMatrix[7]-combinedMatrix[6];planes[5][2]=combinedMatrix[11]-combinedMatrix[10];planes[5][3]=combinedMatrix[15]-combinedMatrix[14];for(var _i533=0;_i533<6;_i533++){var length=Math.sqrt(planes[_i533][0]*planes[_i533][0]+planes[_i533][1]*planes[_i533][1]+planes[_i533][2]*planes[_i533][2]);planes[_i533][0]/=length;planes[_i533][1]/=length;planes[_i533][2]/=length;planes[_i533][3]/=length;}return planes;}},{key:"insideView",get:function get(){return this._insideView;},set:function set(insideView){this._insideView=insideView;}/**
|
|
27592
27655
|
* Sets whether view culling is enabled.
|
|
27593
27656
|
*
|
|
27594
27657
|
* @param {Boolean} enabled Whether to enable view culling.
|
|
@@ -27597,7 +27660,7 @@ planes[5][0]=combinedMatrix[3]-combinedMatrix[2];planes[5][1]=combinedMatrix[7]-
|
|
|
27597
27660
|
*
|
|
27598
27661
|
* @retutns {Boolean} Whether view culling is enabled.
|
|
27599
27662
|
*/function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this156=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this156._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);// this.insideView = intersects == 0 || intersects == 1;
|
|
27600
|
-
kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var
|
|
27663
|
+
kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var _i534=0,len=objects.length;_i534<len;_i534++){var objectIdx=objects[_i534];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
|
|
27601
27664
|
* @private
|
|
27602
27665
|
*/},{key:"send",value:function send(name,value){}/**
|
|
27603
27666
|
* Destroys this ViewCullPlugin.
|
|
@@ -27622,12 +27685,18 @@ kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var obje
|
|
|
27622
27685
|
* @param {Function} ok Callback fired on success, argument is the ````.xtc```` file in an arraybuffer.
|
|
27623
27686
|
* @param {Function} error Callback fired on error.
|
|
27624
27687
|
*/},{key:"getXTC",value:function getXTC(src,ok,error){var defaultCallback=function defaultCallback(){};ok=ok||defaultCallback;error=error||defaultCallback;var dataUriRegex=/^data:(.*?)(;base64)?,(.*)$/;var dataUriRegexResult=src.match(dataUriRegex);if(dataUriRegexResult){// Safari can't handle data URIs through XMLHttpRequest
|
|
27625
|
-
var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open("GET",src,true);request.responseType="arraybuffer";request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error("getXTC error : "+request.response);}}};request.send(null);}}}]);}();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof2(exports))&&"undefined"!="object"?e(exports):"function"==typeof define&&__webpack_require__.amdO?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;)t[e]=0;}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++)o=o+a[n-1]<<1,i[n]=o;for(r=0;r<=e;r++){var _e2=t[2*r+1];0!==_e2&&(t[2*r]=A(i[_e2]++,_e2));}},R=function R(t){var e;for(e=0;e<i;e++)t.dyn_ltree[2*e]=0;for(e=0;e<n;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++)0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);for(e.max_code=d,o=t.heap_len>>1;o>=1;o--)S(t,a,o);h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==m){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++)x(t,t.bl_tree[2*h[n]+1],3);I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<<r[h];t++)c[a++]=h;for(c[a-1]=h,k=0,h=0;h<16;h++)for(w[h]=k,t=0;t<1<<o[h];t++)f[k++]=h;for(k>>=7;h<n;h++)for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++)f[256+k++]=h;for(e=0;e<=s;e++)v[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,v[8]++;for(;t<=255;)d[2*t+1]=9,t++,v[9]++;for(;t<=279;)d[2*t+1]=7,t++,v[7]++;for(;t<=287;)d[2*t+1]=8,t++,v[8]++;for(E(d,287,v),t=0;t<n;t++)_[2*t+1]=5,_[2*t]=A(t,5);b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a7=i;_a7<s;_a7++)t=t>>>8^n[255&(t^e[_a7])];return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;)t[e]=0;},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e3=ft+(a.w_bits-8<<4)<<8,_i534=-1;if(_i534=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e3|=_i534<<6,0!==a.strstart&&(_e3|=32),_e3+=31-_e3%31,Et(a,_e3),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e4=a.pending,_i535=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i535>a.pending_buf_size;){var _n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex+=_n,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e4=0,_i535-=_n;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i535),a.pending),a.pending+=_i535,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e5,_i536=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i536&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i536,_i536)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i536=0;}_e5=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e5);}while(0!==_e5);a.gzhead.hcrc&&a.pending>_i536&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i536,_i536)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e6,_i537=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i537&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i537,_i537)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i537=0;}_e6=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i537&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i537,_i537));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i538=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i538&&4!==_i538||(a.status=bt),1===_i538||3===_i538)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i538&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t6=new Uint8Array(i.w_size);_t6.set(e.subarray(a-i.w_size,a),0),e=_t6,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t7=i.strstart,_e7=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t7+3-1]),i.prev[_t7&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t7,_t7++;}while(--_e7);i.strstart=_t7,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a8=e.shift();if(_a8){if("object"!=_typeof2(_a8))throw new TypeError(_a8+"must be non-object");for(var _e8 in _a8)Ht(_a8,_e8)&&(t[_e8]=_a8[_e8]);}}return t;},Kt=function Kt(t){var e=0;for(var _a9=0,_i539=t.length;_a9<_i539;_a9++)e+=t[_a9].length;var a=new Uint8Array(e);for(var _e9=0,_i540=0,_n3=t.length;_e9<_n3;_e9++){var _n4=t[_e9];a.set(_n4,_i540),_i540+=_n4.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t8=0;_t8<256;_t8++)Yt[_t8]=_t8>=252?6:_t8>=248?5:_t8>=240?4:_t8>=224?3:_t8>=192?2:1;Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(o),s=0,n=0;s<o;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e0=t[i++];if(_e0<128){s[n++]=_e0;continue;}var _r6=Yt[_e0];if(_r6>4)s[n++]=65533,i+=_r6-1;else{for(_e0&=2===_r6?31:3===_r6?15:7;_r6>1&&i<a;)_e0=_e0<<6|63&t[i++],_r6--;_r6>1?s[n++]=65533:_e0<65536?s[n++]=_e0:(_e0-=65536,s[n++]=55296|_e0>>10&1023,s[n++]=56320|1023&_e0);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i541=0;_i541<e;_i541++)a+=String.fromCharCode(t[_i541]);return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t9;if(_t9="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t9),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++)E[w]=0;for(m=0;m<i;m++)E[e[a+m]]++;for(p=l,g=_e;g>=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++);for(p<b&&(p=b),y=1,w=1;w<=_e;w++)if(y<<=1,y-=E[w],y<0)return-1;if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++)R[w+1]=R[w]+E[w];for(m=0;m<i;m++)0!==e[a+m]&&(r[R[e[a+m]]++]=m);if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;)h>>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));)k++,y<<=1;if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e1=0;for(;_e1<144;)t.lens[_e1++]=8;for(;_e1<256;)t.lens[_e1++]=9;for(;_e1<280;)t.lens[_e1++]=7;for(;_e1<288;)t.lens[_e1++]=8;for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e1=0;_e1<32;)t.lens[_e1++]=5;me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;)switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;)a.lens[a.have++]=y;}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];)qe.inflateReset(a),s=qe.inflate(a,r);switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t0=Wt(a.output,a.next_out),_e10=a.next_out-_t0,_n5=Xt(a.output,_t0);a.next_out=_e10,a.avail_out=i-_e10,_e10&&a.output.set(a.output.subarray(_t0,_t0+_e10),0),this.onData(_n5);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
|
|
27688
|
+
var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open("GET",src,true);request.responseType="arraybuffer";request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error("getXTC error : "+request.response);}}};request.send(null);}}}]);}();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof2(exports))&&"undefined"!="object"?e(exports):"function"==typeof define&&__webpack_require__.amdO?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;)t[e]=0;}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++)o=o+a[n-1]<<1,i[n]=o;for(r=0;r<=e;r++){var _e2=t[2*r+1];0!==_e2&&(t[2*r]=A(i[_e2]++,_e2));}},R=function R(t){var e;for(e=0;e<i;e++)t.dyn_ltree[2*e]=0;for(e=0;e<n;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++)0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);for(e.max_code=d,o=t.heap_len>>1;o>=1;o--)S(t,a,o);h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==m){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++)x(t,t.bl_tree[2*h[n]+1],3);I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<<r[h];t++)c[a++]=h;for(c[a-1]=h,k=0,h=0;h<16;h++)for(w[h]=k,t=0;t<1<<o[h];t++)f[k++]=h;for(k>>=7;h<n;h++)for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++)f[256+k++]=h;for(e=0;e<=s;e++)v[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,v[8]++;for(;t<=255;)d[2*t+1]=9,t++,v[9]++;for(;t<=279;)d[2*t+1]=7,t++,v[7]++;for(;t<=287;)d[2*t+1]=8,t++,v[8]++;for(E(d,287,v),t=0;t<n;t++)_[2*t+1]=5,_[2*t]=A(t,5);b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a7=i;_a7<s;_a7++)t=t>>>8^n[255&(t^e[_a7])];return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;)t[e]=0;},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e3=ft+(a.w_bits-8<<4)<<8,_i535=-1;if(_i535=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e3|=_i535<<6,0!==a.strstart&&(_e3|=32),_e3+=31-_e3%31,Et(a,_e3),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e4=a.pending,_i536=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i536>a.pending_buf_size;){var _n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex+=_n,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e4=0,_i536-=_n;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i536),a.pending),a.pending+=_i536,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e5,_i537=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i537&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i537,_i537)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i537=0;}_e5=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e5);}while(0!==_e5);a.gzhead.hcrc&&a.pending>_i537&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i537,_i537)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e6,_i538=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i538&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i538,_i538)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i538=0;}_e6=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i538&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i538,_i538));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i539=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i539&&4!==_i539||(a.status=bt),1===_i539||3===_i539)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i539&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t6=new Uint8Array(i.w_size);_t6.set(e.subarray(a-i.w_size,a),0),e=_t6,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t7=i.strstart,_e7=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t7+3-1]),i.prev[_t7&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t7,_t7++;}while(--_e7);i.strstart=_t7,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a8=e.shift();if(_a8){if("object"!=_typeof2(_a8))throw new TypeError(_a8+"must be non-object");for(var _e8 in _a8)Ht(_a8,_e8)&&(t[_e8]=_a8[_e8]);}}return t;},Kt=function Kt(t){var e=0;for(var _a9=0,_i540=t.length;_a9<_i540;_a9++)e+=t[_a9].length;var a=new Uint8Array(e);for(var _e9=0,_i541=0,_n3=t.length;_e9<_n3;_e9++){var _n4=t[_e9];a.set(_n4,_i541),_i541+=_n4.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t8=0;_t8<256;_t8++)Yt[_t8]=_t8>=252?6:_t8>=248?5:_t8>=240?4:_t8>=224?3:_t8>=192?2:1;Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(o),s=0,n=0;s<o;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e0=t[i++];if(_e0<128){s[n++]=_e0;continue;}var _r6=Yt[_e0];if(_r6>4)s[n++]=65533,i+=_r6-1;else{for(_e0&=2===_r6?31:3===_r6?15:7;_r6>1&&i<a;)_e0=_e0<<6|63&t[i++],_r6--;_r6>1?s[n++]=65533:_e0<65536?s[n++]=_e0:(_e0-=65536,s[n++]=55296|_e0>>10&1023,s[n++]=56320|1023&_e0);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i542=0;_i542<e;_i542++)a+=String.fromCharCode(t[_i542]);return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t9;if(_t9="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t9),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++)E[w]=0;for(m=0;m<i;m++)E[e[a+m]]++;for(p=l,g=_e;g>=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++);for(p<b&&(p=b),y=1,w=1;w<=_e;w++)if(y<<=1,y-=E[w],y<0)return-1;if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++)R[w+1]=R[w]+E[w];for(m=0;m<i;m++)0!==e[a+m]&&(r[R[e[a+m]]++]=m);if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;)h>>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));)k++,y<<=1;if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e1=0;for(;_e1<144;)t.lens[_e1++]=8;for(;_e1<256;)t.lens[_e1++]=9;for(;_e1<280;)t.lens[_e1++]=7;for(;_e1<288;)t.lens[_e1++]=8;for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e1=0;_e1<32;)t.lens[_e1++]=5;me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;)switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;)a.lens[a.have++]=y;}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];)qe.inflateReset(a),s=qe.inflate(a,r);switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t0=Wt(a.output,a.next_out),_e10=a.next_out-_t0,_n5=Xt(a.output,_t0);a.next_out=_e10,a.avail_out=i-_e10,_e10&&a.output.set(a.output.subarray(_t0,_t0+_e10),0),this.onData(_n5);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
|
|
27626
27689
|
Parser for .XTC Format V10
|
|
27627
27690
|
*/var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
|
|
27628
27691
|
pako=pako["default"];}var tempVec4a=math.vec4();var tempVec4b=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;function extract(elements){var i=0;return{metadata:elements[i++],textureData:elements[i++],eachTextureDataPortion:elements[i++],eachTextureAttributes:elements[i++],positions:elements[i++],normals:elements[i++],colors:elements[i++],uvs:elements[i++],indices:elements[i++],edgeIndices:elements[i++],eachTextureSetTextures:elements[i++],matrices:elements[i++],reusedGeometriesDecodeMatrix:elements[i++],eachGeometryPrimitiveType:elements[i++],eachGeometryPositionsPortion:elements[i++],eachGeometryNormalsPortion:elements[i++],eachGeometryColorsPortion:elements[i++],eachGeometryUVsPortion:elements[i++],eachGeometryIndicesPortion:elements[i++],eachGeometryEdgeIndicesPortion:elements[i++],eachMeshGeometriesPortion:elements[i++],eachMeshMatricesPortion:elements[i++],eachMeshTextureSet:elements[i++],eachMeshMaterialAttributes:elements[i++],eachEntityId:elements[i++],eachEntityMeshesPortion:elements[i++],eachTileAABB:elements[i++],eachTileEntitiesPortion:elements[i++]};}function inflate(deflatedData){function inflate(array,options){return array.length===0?[]:pako.inflate(array,options).buffer;}return{metadata:JSON.parse(pako.inflate(deflatedData.metadata,{to:"string"})),textureData:new Uint8Array(inflate(deflatedData.textureData)),// <<----------------------------- ??? ZIPPing to blame?
|
|
27629
27692
|
eachTextureDataPortion:new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),eachTextureAttributes:new Uint16Array(inflate(deflatedData.eachTextureAttributes)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),uvs:new Float32Array(inflate(deflatedData.uvs)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),eachTextureSetTextures:new Int32Array(inflate(deflatedData.eachTextureSetTextures)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryUVsPortion:new Uint32Array(inflate(deflatedData.eachGeometryUVsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshTextureSet:new Int32Array(inflate(deflatedData.eachMeshTextureSet)),// Can be -1
|
|
27630
|
-
eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement("canvas");var context=canvas.getContext("2d");return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata
|
|
27693
|
+
eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement("canvas");var context=canvas.getContext("2d");return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;// 0 号段 metadata 新增字段(新版 xtc_exporter 写入;老文件缺席 → 判空兼容):
|
|
27694
|
+
// - glassMode:"alpha"=玻璃走 alpha 混合;缺席=旧行为。本引擎无 transmission 概念,
|
|
27695
|
+
// 透明材质统一走 alpha 混合(opacity<1 → 透明 pass),两种取值行为一致,故不设分支。
|
|
27696
|
+
// - spaceEids:房间体(IFCSPACE)base eid 表,用于下方 mesh 强制半透明
|
|
27697
|
+
// (对齐切片 Viewer 的 forceTransparentSpaces);缺席视为空表,规则零触发。
|
|
27698
|
+
var glassMode=metadata.glassMode;var spaceEids=Array.isArray(metadata.spaceEids)?metadata.spaceEids:[];var spaceEidsSet=new Set(spaceEids.map(String));if(glassMode!==undefined||spaceEids.length>0){// 便于验证新格式字段是否随文件带到(老文件两字段均缺席时不输出)
|
|
27699
|
+
viewer.log("XTC metadata: glassMode=".concat(glassMode,", spaceEids=").concat(spaceEids.length));}var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;// Metadata
|
|
27631
27700
|
if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
|
|
27632
27701
|
}// Create textures
|
|
27633
27702
|
for(var textureIndex=0;textureIndex<numTextures;textureIndex++){var atLastTexture=textureIndex===numTextures-1;var textureDataPortionStart=eachTextureDataPortion[textureIndex];var textureDataPortionEnd=atLastTexture?textureData.length:eachTextureDataPortion[textureIndex+1];var textureDataPortionSize=textureDataPortionEnd-textureDataPortionStart;var textureDataPortionExists=textureDataPortionSize>0;var textureAttrBaseIdx=textureIndex*NUM_TEXTURE_ATTRIBUTES;var compressed=eachTextureAttributes[textureAttrBaseIdx+0]===1;eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
|
|
@@ -27641,10 +27710,18 @@ var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};f
|
|
|
27641
27710
|
for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<=lastTileEntityIndex;tileEntityIndex++){var xtcEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xtcEntityId):xtcEntityId;var finalTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===finalTileEntityIndex;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length-1:eachEntityMeshesPortion[tileEntityIndex+1]-1;var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
|
|
27642
27711
|
if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
|
|
27643
27712
|
var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
|
|
27644
|
-
for(var _meshIndex=firstMeshIndex;_meshIndex<=lastMeshIndex;_meshIndex++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex*6,_meshIndex*6+3));var
|
|
27713
|
+
for(var _meshIndex=firstMeshIndex;_meshIndex<=lastMeshIndex;_meshIndex++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex*6,_meshIndex*6+3));var meshOpacityByte=eachMeshMaterialAttributes[_meshIndex*6+3];// 房间体的呈现(默认"仅轮廓" / 开关显示半透明填充)在实体创建后由
|
|
27714
|
+
// SceneModel._registerSpaceEntity 统一应用(对齐 Scene#spacesVisible 开关);
|
|
27715
|
+
// 此处保持导出材质原值,不做特殊处理。
|
|
27716
|
+
var meshOpacity=meshOpacityByte/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
|
|
27645
27717
|
var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex);// These IDs are local to the SceneModel
|
|
27646
|
-
var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var
|
|
27647
|
-
var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType){case 0:primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;break;case 3:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices&&geometryIndices.length>0?geometryIndices:null,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}))
|
|
27718
|
+
var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i543=0,len=geometryPositions.length;_i543<len;_i543+=3){decompressedPositions[_i543+0]=geometryPositions[_i543+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i543+1]=geometryPositions[_i543+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i543+2]=geometryPositions[_i543+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i544=0,_len76=_decompressedPositions.length;_i544<_len76;_i544+=3){tempVec4a[0]=_decompressedPositions[_i544+0];tempVec4a[1]=_decompressedPositions[_i544+1];tempVec4a[2]=_decompressedPositions[_i544+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i544+0]=tempVec4a[0];transformedAndRecompressedPositions[_i544+1]=tempVec4a[1];transformedAndRecompressedPositions[_i544+2]=tempVec4a[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:spaceEdgeIndices(spaceEidsSet.has(xtcEntityId),geometryArrays.geometryEdgeIndices),positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:spaceEdgeIndices(spaceEidsSet.has(xtcEntityId),geometryArrays.geometryEdgeIndices),positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
|
|
27719
|
+
var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType){case 0:primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;break;case 3:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices&&geometryIndices.length>0?geometryIndices:null,edgeIndices:spaceEdgeIndices(spaceEidsSet.has(xtcEntityId),geometryEdgeIndices),positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){var sceneModelEntity=sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));// 房间体(spaceEids 命中):注册到 SceneModel,默认"仅轮廓"呈现(填充近不可见 + 边线),
|
|
27720
|
+
// 下游可用 viewer.scene.spacesVisible = true 显示 50% 半透明填充。
|
|
27721
|
+
if(sceneModelEntity&&spaceEidsSet.has(xtcEntityId)){sceneModel._registerSpaceEntity(sceneModelEntity);}}}}}/**
|
|
27722
|
+
* 房间体轮廓辅助:导出关闭边线(no_edges=True)时文件内边线段为空,
|
|
27723
|
+
* 对房间体(spaceEids 命中)传 undefined,由引擎按几何现算边线(SceneModel.createMesh 内 buildEdgeIndices)。
|
|
27724
|
+
*/function spaceEdgeIndices(isSpace,edgeIndices){return isSpace&&edgeIndices&&edgeIndices.length===0?undefined:edgeIndices;}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i545=0,len=indices.length-1;_i545<len;_i545++){linesIndices.push(indices[_i545]);linesIndices.push(indices[_i545+1]);}}else if(positions.length>1){for(var _i546=0,_len77=positions.length/3-1;_i546<_len77;_i546++){linesIndices.push(_i546);linesIndices.push(_i546+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract(elements);var inflatedData=inflate(deflatedData);load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);},inflateMetadata:inflateMetadata};var parsers={};// parsers[ParserV1.version] = ParserV1;
|
|
27648
27725
|
// parsers[ParserV2.version] = ParserV2;
|
|
27649
27726
|
// parsers[ParserV3.version] = ParserV3;
|
|
27650
27727
|
// parsers[ParserV4.version] = ParserV4;
|
|
@@ -28410,13 +28487,20 @@ parsers[ParserV10.version]=ParserV10;/**
|
|
|
28410
28487
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
28411
28488
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
28412
28489
|
*/},{key:"load",value:function load(){var _this158=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xtc&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xtc, manifestSrc or manifestData");return sceneModel;// Return new empty model
|
|
28413
|
-
}var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&¶ms.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var
|
|
28414
|
-
var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){
|
|
28415
|
-
|
|
28490
|
+
}var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&¶ms.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i547=0,len=includeTypes.length;_i547<len;_i547++){options.includeTypesMap[includeTypes[_i547]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i548=0,_len78=excludeTypes.length;_i548<_len78;_i548++){options.excludeTypesMap[excludeTypes[_i548]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&¶ms.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
|
|
28491
|
+
var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){// 先释放 spinner 计数:避免模型在加载中途被销毁时计数泄漏、spinner 永不消失
|
|
28492
|
+
_this158.viewer.scene.canvas.spinner.processes--;if(sceneModel.destroyed){return;}// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
|
|
28493
|
+
sceneModel.finalize();metaModel.finalize();sceneModel.once("destroyed",function(){_this158.viewer.metaScene.destroyMetaModel(metaModel.id);});_this158.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
28416
28494
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
28417
28495
|
});};var error=function error(errMsg){_this158.viewer.scene.canvas.spinner.processes--;_this158.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
|
|
28418
|
-
if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this158._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this158._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){
|
|
28419
|
-
|
|
28496
|
+
if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this158._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this158._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){// processes 已自增:先让浏览器把 spinner 渲染出来,下一帧再做同步解析。
|
|
28497
|
+
// (解析会阻塞主线程,若与 ++/-- 同处一个任务内,spinner 将没有上屏机会)
|
|
28498
|
+
var ran=false;var parseAndFinish=function parseAndFinish(){if(ran){return;}ran=true;_this158._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx);finish();};requestAnimationFrame(function(){return setTimeout(parseAndFinish,0);});setTimeout(parseAndFinish,50);// 兜底:后台标签页 rAF 可能被节流
|
|
28499
|
+
}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var _loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this158._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this158.scheduleTask(_loadNext,200);},error);}};_loadNext();};var loadXTCs_excludeTheirMetaModels=function loadXTCs_excludeTheirMetaModels(xtcFiles,done,error){var i=0;var _loadNext2=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this158._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this158._parseModel(arrayBuffer,params,options,sceneModel,null/* Ignore metamodel in XTC */,manifestCtx);sceneModel.preFinalize();i++;_this158.scheduleTask(_loadNext2,200);},error);}};_loadNext2();};var loadXTCs_includeTheirMetaModels=function loadXTCs_includeTheirMetaModels(xtcFiles,done,error){// Load XTCs, parse metamodels from the XTC
|
|
28500
|
+
var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this158._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this158._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this158.scheduleTask(_loadNext3,100);},error);}};_loadNext3();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this159=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this159._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xtcVersion,parser,numElements,elements,byteOffset,_i549,elementSize;return _regenerator().w(function(_context1){while(1)switch(_context1.n){case 0:if(!sceneModel.destroyed){_context1.n=1;break;}return _context1.a(2);case 1:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xtcVersion=dataView.getUint32(0,true);parser=parsers[xtcVersion];if(parser){_context1.n=2;break;}this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return _context1.a(2);case 2:this.log("Loading .xtc V"+xtcVersion);numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i549=0;_i549<numElements;_i549++){elementSize=dataView.getUint32((_i549+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}try{parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}catch(e){// 本方法为 async 且调用方未 await/catch:解析异常直接抛出会成为 unhandled rejection,
|
|
28501
|
+
// 模型被静默截断但 loaded 事件照常触发;此处显式上报,避免解析失败无感知。
|
|
28502
|
+
this.error("XTCLoaderPlugin: parsing failed - "+e);}case 3:return _context1.a(2);}},_callee8,this);}));function _parseModel(_x100,_x101,_x102,_x103,_x104,_x105){return _parseModel2.apply(this,arguments);}return _parseModel;}()},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this160=this;metaModel._finalized=false;// 元数据(XTS)解压/注入阶段也计入 spinner 计数,让该阶段有加载指示
|
|
28503
|
+
var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;var ended=false;var end=function end(){if(ended){return;}ended=true;spinner.processes--;};try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();end();_this160.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();end();_this160.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){end();this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
|
|
28420
28504
|
});worker.onmessage=function(e){if(force){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});}else{plugin.fire("metaLoading",function(){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});});}};worker.onerror=function(e){if(typeof err==="function")err(worker,e.message);worker.terminate();};}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
|
|
28421
28505
|
//
|
|
28422
28506
|
// const metaModelId = sceneModel.id;
|
|
@@ -28985,7 +29069,7 @@ return _this161;}/**
|
|
|
28985
29069
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
28986
29070
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
28987
29071
|
*/},{key:"load",value:function load(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true}));if(!params.src&&!params.ifc){this.error("load() param expected: src or IFC");return sceneModel;// Return new empty model
|
|
28988
|
-
}var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var
|
|
29072
|
+
}var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i550=0,len=includeTypes.length;_i550<len;_i550++){options.includeTypesMap[includeTypes[_i550]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i551=0,_len79=excludeTypes.length;_i551<_len79;_i551++){options.excludeTypesMap[excludeTypes[_i551]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}if(this.webIfcFroMOutside)try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}// this.on("initialized", () => {
|
|
28989
29073
|
// try {
|
|
28990
29074
|
// if (params.src) {
|
|
28991
29075
|
// this._loadModel(params.src, params, options, sceneModel);
|
|
@@ -28998,9 +29082,9 @@ return _this161;}/**
|
|
|
28998
29082
|
// }
|
|
28999
29083
|
// });
|
|
29000
29084
|
return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this162=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this162._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this162.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&¶ms.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
|
|
29001
|
-
nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var
|
|
29085
|
+
nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i552=0,len=options.includeTypes.length;_i552<len;_i552++){ctx.includeTypes[options.includeTypes[_i552]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i553=0,_len80=options.excludeTypes.length;_i553<_len80;_i553++){ctx.excludeTypes[options.excludeTypes[_i553]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
29002
29086
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
29003
|
-
});}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this163=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var
|
|
29087
|
+
});}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this163=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i554=0;_i554<lines.size();_i554++){var relID=lines.get(_i554);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this163._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this163._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i555=0;_i555<lines.size();_i555++){var relID=lines.get(_i555);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i556=0,len=props.length;_i556<len;_i556++){var prop=props[_i556];var _name8=prop.Name;var nominalValue=prop.NominalValue;if(_name8&&nominalValue){var property={name:_name8.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i557=0,_len81=relatedObjects.length;_i557<_len81;_i557++){var relatedObject=relatedObjects[_i557];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this164=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
|
|
29004
29088
|
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this164._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this164._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this164._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this164._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
29005
29089
|
var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,_l3=0,lenk=vertexData.length/6;k<lenk;k++,_l3+=3){positions[_l3+0]=vertexData[k*6+0];positions[_l3+1]=vertexData[k*6+1];positions[_l3+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k2=0,_l4=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l4+=3){normals[_l4+0]=vertexData[_k2*6+3];normals[_l4+1]=vertexData[_k2*6+4];normals[_l4+2]=vertexData[_k2*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
|
|
29006
29090
|
origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this164._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this164._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this164._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this164._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
@@ -29018,12 +29102,12 @@ this._rotationState={};// { [entityId]: { quat: Float64Array, center: number[] }
|
|
|
29018
29102
|
// Animation state
|
|
29019
29103
|
this._animRAF=null;this._createNodes();this._bindEvents();}return _createClass(TransformControl,[{key:"setTargets",value:function setTargets(ids){this._targetIds=ids||[];this._batchedRotEntries=[];if(this._targetIds.length>0){this._setPos(this._getCentroid());}// Reset gizmo rotation to world-aligned on new target selection
|
|
29020
29104
|
this._rootNode.quaternion=[0,0,0,1];// Build batched entries for targets whose meshes have no transform (batching layer)
|
|
29021
|
-
this._buildBatchedEntries();}},{key:"_buildBatchedEntries",value:function _buildBatchedEntries(){var scene=this._scene;for(var
|
|
29105
|
+
this._buildBatchedEntries();}},{key:"_buildBatchedEntries",value:function _buildBatchedEntries(){var scene=this._scene;for(var _i558=0,len=this._targetIds.length;_i558<len;_i558++){var id=this._targetIds[_i558];var entity=scene._findObjectEntity(id);if(!entity||!entity.meshes)continue;// Restore persisted rotation state, or create fresh
|
|
29022
29106
|
var state=this._rotationState[id];if(!state){var _localCenter=[0,0,0];state={quat:math.vec4([0,0,0,1]),center:_localCenter};this._rotationState[id]=state;}// Update center each time (object may have moved)
|
|
29023
29107
|
var localCenter=[0,0,0];for(var j=0,mlen=entity.meshes.length;j<mlen;j++){var _mesh0=entity.meshes[j];if(!_mesh0.transform&&_mesh0.layer&&typeof _mesh0.layer.setMatrix==="function"){var portion=_mesh0.layer._portions&&_mesh0.layer._portions[_mesh0.portionId];if(portion&&portion.aabb){var _a0=portion.aabb;localCenter[0]=(_a0[0]+_a0[3])/2;localCenter[1]=(_a0[1]+_a0[4])/2;localCenter[2]=(_a0[2]+_a0[5])/2;}state.center=localCenter.slice();this._batchedRotEntries.push({entityId:id,mesh:_mesh0,layer:_mesh0.layer,portionId:_mesh0.portionId,quat:state.quat,// shared reference — persists across rebuilds
|
|
29024
|
-
center:state.center});}}}}},{key:"_getCentroid",value:function _getCentroid(){var scene=this._scene;var sx=0,sy=0,sz=0,count=0;for(var
|
|
29108
|
+
center:state.center});}}}}},{key:"_getCentroid",value:function _getCentroid(){var scene=this._scene;var sx=0,sy=0,sz=0,count=0;for(var _i559=0,len=this._targetIds.length;_i559<len;_i559++){var id=this._targetIds[_i559];// Try AABB center first (world-space)
|
|
29025
29109
|
var aabb=scene.getObjectAABB(id);if(aabb){sx+=(aabb[0]+aabb[3])/2;sy+=(aabb[1]+aabb[4])/2;sz+=(aabb[2]+aabb[5])/2;// Account for entity offset — SceneModelEntity AABB does not include offset
|
|
29026
|
-
var entity=scene._findObjectEntity(id);if(entity&&entity.offset){sx+=entity.offset[0];sy+=entity.offset[1];sz+=entity.offset[2];}count++;}else{var _entity3=scene._findObjectEntity(id);if(_entity3&&_entity3.worldMatrix){sx+=_entity3.worldMatrix[12];sy+=_entity3.worldMatrix[13];sz+=_entity3.worldMatrix[14];count++;}}}if(count===0)return[0,0,0];return[sx/count,sy/count,sz/count];}},{key:"_setPos",value:function _setPos(xyz){this._pos.set(xyz);worldToRTCPos(this._pos,this._origin,this._rtcPos);this._rootNode.origin=this._origin;this._rootNode.position=this._rtcPos;}},{key:"setPosition",value:function setPosition(pos){this._setPos(pos);}},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible===visible)return;this._visible=visible;this._syncModeVisibility();}},{key:"getVisible",value:function getVisible(){return this._visible;}},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id))this._displayMeshes[id].culled=culled;}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id))this._affordanceMeshes[id].culled=culled;}}}},{key:"_syncModeVisibility",value:function _syncModeVisibility(){var _this165=this;var keys=Object.keys(this._displayMeshes);for(var
|
|
29110
|
+
var entity=scene._findObjectEntity(id);if(entity&&entity.offset){sx+=entity.offset[0];sy+=entity.offset[1];sz+=entity.offset[2];}count++;}else{var _entity3=scene._findObjectEntity(id);if(_entity3&&_entity3.worldMatrix){sx+=_entity3.worldMatrix[12];sy+=_entity3.worldMatrix[13];sz+=_entity3.worldMatrix[14];count++;}}}if(count===0)return[0,0,0];return[sx/count,sy/count,sz/count];}},{key:"_setPos",value:function _setPos(xyz){this._pos.set(xyz);worldToRTCPos(this._pos,this._origin,this._rtcPos);this._rootNode.origin=this._origin;this._rootNode.position=this._rtcPos;}},{key:"setPosition",value:function setPosition(pos){this._setPos(pos);}},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible===visible)return;this._visible=visible;this._syncModeVisibility();}},{key:"getVisible",value:function getVisible(){return this._visible;}},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id))this._displayMeshes[id].culled=culled;}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id))this._affordanceMeshes[id].culled=culled;}}}},{key:"_syncModeVisibility",value:function _syncModeVisibility(){var _this165=this;var keys=Object.keys(this._displayMeshes);for(var _i560=0,_keys=keys;_i560<_keys.length;_i560++){var k=_keys[_i560];if(this._displayMeshes[k])this._displayMeshes[k].visible=false;}if(!this._visible)return;var s=function s(n){if(_this165._displayMeshes[n])_this165._displayMeshes[n].visible=true;};// Translate handles
|
|
29027
29111
|
s("center");s("xAxis");s("xAxisArrow");s("xAxisArrowHandle");s("xAxisHandle");s("yShaft");s("yAxisArrow");s("yAxisArrowHandle");s("yShaftHandle");s("zShaft");s("zAxisArrow");s("zAxisArrowHandle");s("zAxisHandle");// Rotate handles
|
|
29028
29112
|
s("xCurve");s("xCurveHandle");s("xCurveArrow1");s("xCurveArrow2");s("yCurve");s("yCurveHandle");s("yCurveArrow1");s("yCurveArrow2");s("zCurve");s("zCurveHandle");s("zCurveArrow1");s("zCurveArrow2");// // Scale handles
|
|
29029
29113
|
// s("xScaleBox");
|
|
@@ -29047,20 +29131,20 @@ this._displayMeshes.center=rootNode.addChild(new Mesh(rootNode,{geometry:new Rea
|
|
|
29047
29131
|
this._affordanceMeshes={xHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var r2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var r1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r1,r2,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:math.translateMat4c(0,radius+0.1,0,math.identityMat4()),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}/* ======================== EVENT BINDING ======================== */},{key:"_bindEvents",value:function _bindEvents(){var _this166=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5,xScale:6,yScale:7,zScale:8,uniformScale:9};var rootNode=this._rootNode;var nextDragAction=DRAG_ACTIONS.none;var dragAction=DRAG_ACTIONS.none;var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;/* keep gizmo screen size constant */{var _tempVec3a3=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){lastDist=-1;});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){lastDist=-1;});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this166._pos,_tempVec3a3)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;rootNode.scale=[0.07*worldSize,0.07*worldSize,0.07*worldSize];}if(camera.projection==="ortho"){rootNode.scale=[camera.ortho.scale/10,camera.ortho.scale/10,camera.ortho.scale/10];}lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;return canvasPos;}var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2]))math.cross3Vec3(worldAxis,[0,1,0],planeNormal);else math.cross3Vec3(worldAxis,[1,0,0],planeNormal);math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();/* ── Drag translate entities ── */var dragTranslate=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot*0.6;self._pos[1]+=worldAxis[1]*dot*0.6;self._pos[2]+=worldAxis[2]*dot*0.6;// Update root node using RTC coordinates (convert world -> RTC)
|
|
29048
29132
|
self._setPos(self._pos);self._applyEntityTranslation(worldAxis,dot*0.6);};}();/* ── Drag rotate entities ── */var dragRotate=function(){var p1=math.vec4(),p2=math.vec4(),c=math.vec4(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);getPointerPlaneIntersect(toMouse,planeNormal,p2,1);var dot=math.dotVec3(p1,worldAxis);p1[0]-=dot*worldAxis[0];p1[1]-=dot*worldAxis[1];p1[2]-=dot*worldAxis[2];dot=math.dotVec3(p2,worldAxis);p2[0]-=dot*worldAxis[0];p2[1]-=dot*worldAxis[1];p2[2]-=dot*worldAxis[2];}math.normalizeVec3(p1);math.normalizeVec3(p2);var dot=math.dotVec3(p1,p2);dot=math.clamp(dot,-1.0,1.0);var incDegrees=Math.acos(dot)*math.RADTODEG;math.cross3Vec3(p1,p2,c);if(math.dotVec3(c,worldAxis)<0.0)incDegrees=-incDegrees;rootNode.rotate(baseAxis,incDegrees);self._applyEntityRotation(baseAxis,incDegrees);};}();/* ── Drag scale entities ── */var dragScale=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse,uniform){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);var factor=1.0+dot*2.0;if(uniform){self._applyEntityScale([factor,factor,factor]);}else{var axisVec=[1,1,1];if(baseAxis===xBaseAxis)axisVec[0]=factor;else if(baseAxis===yBaseAxis)axisVec[1]=factor;else if(baseAxis===zBaseAxis)axisVec[2]=factor;else axisVec[0]=axisVec[1]=axisVec[2]=factor;self._applyEntityScale(axisVec);}};}();var getPointerPlaneIntersect=function(){var dir=math.vec4([0,0,0,1]);var matrix=math.mat4();return function(mouse,axis,dest,offset){offset=offset||0;dir[0]=mouse[0]/canvas.width*2.0-1.0;dir[1]=-(mouse[1]/canvas.height*2.0-1.0);dir[2]=0.0;dir[3]=1.0;math.mulMat4(camera.projMatrix,camera.viewMatrix,matrix);math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);var rayO=camera.eye;math.subVec4(dir,rayO,dir);var origin=self._pos;var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();/* ── Hover + mouse/touch events ── */{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this166._visible||down)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this166._displayMeshes.xAxisArrow.id:case _this166._displayMeshes.xAxisArrowHandle.id:case _this166._displayMeshes.xAxis.id:case _this166._displayMeshes.xAxisHandle.id:affordanceMesh=_this166._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this166._displayMeshes.yAxisArrow.id:case _this166._displayMeshes.yAxisArrowHandle.id:case _this166._displayMeshes.yShaft.id:case _this166._displayMeshes.yShaftHandle.id:affordanceMesh=_this166._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this166._displayMeshes.zAxisArrow.id:case _this166._displayMeshes.zAxisArrowHandle.id:case _this166._displayMeshes.zShaft.id:case _this166._displayMeshes.zAxisHandle.id:affordanceMesh=_this166._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this166._displayMeshes.xCurve.id:case _this166._displayMeshes.xCurveHandle.id:case _this166._displayMeshes.xCurveArrow1.id:case _this166._displayMeshes.xCurveArrow2.id:affordanceMesh=_this166._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this166._displayMeshes.yCurve.id:case _this166._displayMeshes.yCurveHandle.id:case _this166._displayMeshes.yCurveArrow1.id:case _this166._displayMeshes.yCurveArrow2.id:affordanceMesh=_this166._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this166._displayMeshes.zCurve.id:case _this166._displayMeshes.zCurveHandle.id:case _this166._displayMeshes.zCurveArrow1.id:case _this166._displayMeshes.zCurveArrow2.id:affordanceMesh=_this166._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this166._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this166._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this166._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this166._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(){if(!_this166._visible)return;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this166._visible||!grabbed)return;_this166._viewer.cameraControl.pointerEnabled=false;if(e.which===1){down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this166.plugin.fire("editStart");}});canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this166._visible||!down)return;var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this166._visible)return;_this166._viewer.cameraControl.pointerEnabled=true;if(!down)return;if(e.which===1){down=false;grabbed=false;_this166.plugin.fire("editEnd");}});/* Touch hover */this._onCameraControlTouch=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this166._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this166._displayMeshes.xAxisArrow.id:case _this166._displayMeshes.xAxisArrowHandle.id:case _this166._displayMeshes.xAxis.id:case _this166._displayMeshes.xAxisHandle.id:affordanceMesh=_this166._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this166._displayMeshes.yAxisArrow.id:case _this166._displayMeshes.yAxisArrowHandle.id:case _this166._displayMeshes.yShaft.id:case _this166._displayMeshes.yShaftHandle.id:affordanceMesh=_this166._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this166._displayMeshes.zAxisArrow.id:case _this166._displayMeshes.zAxisArrowHandle.id:case _this166._displayMeshes.zShaft.id:case _this166._displayMeshes.zAxisHandle.id:affordanceMesh=_this166._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this166._displayMeshes.xCurve.id:case _this166._displayMeshes.xCurveHandle.id:case _this166._displayMeshes.xCurveArrow1.id:case _this166._displayMeshes.xCurveArrow2.id:affordanceMesh=_this166._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this166._displayMeshes.yCurve.id:case _this166._displayMeshes.yCurveHandle.id:case _this166._displayMeshes.yCurveArrow1.id:case _this166._displayMeshes.yCurveArrow2.id:affordanceMesh=_this166._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this166._displayMeshes.zCurve.id:case _this166._displayMeshes.zCurveHandle.id:case _this166._displayMeshes.zCurveArrow1.id:case _this166._displayMeshes.zCurveArrow2.id:affordanceMesh=_this166._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this166._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this166._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this166._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this166._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});canvas.addEventListener("touchstart",this._canvasTouchStartListener=function(e){e.preventDefault();if(!_this166._visible||!grabbed)return;_this166._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this166.plugin.fire("editStart");});canvas.addEventListener("touchmove",this._canvasTouchMoveListener=function(e){if(!_this166._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this166._visible)return;_this166._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this166.plugin.fire("editEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}/* ======================== ENTITY UPDATE ======================== */// ── Public programmatic API ──
|
|
29049
29133
|
/** @param {number[]} delta World-space translation [dx, dy, dz] */},{key:"translate",value:function translate(delta){this._pos[0]+=delta[0];this._pos[1]+=delta[1];this._pos[2]+=delta[2];this._setPos(this._pos);this._applyEntityTranslationRaw(delta);}/** @param {number[]} axis Rotation axis [x, y, z] (normalized)
|
|
29050
|
-
* @param {number} degrees Rotation angle in degrees */},{key:"rotate",value:function rotate(axis,degrees){this._rootNode.rotate(axis,degrees);this._applyEntityRotation(axis,degrees);}/** @param {number[]} quat Absolute rotation quaternion [x, y, z, w] */},{key:"setRotation",value:function setRotation(quat){var _this167=this;for(var
|
|
29051
|
-
var _loop6=function _loop6(){var id=_this167._targetIds[
|
|
29052
|
-
_this167._scene.setObjectsQuaternion([id],quat);};for(var
|
|
29053
|
-
this._rootNode.quaternion=[quat[0],quat[1],quat[2],quat[3]];}/** @param {number[]} scale Scale factors [sx, sy, sz] */},{key:"setScale",value:function setScale(scale){var _this168=this;var _loop7=function _loop7(){var id=_this168._targetIds[
|
|
29054
|
-
_this168._scene.setObjectsScale([id],scale);};for(var
|
|
29055
|
-
for(var
|
|
29056
|
-
for(var
|
|
29057
|
-
var _loop8=function _loop8(){var id=_this169._targetIds[
|
|
29058
|
-
_this169._scene.setObjectsQuaternion([id],[0,0,0,1]);_this169._scene.setObjectsScale([id],[1,1,1]);};for(var
|
|
29134
|
+
* @param {number} degrees Rotation angle in degrees */},{key:"rotate",value:function rotate(axis,degrees){this._rootNode.rotate(axis,degrees);this._applyEntityRotation(axis,degrees);}/** @param {number[]} quat Absolute rotation quaternion [x, y, z, w] */},{key:"setRotation",value:function setRotation(quat){var _this167=this;for(var _i561=0,len=this._batchedRotEntries.length;_i561<len;_i561++){var entry=this._batchedRotEntries[_i561];entry.quat.set(quat);var rotMat=math.mat4();math.quaternionToMat4(quat,rotMat);var toOrigin=math.translationMat4v([-entry.center[0],-entry.center[1],-entry.center[2]],math.mat4());var fromOrigin=math.translationMat4v(entry.center,math.mat4());var pivotRot=math.mulMat4(fromOrigin,math.mulMat4(rotMat,toOrigin,math.mat4()),math.mat4());entry.layer.setMatrix(entry.portionId,pivotRot);}// For instanced entries
|
|
29135
|
+
var _loop6=function _loop6(){var id=_this167._targetIds[_i562];if(_this167._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
|
|
29136
|
+
_this167._scene.setObjectsQuaternion([id],quat);};for(var _i562=0,_len82=this._targetIds.length;_i562<_len82;_i562++){if(_loop6())continue;}// Sync gizmo orientation
|
|
29137
|
+
this._rootNode.quaternion=[quat[0],quat[1],quat[2],quat[3]];}/** @param {number[]} scale Scale factors [sx, sy, sz] */},{key:"setScale",value:function setScale(scale){var _this168=this;var _loop7=function _loop7(){var id=_this168._targetIds[_i563];if(_this168._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
|
|
29138
|
+
_this168._scene.setObjectsScale([id],scale);};for(var _i563=0,len=this._targetIds.length;_i563<len;_i563++){if(_loop7())continue;}}/** @returns {number[]} Current centroid position [x, y, z] */},{key:"getPosition",value:function getPosition(){return[this._pos[0],this._pos[1],this._pos[2]];}/** @returns {number[]|null} Accumulated rotation quaternion [x,y,z,w] or null */},{key:"getRotation",value:function getRotation(){if(this._batchedRotEntries.length>0){var q=this._batchedRotEntries[0].quat;return[q[0],q[1],q[2],q[3]];}if(this._targetIds.length>0){var _q2=this._scene.getObjectQuaternion(this._targetIds[0]);if(_q2)return _q2;}return null;}/** Reset all transforms to identity on current targets */},{key:"resetTransform",value:function resetTransform(){var _this169=this;// Reset batched entries to identity (no rotation, no pivot shift)
|
|
29139
|
+
for(var _i564=0,len=this._batchedRotEntries.length;_i564<len;_i564++){var entry=this._batchedRotEntries[_i564];entry.quat.set([0,0,0,1]);entry.layer.setMatrix(entry.portionId,math.identityMat4());}// Also clear persisted state
|
|
29140
|
+
for(var _i565=0,_len83=this._targetIds.length;_i565<_len83;_i565++){var state=this._rotationState[this._targetIds[_i565]];if(state)state.quat.set([0,0,0,1]);}// Reset instanced entries
|
|
29141
|
+
var _loop8=function _loop8(){var id=_this169._targetIds[_i566];if(_this169._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
|
|
29142
|
+
_this169._scene.setObjectsQuaternion([id],[0,0,0,1]);_this169._scene.setObjectsScale([id],[1,1,1]);};for(var _i566=0,_len84=this._targetIds.length;_i566<_len84;_i566++){if(_loop8())continue;}this._rootNode.quaternion=[0,0,0,1];}/** Start continuous rotation animation around an axis.
|
|
29059
29143
|
* @param {number[]} axis — normalized axis [x, y, z]
|
|
29060
29144
|
* @param {number} degreesPerSec — rotation speed in degrees per second
|
|
29061
29145
|
* @param {number} [duration] — optional max duration in seconds, omit for infinite */},{key:"animateRotation",value:function animateRotation(axis,degreesPerSec,duration){this.stopAnimation();var self=this;var startTime=performance.now();var lastTime=startTime;var _loop9=function loop(now){var elapsed=(now-startTime)/1000;if(duration&&elapsed>=duration){self.stopAnimation();return;}var dt=Math.min((now-lastTime)/1000,0.1);lastTime=now;var deg=degreesPerSec*dt;self._rootNode.rotate(axis,deg);self._applyEntityRotation(axis,deg);self._animRAF=requestAnimationFrame(_loop9);};this._animRAF=requestAnimationFrame(_loop9);}/** Stop any running rotation animation. */},{key:"stopAnimation",value:function stopAnimation(){if(this._animRAF){cancelAnimationFrame(this._animRAF);this._animRAF=null;}}/** Check if animation is running. @returns {boolean} */},{key:"isAnimating",value:function isAnimating(){return!!this._animRAF;}// ── Internal helpers ──
|
|
29062
|
-
},{key:"_applyEntityTranslationRaw",value:function _applyEntityTranslationRaw(delta){var scene=this._scene;for(var
|
|
29063
|
-
for(var
|
|
29146
|
+
},{key:"_applyEntityTranslationRaw",value:function _applyEntityTranslationRaw(delta){var scene=this._scene;for(var _i567=0,len=this._targetIds.length;_i567<len;_i567++){var id=this._targetIds[_i567];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p5=entity.position;scene.setObjectsPosition([id],[_p5[0]+delta[0],_p5[1]+delta[1],_p5[2]+delta[2]]);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;scene.setObjectsOffset([id],[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]]);}}}},{key:"_applyEntityTranslation",value:function _applyEntityTranslation(worldAxis,dot){var scene=this._scene;var delta=[worldAxis[0]*dot,worldAxis[1]*dot,worldAxis[2]*dot];for(var _i568=0,len=this._targetIds.length;_i568<len;_i568++){var id=this._targetIds[_i568];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p6=entity.position;var newPos=[_p6[0]+delta[0],_p6[1]+delta[1],_p6[2]+delta[2]];scene.setObjectsPosition([id],newPos);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;var newOff=[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]];scene.setObjectsOffset([id],newOff);}}}},{key:"_applyEntityRotation",value:function _applyEntityRotation(baseAxis,degrees){var _this170=this;var scene=this._scene;var quatDelta=math.vec4();math.angleAxisToQuaternion([baseAxis[0],baseAxis[1],baseAxis[2],degrees*math.DEGTORAD],quatDelta);// --- Batched meshes: direct layer.setMatrix ---
|
|
29147
|
+
for(var _i569=0,len=this._batchedRotEntries.length;_i569<len;_i569++){var entry=this._batchedRotEntries[_i569];var newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate for correct direction
|
|
29064
29148
|
math.mulQuaternions(entry.quat,quatDelta,newQ);entry.quat.set(newQ);// Compose pivot rotation manually: T(center) * R * T(-center)
|
|
29065
29149
|
var rotMat=math.mat4();math.quaternionToMat4(entry.quat,rotMat);var cx=entry.center[0],cy=entry.center[1],cz=entry.center[2];// M = T(c) * R * T(-c), built manually in column-major
|
|
29066
29150
|
var m=math.identityMat4();// Apply T(-center) to rotation matrix: R' = R * T(-c)
|
|
@@ -29069,15 +29153,15 @@ var m=math.identityMat4();// Apply T(-center) to rotation matrix: R' = R * T(-c)
|
|
|
29069
29153
|
var rx=rotMat[0],ry=rotMat[1],rz=rotMat[2];var r0x=rotMat[4],r0y=rotMat[5],r0z=rotMat[6];var r1x=rotMat[8],r1y=rotMat[9],r1z=rotMat[10];// result = T(c) * (R * T(-c))
|
|
29070
29154
|
m[12]=cx+rx*-cx+r0x*-cy+r1x*-cz;m[13]=cy+ry*-cx+r0y*-cy+r1y*-cz;m[14]=cz+rz*-cx+r0z*-cy+r1z*-cz;// Rotation part (upper 3x3) stays the same
|
|
29071
29155
|
m[0]=rotMat[0];m[4]=rotMat[4];m[8]=rotMat[8];m[1]=rotMat[1];m[5]=rotMat[5];m[9]=rotMat[9];m[2]=rotMat[2];m[6]=rotMat[6];m[10]=rotMat[10];entry.layer.setMatrix(entry.portionId,m);}// --- Instanced meshes: existing flow via entity quaternion ---
|
|
29072
|
-
var _loop0=function _loop0(){var id=_this170._targetIds[
|
|
29156
|
+
var _loop0=function _loop0(){var id=_this170._targetIds[_i570];var entity=scene._findObjectEntity(id);if(!entity)return 0;// continue
|
|
29073
29157
|
// Skip if already handled via batched entry
|
|
29074
29158
|
if(_this170._batchedRotEntries.some(function(e){return e.entityId===id;}))return 0;// continue
|
|
29075
29159
|
// Ensure entity has a SceneModelTransform for rotation
|
|
29076
29160
|
if(!entity.quaternion&&!entity.rotation){_this170._ensureEntityTransform(entity);}if(entity.quaternion){var _newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate
|
|
29077
|
-
math.mulQuaternions(entity.quaternion,quatDelta,_newQ);scene.setObjectsQuaternion([id],[_newQ[0],_newQ[1],_newQ[2],_newQ[3]]);}else if(entity.rotation){var _r7=entity.rotation;var delta=[0,0,0];if(Math.abs(baseAxis[0])>0.9)delta[0]=degrees;else if(Math.abs(baseAxis[1])>0.9)delta[1]=degrees;else if(Math.abs(baseAxis[2])>0.9)delta[2]=degrees;scene.setObjectsRotation([id],[_r7[0]+delta[0],_r7[1]+delta[1],_r7[2]+delta[2]]);}},_ret2;for(var
|
|
29161
|
+
math.mulQuaternions(entity.quaternion,quatDelta,_newQ);scene.setObjectsQuaternion([id],[_newQ[0],_newQ[1],_newQ[2],_newQ[3]]);}else if(entity.rotation){var _r7=entity.rotation;var delta=[0,0,0];if(Math.abs(baseAxis[0])>0.9)delta[0]=degrees;else if(Math.abs(baseAxis[1])>0.9)delta[1]=degrees;else if(Math.abs(baseAxis[2])>0.9)delta[2]=degrees;scene.setObjectsRotation([id],[_r7[0]+delta[0],_r7[1]+delta[1],_r7[2]+delta[2]]);}},_ret2;for(var _i570=0,_len85=this._targetIds.length;_i570<_len85;_i570++){_ret2=_loop0();if(_ret2===0)continue;}}},{key:"_applyEntityScale",value:function _applyEntityScale(factors){var scene=this._scene;for(var _i571=0,len=this._targetIds.length;_i571<len;_i571++){var id=this._targetIds[_i571];// Ensure entity has a transform before scaling
|
|
29078
29162
|
var _s2=scene.getObjectScale(id);if(!_s2){var entity=scene._findObjectEntity(id);if(entity){this._ensureEntityTransform(entity);}_s2=scene.getObjectScale(id);}if(_s2){scene.setObjectsScale([id],[Math.max(0.01,_s2[0]*factors[0]),Math.max(0.01,_s2[1]*factors[1]),Math.max(0.01,_s2[2]*factors[2])]);}}}},{key:"_ensureEntityTransform",value:function _ensureEntityTransform(entity){// Only for instanced meshes — batched meshes are handled via _batchedRotEntries
|
|
29079
29163
|
if(!entity.meshes||entity.meshes.length===0)return;var model=entity.model;if(!model||!model.createTransform)return;// Check if any mesh has a render layer that supports setMatrix AND already has a transform
|
|
29080
|
-
var hasMatrixCapableLayer=false;for(var
|
|
29164
|
+
var hasMatrixCapableLayer=false;for(var _i572=0,len=entity.meshes.length;_i572<len;_i572++){var m=entity.meshes[_i572];if(m&&m.layer&&typeof m.layer.setMatrix==="function"&&m.transform){hasMatrixCapableLayer=true;break;}}if(!hasMatrixCapableLayer)return;var offset=entity.offset;for(var _i573=0,_len86=entity.meshes.length;_i573<_len86;_i573++){var _mesh1=entity.meshes[_i573];if(_mesh1&&!_mesh1.transform&&_mesh1.layer&&typeof _mesh1.layer.setMatrix==="function"){var transformId="__edit_xform_".concat(_mesh1.id||entity.id,"_").concat(_i573);var _transform4=model.createTransform({id:transformId,position:[offset[0],offset[1],offset[2]],quaternion:[0,0,0,1],scale:[1,1,1]});if(_transform4){_transform4._addMesh(_mesh1);}}}entity.offset=[0,0,0];}/* ======================== DESTROY ======================== */},{key:"destroy",value:function destroy(){this.stopAnimation();this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);cameraControl.off(this._onCameraControlTouch);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("touchstart",this._canvasTouchStartListener);canvas.removeEventListener("touchmove",this._canvasTouchMoveListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);}},{key:"_destroyNodes",value:function _destroyNodes(){this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};this._targetIds=[];this._batchedRotEntries=[];this._rotationState={};}}]);}();/**
|
|
29081
29165
|
* ObjectEditPlugin — interactive 3D transform controls (translate / rotate / scale) plus
|
|
29082
29166
|
* quick colorize, x-ray, and hide for model components.
|
|
29083
29167
|
*
|
|
@@ -29174,7 +29258,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
29174
29258
|
* @private
|
|
29175
29259
|
* @param arrayBuffer
|
|
29176
29260
|
* @returns {{}}
|
|
29177
|
-
*/var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(_ref22){var item=_ref22.item,format=_ref22.format,size=_ref22.size;var str,array;switch(format){case'char':array=new Uint8Array(arrayBuffer,currentByte,size);currentByte+=size;str=uint8arrayToString(array);return[item,str];case'uShort':str=dataView.getUint16(currentByte,true);currentByte+=size;return[item,str];case'uLong':str=dataView.getUint32(currentByte,true);if(item==='NumberOfVariableLengthRecords'){numOfVarLenRecords=str;}currentByte+=size;return[item,str];case'uChar':str=dataView.getUint8(currentByte);currentByte+=size;return[item,str];case'double':str=dataView.getFloat64(currentByte,true);currentByte+=size;return[item,str];default:currentByte+=size;}};var getValues=function getValues(){var publicHeaderBlock={};headerBlockItems.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));if(myObj!==undefined){if(myObj[0]==='FileSignature'&&myObj[1]!=='LASF'){throw new Error('Ivalid FileSignature. Is this a LAS/LAZ file');}publicHeaderBlock[myObj[0]]=myObj[1];}});var variableRecords=[];var variableLengthRecords=numOfVarLenRecords;var _loop1=function _loop1(){var variableObj={};variableLengthRecord.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));variableObj[myObj[0]]=myObj[1];if(myObj[0]==='UserId'&&myObj[1]==='LASF_Projection'){projectionStart=currentByte-18+54;}});variableRecords.push(variableObj);};while(variableLengthRecords--){_loop1();}var geoRecord=variableRecords.find(function(x){return x.UserId==='LASF_Projection';});var epsg=getGeoKeys(geoRecord);if(epsg){publicHeaderBlock['epsg']=epsg;}return publicHeaderBlock;};return getValues();};var bufferFlipper=function bufferFlipper(buf){var ab=new ArrayBuffer(buf.length);var view=new Uint8Array(ab);for(var
|
|
29261
|
+
*/var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(_ref22){var item=_ref22.item,format=_ref22.format,size=_ref22.size;var str,array;switch(format){case'char':array=new Uint8Array(arrayBuffer,currentByte,size);currentByte+=size;str=uint8arrayToString(array);return[item,str];case'uShort':str=dataView.getUint16(currentByte,true);currentByte+=size;return[item,str];case'uLong':str=dataView.getUint32(currentByte,true);if(item==='NumberOfVariableLengthRecords'){numOfVarLenRecords=str;}currentByte+=size;return[item,str];case'uChar':str=dataView.getUint8(currentByte);currentByte+=size;return[item,str];case'double':str=dataView.getFloat64(currentByte,true);currentByte+=size;return[item,str];default:currentByte+=size;}};var getValues=function getValues(){var publicHeaderBlock={};headerBlockItems.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));if(myObj!==undefined){if(myObj[0]==='FileSignature'&&myObj[1]!=='LASF'){throw new Error('Ivalid FileSignature. Is this a LAS/LAZ file');}publicHeaderBlock[myObj[0]]=myObj[1];}});var variableRecords=[];var variableLengthRecords=numOfVarLenRecords;var _loop1=function _loop1(){var variableObj={};variableLengthRecord.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));variableObj[myObj[0]]=myObj[1];if(myObj[0]==='UserId'&&myObj[1]==='LASF_Projection'){projectionStart=currentByte-18+54;}});variableRecords.push(variableObj);};while(variableLengthRecords--){_loop1();}var geoRecord=variableRecords.find(function(x){return x.UserId==='LASF_Projection';});var epsg=getGeoKeys(geoRecord);if(epsg){publicHeaderBlock['epsg']=epsg;}return publicHeaderBlock;};return getValues();};var bufferFlipper=function bufferFlipper(buf){var ab=new ArrayBuffer(buf.length);var view=new Uint8Array(ab);for(var _i574=0;_i574<buf.length;++_i574){view[_i574]=buf[_i574];}return ab;};var uint8arrayToString=function uint8arrayToString(array){var str='';array.forEach(function(item){var c=String.fromCharCode(item);if(c!=="\0"){str+=c;}});return str.trim();};var MAX_VERTICES=500000;// TODO: Rough estimate
|
|
29178
29262
|
/**
|
|
29179
29263
|
* {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
|
|
29180
29264
|
*
|
|
@@ -29453,7 +29537,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
29453
29537
|
* @param {Object} [params.stats] Collects model statistics.
|
|
29454
29538
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
29455
29539
|
*/},{key:"load",value:function load(){var _this173=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{maxGeometryBatchSize:MAX_VERTICES,isModel:true}));if(!params.src&&!params.las){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
|
|
29456
|
-
}var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this173.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this174=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this174._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this174.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this174.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this175=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this175._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var
|
|
29540
|
+
}var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this173.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this174=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this174._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this174.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this174.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this175=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this175._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i575=0,len=positionsValue.length;_i575<len;_i575+=3){centerPos[0]+=positionsValue[_i575+0];centerPos[1]+=positionsValue[_i575+1];centerPos[2]+=positionsValue[_i575+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i576=0,_len87=positionsValue.length;_i576<_len87;_i576+=3){positionsValue[_i576+0]-=centerPos[0];positionsValue[_i576+1]-=centerPos[1];positionsValue[_i576+2]-=centerPos[2];}}if(_this175._rotateX){if(positionsValue){for(var _i577=0,_len88=positionsValue.length;_i577<_len88;_i577+=3){var temp=positionsValue[_i577+1];positionsValue[_i577+1]=positionsValue[_i577+2];positionsValue[_i577+2]=temp;}}}if(_this175._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this175._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i578=0,_len89=positionsValue.length;_i578<_len89;_i578+=3){pos[0]=positionsValue[_i578+0];pos[1]=positionsValue[_i578+1];pos[2]=positionsValue[_i578+2];math.transformPoint3(mat,pos,pos);positionsValue[_i578+0]=pos[0];positionsValue[_i578+1]=pos[1];positionsValue[_i578+2]=pos[2];}}if(_this175._transform){var _mat=math.mat4(_this175._transform);var _pos=math.vec3();for(var _i579=0,_len90=positionsValue.length;_i579<_len90;_i579+=3){_pos[0]=positionsValue[_i579+0];_pos[1]=positionsValue[_i579+1];_pos[2]=positionsValue[_i579+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i579+0]=_pos[0];positionsValue[_i579+1]=_pos[1];positionsValue[_i579+2]=_pos[2];}}return positionsValue;};function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i580=0,j=0,k=0,len=intensities.length;_i580<len;_i580++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i580]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i581=0,j=0,k=0,len=intensities.length;_i581<len;_i581++,k+=3,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i581]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$2(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i582=0,len=pointsChunks.length;_i582<len;_i582++){var meshId="pointsMesh".concat(_i582);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i582],colorsCompressed:_i582<colorsChunks.length?colorsChunks[_i582]:null});}/*
|
|
29457
29541
|
const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
|
|
29458
29542
|
const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
|
|
29459
29543
|
const meshIds = [];
|
|
@@ -29478,7 +29562,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
29478
29562
|
}
|
|
29479
29563
|
*/var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this175.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this175.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
29480
29564
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
29481
|
-
});resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var
|
|
29565
|
+
});resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i583=0;_i583<array.length;_i583+=chunkSize){result.push(array.slice(_i583,_i583+chunkSize));}return result;}
|
|
29482
29566
|
|
|
29483
29567
|
|
|
29484
29568
|
/***/ },
|
|
@@ -77019,6 +77103,10 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
|
|
|
77019
77103
|
}
|
|
77020
77104
|
/**
|
|
77021
77105
|
* 缓冲对象spinner显隐设置
|
|
77106
|
+
*
|
|
77107
|
+
* 语义(Spinner#visible):show=true 强制显示(直到 show=false 解除,期间不受内核 processes 计数影响);
|
|
77108
|
+
* show=false 解除强制显示,可见性回落到 processes 计数控制(内核加载/元数据阶段会自动计数)。
|
|
77109
|
+
*
|
|
77022
77110
|
* @param show
|
|
77023
77111
|
*/
|
|
77024
77112
|
showSpinner(show = !this.viewer.scene.canvas.spinner.visible) {
|